@@ -20,20 +20,43 @@ jobs:
2020 strategy :
2121 matrix :
2222 os : [ubuntu-latest, macos-latest, macos-13, windows-latest]
23+ agda : ['2.7.0.1', '2.6.4.3']
2324 fail-fast : false
2425 steps :
2526
2627 - name : 📥 Checkout repository
2728 uses : actions/checkout@v4
2829
29- - name : 🏗 Install yq (Windows)
30+ - name : 📤 Install yq (Windows)
3031 if : runner.os == 'Windows'
3132 uses : frenck/action-setup-yq@v1
3233
33- - name : 🔍 Determine Stack resolver & GHC version
34+ - name : 🎛️ Determine which version of Agda to target
3435 run : |
35- STACK_RESOLVER=$(yq .resolver stack.yaml)
36- GHC_VERSION=$(echo $(yq .compiler stack.yaml) | cut -c 5-)
36+ STACK_YAML=$(echo stack-9.2-Agda-${{ matrix.agda }}.yaml)
37+ STACK_YAML_ARG="--stack-yaml $(echo stack-9.2-Agda-${{ matrix.agda }}.yaml)"
38+
39+ if [[ ${{ matrix.os }} == "ubuntu-latest" ]]; then
40+ ARTEFACT="als-Agda-${{ matrix.agda }}-ubuntu"
41+ fi
42+ if [[ ${{ matrix.os }} == "macos-latest" ]]; then
43+ ARTEFACT="als-Agda-${{ matrix.agda }}-macos-arm64"
44+ fi
45+ if [[ ${{ matrix.os }} == "macos-13" ]]; then
46+ ARTEFACT="als-Agda-${{ matrix.agda }}-macos-x64"
47+ fi
48+ if [[ ${{ matrix.os }} == "windows-latest" ]]; then
49+ ARTEFACT="als-Agda-${{ matrix.agda }}-windows"
50+ fi
51+
52+ echo STACK_YAML_ARG="${STACK_YAML_ARG}" >> "${GITHUB_ENV}"
53+ echo STACK_YAML="${STACK_YAML}" >> "${GITHUB_ENV}"
54+ echo ARTE="${ARTEFACT}" >> "${GITHUB_ENV}"
55+
56+ - name : 🎛️ Determine Stack resolver & GHC version
57+ run : |
58+ STACK_RESOLVER=$(yq .resolver $STACK_YAML)
59+ GHC_VERSION=$(echo $(yq .compiler $STACK_YAML) | cut -c 5-)
3760 echo STACK_RESOLVER="${STACK_RESOLVER}" >> "${GITHUB_ENV}"
3861 echo GHC_VERSION="${GHC_VERSION}" >> "${GITHUB_ENV}"
3962
@@ -46,11 +69,20 @@ jobs:
4669 enable-stack : true
4770 stack-version : ' latest'
4871
49- - name : 🔍 Determine Stack root
72+ - name : 🎛️ Determine Stack root
5073 run : |
51- STACK_ROOT="$(stack path --stack-root)"
74+ STACK_ROOT="$(stack path $STACK_YAML_ARG --stack-root)"
5275 echo STACK_ROOT="${STACK_ROOT}" >> "${GITHUB_ENV}"
5376
77+ - name : 🔍 Review all variables
78+ run : |
79+ echo "STACK_YAML = ${STACK_YAML}"
80+ echo "STACK_YAML_ARG = ${STACK_YAML_ARG}"
81+ echo "STACK_RESOLVER = ${STACK_RESOLVER}"
82+ echo "ARTEFACT = ${ARTEFACT}"
83+ echo "GHC_VERSION = ${GHC_VERSION}"
84+ echo "STACK_ROOT = ${STACK_ROOT}"
85+
5486 # things to be restored:
5587 # Include STACK_RESOLVER in cache key, otherwise caches accumulate build products for different resolvers.
5688
@@ -73,27 +105,27 @@ jobs:
73105 ${{ matrix.os }}-stack-resolver-${{ env.STACK_RESOLVER }}-work
74106
75107 # actions:
76- - name : Set PKG_CONFIG_PATH for the ICU library (on macOS)
108+ - name : ⚙️ Set PKG_CONFIG_PATH for the ICU library (on macOS)
77109 if : runner.os == 'macOS'
78110 run : |
79111 echo PKG_CONFIG_PATH="$(brew --prefix)/opt/icu4c/lib/pkgconfig" >> "${GITHUB_ENV}"
80112
81- - name : Install the icu library (on Windows)
113+ - name : 📥 Install the icu library (on Windows)
82114 if : runner.os == 'Windows'
83115 run : |
84- stack exec -- pacman -S --noconfirm mingw-w64-x86_64-icu mingw-w64-x86_64-pkgconf
116+ stack exec $STACK_YAML_ARG -- pacman -S --noconfirm mingw-w64-x86_64-icu mingw-w64-x86_64-pkgconf
85117
86118 - name : 📸 Build Snapshot
87- run : stack build --no-terminal --only-snapshot -j1
119+ run : stack build $STACK_YAML_ARG --no-terminal --only-snapshot -j1
88120
89- - name : 🧰 Build Dependencies
90- run : stack build --no-terminal --only-dependencies
121+ - name : 🏗️ Build Dependencies
122+ run : stack build $STACK_YAML_ARG --no-terminal --only-dependencies
91123
92- - name : 🧰 Build ALS
93- run : stack build
124+ - name : 🏗️ Build ALS
125+ run : stack build $STACK_YAML_ARG
94126
95- - name : 🧰 Build Testings
96- run : stack build --test --no-terminal --only-dependencies
127+ - name : 🏗️ Build Testings
128+ run : stack build $STACK_YAML_ARG --test --no-terminal --only-dependencies
97129
98130 # things to be cached
99131
@@ -128,7 +160,7 @@ jobs:
128160 echo "dylib_dir: $dylib_dir"
129161
130162 # find the path of "als"
131- executable=$(find "$(stack path --local-install-root)"/bin -name "als")
163+ executable=$(find "$(stack path $STACK_YAML_ARG --local-install-root)"/bin -name "als")
132164 echo "executable: $executable"
133165
134166 # remove the old dylib, and make a new one
@@ -207,11 +239,11 @@ jobs:
207239 id : zip
208240 run : |
209241 # locate the data-dir
210- datadir=$(find "$(stack path --snapshot-install-root)/share" -type d -name "Agda-*")
242+ datadir=$(find "$(stack path $STACK_YAML_ARG --snapshot-install-root)/share" -type d -name "Agda-*")
211243 echo "datadir: $datadir"
212244
213245 # locate the executable
214- executable=$(find "$(stack path --local-install-root)/bin" -name "als")
246+ executable=$(find "$(stack path $STACK_YAML_ARG --local-install-root)/bin" -name "als")
215247 echo "executable: $executable"
216248
217249 # make a temporary directory for compresssing
@@ -223,35 +255,22 @@ jobs:
223255 cp "$executable" zip/
224256
225257 # compress
226- if [[ ${{ runner.os }} == "Linux" ]]; then
227- cd zip
228- zip -r als-ubuntu.zip ./*
229- cd ..
230- mv zip/als-ubuntu.zip .
231- fi
232- if [[ ${{ matrix.os }} == "macos-latest" ]]; then
233- cd zip
234- zip -r als-macos-arm64.zip ./*
235- cd ..
236- mv zip/als-macos-arm64.zip .
237- fi
238- if [[ ${{ matrix.os }} == "macos-13" ]]; then
239- cd zip
240- zip -r als-macos-x64.zip ./*
241- cd ..
242- mv zip/als-macos-x64.zip .
243- fi
258+ cd zip
259+ zip -r $ARTEFACT.zip ./*
260+ cd ..
261+ mv zip/$ARTEFACT.zip .
262+
244263
245264 - name : 📦 Bundle executable, DLLs and data files (on Windows)
246265 if : runner.os == 'Windows'
247266 shell : pwsh
248267 run : |
249268 # locate the data-dir
250- $snapshot = (stack path --snapshot-install-root)
269+ $snapshot = (stack path $STACK_YAML_ARG --snapshot-install-root)
251270 $datadir = (ls $snapshot\share *Agda-* -Recurse -Directory).FullName
252271
253272 # locate the executable
254- $local = (stack path --local-install-root)
273+ $local = (stack path $STACK_YAML_ARG --local-install-root)
255274 $executable = (ls $local\bin *als.exe* -Recurse -File).FullName
256275
257276 # make a temporary directory for compresssing
@@ -260,7 +279,7 @@ jobs:
260279 cp $executable zip/
261280
262281 # include text-icu DLLs
263- $mingw64bin = (stack path --extra-library-dirs).split(", ") -match "\\bin"
282+ $mingw64bin = (stack path $STACK_YAML_ARG --extra-library-dirs).split(", ") -match "\\bin"
264283 ls $mingw64bin
265284 cp (ls $mingw64bin *libicudt*) zip/
266285 cp (ls $mingw64bin *libicuin*) zip/
@@ -269,31 +288,17 @@ jobs:
269288
270289 # compress
271290 cd zip
272- Compress-Archive * als-windows .zip
291+ Compress-Archive * $ARTEFACT .zip
273292 cd ..
274- mv zip/als-windows .zip .
293+ mv zip/$ARTEFACT .zip .
275294
276295
277296 - name : 🧪 Run tests
278- run : stack test --ta --als-path=zip/als
297+ run : stack test $STACK_YAML_ARG --ta --als-path=zip/als
279298
280299 # release (optional)
281300 - name : 🚢 Release Artifacts
282301 if : startsWith(github.ref, 'refs/tags/v') # so that only commits with a git tag would upload artifacts
283302 env :
284303 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
285- run : |
286- if [[ ${{ matrix.os }} == "ubuntu-latest" ]]; then
287- gh release upload ${{ github.ref_name }} als-ubuntu.zip --clobber
288- fi
289- # arm64 macos
290- if [[ ${{ matrix.os }} == "macos-latest" ]]; then
291- gh release upload ${{ github.ref_name }} als-macos-arm64.zip --clobber
292- fi
293- # x64 macos
294- if [[ ${{ matrix.os }} == "macos-13" ]]; then
295- gh release upload ${{ github.ref_name }} als-macos-x64.zip --clobber
296- fi
297- if [[ ${{ matrix.os }} == "windows-latest" ]]; then
298- gh release upload ${{ github.ref_name }} als-windows.zip --clobber
299- fi
304+ run : gh release upload ${{ github.ref_name }} $ARTEFACT.zip --clobber
0 commit comments