-
Notifications
You must be signed in to change notification settings - Fork 3
/
action.yml
148 lines (134 loc) · 5.17 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: "Test supported GHC versions"
description: "Generate a test matrix from your cabal file's `tested-with` stanza"
inputs:
cabal-file:
description: "The path to your cabal file, e.g. somefolder/myproject.cabal"
required: true
version:
description: "Version of the get-tested tool"
required: false
default: ""
windows:
description: "Enable Windows runner, latest version"
required: false
default: false
deprecationMessage: "Please use 'windows-version: latest' instead."
windows-version:
description: "Enable Windows runner. If both `windows` and `windows-version` inputs are set, the explicit version will take priority"
required: false
default: ""
macos:
description: "Enable macOS runner, latest version"
required: false
default: false
deprecationMessage: "Please use 'macos-version: latest' instead."
macos-version:
description: "Enable macOS runner. If both `macos` and `macos-version` inputs are set, the explicit version will take priority"
required: false
default: ""
ubuntu:
description: "Enable Ubuntu runner, latest version"
required: false
default: false
deprecationMessage: "Please use 'ubuntu-version: latest' instead."
ubuntu-version:
description: "Enable Ubuntu runner. If both `ubuntu` and `ubuntu-version` inputs are set, the explicit version will take priority"
required: false
default: ""
newest:
description: "Enable only the newest GHC version found in the cabal file"
required: false
default: false
oldest:
description: "Enable only the oldest GHC version found in the cabal file"
required: false
default: false
outputs:
matrix:
description: "The GHC version matrix"
value: ${{ steps.set-matrix.outputs.matrix }}
runs:
using: "composite"
steps:
- name: Checkout base repo
uses: actions/checkout@v4
# The following does not work:
#
# uses: Kleidukos/get-tested/setup-get-tested@${{ github.action_ref }}
#
# See: https://github.com/actions/runner/issues/895
- name: Set up get-tested
uses: Kleidukos/get-tested/setup-get-tested@5f873c05c435a1f50e4c5ce815d687c1bff3b93b
with:
version: ${{ inputs.version }}
- name: Set up Windows options
shell: bash
run: |
echo "::debug::windows: ${{ inputs.windows-version }}"
if [[ "${{ inputs.windows-version }}" != "" ]]
then
echo "::debug::Windows explicit enabled: ${{ inputs.windows-version }}"
echo "WINDOWS=--windows-version=${{ inputs.windows-version }}" >> $GITHUB_ENV
elif [[ ${{ inputs.windows }} == "true" ]]
then
echo "::warning title=Legacy option `windows`::Windows fallback enabled: ${{ inputs.windows }}"
echo "WINDOWS=--windows" >> $GITHUB_ENV
else echo "WINDOWS=" >> $GITHUB_ENV
fi
- name: Set up macOS options
shell: bash
run: |
echo "::debug::macOS: ${{ inputs.macos-version }}"
if [[ "${{ inputs.macos-version }}" != "" ]]
then
echo "::debug::macOS explicit version enabled: ${{ inputs.macos-version }}"
echo "MACOS=--macos-version=${{ inputs.macos-version }}" >> $GITHUB_ENV
elif [[ ${{ inputs.macos }} == "true" ]]
then
echo "::warning title=Legacy option `macos`::macOS fallback enabled: ${{ inputs.macos }}"
echo "MACOS=--macos" >> $GITHUB_ENV
else echo "MACOS=" >> $GITHUB_ENV
fi
- name: Set up Ubuntu options
shell: bash
run: |
echo "::debug::ubuntu: ${{ inputs.ubuntu-version }}"
if [[ "${{ inputs.ubuntu-version }}" != "" ]]
then
echo "::debug::Ubuntu explicit version enabled: ${{ inputs.ubuntu-version }}"
echo "UBUNTU=--ubuntu-version=${{ inputs.ubuntu-version }}" >> $GITHUB_ENV
elif [[ ${{ inputs.ubuntu }} == "true" ]]
then
echo "::warning title=Legacy option `ubuntu`::Ubuntu fallback enabled: ${{ inputs.ubuntu }}"
echo "UBUNTU=--ubuntu" >> $GITHUB_ENV
else echo "UBUNTU=" >> $GITHUB_ENV
fi
- name: Set up `oldest` and `newest` options
shell: bash
run: |
echo "::debug::Is --newest enabled: ${{ inputs.newest }}"
echo "::debug::Is --oldest enabled: ${{ inputs.oldest }}"
if [[ "${{ inputs.oldest}} == "true" " && "${{ inputs.newest }}" == "true" ]]
then
echo "::error title=Incompatible options::You cannot use the 'oldest' and 'newest' options together!"
exit 1
fi
if [[ ${{ inputs.oldest }} == "true" ]]
then
echo "::debug::oldest version enabled"
echo "RELATIVE_VERSION=--oldest" >> $GITHUB_ENV
elif [[ ${{ inputs.newest }} == "true" ]]
then
echo "::debug::newest version enabled"
echo "RELATIVE_VERSION=--newest" >> $GITHUB_ENV
else
echo "::debug::No relative version selected"
fi
- name: Extract the tested GHC versions
id: set-matrix
shell: bash
run: |
./get-tested $WINDOWS $MACOS $UBUNTU $RELATIVE_VERSION ${{ inputs.cabal-file }} >> $GITHUB_OUTPUT
branding:
icon: 'list'
color: 'blue'