2020 runs-on : ${{ matrix.os }}
2121 strategy :
2222 matrix :
23- os : [windows-latest, ubuntu-latest, macos-latest, macos-13 ]
23+ os : [windows-latest, ubuntu-latest, macos-latest, macos-15-intel ]
2424 agda : ['Agda-2.8.0', 'Agda-2.7.0.1', 'Agda-2.6.4.3']
2525 fail-fast : false
2626 steps :
4040 # Determine artifact naming based on branch/tag
4141 if [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
4242 PREFIX="als-dev"
43+ elif [[ "${{ github.ref }}" == refs/tags/v* ]]; then
44+ PREFIX="als-${{ github.ref_name }}"
4345 else
4446 PREFIX="als"
4547 fi
5052 if [[ ${{ matrix.os }} == "macos-latest" ]]; then
5153 ARTEFACT="$PREFIX-${{ matrix.agda }}-macos-arm64"
5254 fi
53- if [[ ${{ matrix.os }} == "macos-13 " ]]; then
55+ if [[ ${{ matrix.os }} == "macos-15-intel " ]]; then
5456 ARTEFACT="$PREFIX-${{ matrix.agda }}-macos-x64"
5557 fi
5658 if [[ ${{ matrix.os }} == "windows-latest" ]]; then
@@ -315,7 +317,8 @@ jobs:
315317 - name : 🧪 Run tests
316318 run : stack test $STACK_YAML_ARG
317319
318- - name : 📤 Upload build artifact
320+ - name : 📤 Upload native artifact
321+ if : startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/ci'
319322 uses : actions/upload-artifact@v4
320323 with :
321324 name : ${{ env.ARTEFACT }}
@@ -324,8 +327,15 @@ jobs:
324327
325328 build-wasm :
326329 name : Build WASM
327- if : github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/ci'
330+ if : startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/ci'
328331 runs-on : ubuntu-22.04
332+ strategy :
333+ matrix :
334+ agda :
335+ - { name: '2.8.0', label: 'Agda-2.8.0', flag: '2-8-0', commit: 'e2f8c69414fa115328280ecc4de1d2b7a23be7fa' }
336+ - { name: '2.7.0.1', label: 'Agda-2.7.0.1', flag: '2-7-0', commit: '702c924fdab93aa8992adca84e72a91c490f7b1b' }
337+ - { name: '2.6.4.3', label: 'Agda-2.6.4.3', flag: '2-6-4', commit: '8f35851954c39dc3849095bfd018bed9bd1b32ad' }
338+ fail-fast : false
329339
330340 env :
331341 GHC_WASM_META_FLAVOUR : ' 9.10'
@@ -338,7 +348,16 @@ jobs:
338348 submodules : true
339349
340350 - name : Compute cache key
341- run : echo "CI_CACHE_KEY=${{ runner.os }}-${{ runner.arch }}-${{ env.GHC_WASM_META_COMMIT_HASH }}-flavor-${{ env.GHC_WASM_META_FLAVOUR }}" >> "$GITHUB_ENV"
351+ run : |
352+ echo "CI_CACHE_KEY=${{ runner.os }}-${{ runner.arch }}-${{ env.GHC_WASM_META_COMMIT_HASH }}-flavor-${{ env.GHC_WASM_META_FLAVOUR }}-${{ matrix.agda.name }}" >> "$GITHUB_ENV"
353+ if [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
354+ PREFIX="als-dev"
355+ elif [[ "${{ github.ref }}" == refs/tags/v* ]]; then
356+ PREFIX="als-${{ github.ref_name }}"
357+ else
358+ PREFIX="als"
359+ fi
360+ echo "WASM_ASSET_BASENAME=${PREFIX}-${{ matrix.agda.label }}-wasm" >> "$GITHUB_ENV"
342361
343362 - name : Try to restore cached .ghc-wasm
344363 id : ghc-wasm-cache-restore
@@ -360,15 +379,6 @@ jobs:
360379 restore-keys : |
361380 native-cabal-${{ runner.os }}-${{ runner.arch }}-
362381
363- - name : Try to restore cached dist-newstyle
364- id : dist-newstyle-cache-restore
365- uses : actions/cache/restore@v4
366- with :
367- path : als/dist-newstyle
368- key : dist-newstyle-${{ env.CI_CACHE_KEY }}
369- restore-keys : |
370- dist-newstyle-${{ runner.os }}-${{ runner.arch }}-
371-
372382 - name : Clone and setup ghc-wasm-meta
373383 id : ghc-wasm-setup
374384 if : steps.ghc-wasm-cache-restore.outputs.cache-matched-key == ''
@@ -397,11 +407,28 @@ jobs:
397407 echo ">>> Install alex and happy"
398408 ~/.ghc-wasm/cabal/bin/cabal install alex-3.5.0.0 happy-1.20.1.1
399409
410+ - name : Checkout Agda submodule at v${{ matrix.agda.name }}
411+ run : |
412+ cd als/wasm-submodules/agda
413+ git fetch --depth 1 origin "${{ matrix.agda.commit }}"
414+ git checkout FETCH_HEAD
415+ echo "AGDA_WASM_COMMIT=$(git rev-parse HEAD)" >> "$GITHUB_ENV"
416+
417+ - name : Restore dist-newstyle cache for resolved Agda revision
418+ id : dist-newstyle-cache-restore-resolved
419+ uses : actions/cache/restore@v4
420+ with :
421+ path : als/dist-newstyle
422+ key : dist-newstyle-${{ env.CI_CACHE_KEY }}-agda-${{ env.AGDA_WASM_COMMIT }}-${{ hashFiles('als/cabal.project.wasm32', 'als/agda-language-server.cabal', 'als/package.yaml') }}
423+ restore-keys : |
424+ dist-newstyle-${{ env.CI_CACHE_KEY }}-agda-${{ env.AGDA_WASM_COMMIT }}-
425+ dist-newstyle-${{ runner.os }}-${{ runner.arch }}-
426+
400427 - name : Cabal configure
401428 working-directory : ' ./als'
402429 run : |
403430 mv cabal.project.wasm32 cabal.project
404- wasm32-wasi-cabal configure --flag=Agda-2-8-0
431+ wasm32-wasi-cabal configure --flag=Agda-${{ matrix.agda.flag }}
405432
406433 - name : Build Agda as dependency
407434 id : build-dep-agda
@@ -413,7 +440,7 @@ jobs:
413440 if : steps.build-dep-agda.outcome == 'success'
414441 with :
415442 path : als/dist-newstyle
416- key : dist-newstyle-${{ env.CI_CACHE_KEY }}
443+ key : dist-newstyle-${{ env.CI_CACHE_KEY }}-agda-${{ env.AGDA_WASM_COMMIT }}-${{ hashFiles('als/cabal.project.wasm32', 'als/agda-language-server.cabal', 'als/package.yaml') }}
417444
418445 - name : Build dependencies other than Agda
419446 working-directory : ' ./als'
@@ -431,9 +458,8 @@ jobs:
431458 mkdir ~/out
432459 wasm32-wasi-cabal build
433460 WASM_BINARY_PATH=$(wasm32-wasi-cabal list-bin als)
434- WASM_BINARY_NAME=$(basename "$WASM_BINARY_PATH")
435- cp "$WASM_BINARY_PATH" ~/out
436- echo "WASM_BINARY_NAME=$WASM_BINARY_NAME" >> $GITHUB_ENV
461+ cp "$WASM_BINARY_PATH" ~/out/${WASM_ASSET_BASENAME}.wasm
462+ echo "WASM_BINARY_NAME=${WASM_ASSET_BASENAME}.wasm" >> $GITHUB_ENV
437463
438464 - name : Clean up native/wasm cabal logs
439465 run : rm -rf ~/.cache/cabal/logs ~/.ghc-wasm/.cabal/logs
@@ -457,7 +483,7 @@ jobs:
457483 - name : 📤 Upload WASM artifact
458484 uses : actions/upload-artifact@v4
459485 with :
460- name : als-dev-wasm
486+ name : ${{ env.WASM_ASSET_BASENAME }}
461487 path : ~/out/${{ env.WASM_BINARY_NAME }}
462488 retention-days : 1
463489
@@ -520,7 +546,12 @@ jobs:
520546 if [ -f "${artifact_name}/${artifact_name}.zip" ]; then
521547 gh release upload ${{ github.ref_name }} "${artifact_name}/${artifact_name}.zip" --clobber --repo ${{ github.repository }}
522548 else
523- echo "Warning: No .zip file found in ${artifact_name}"
549+ artifact_file=$(find "${artifact_name}" -maxdepth 1 -type f | head -1)
550+ if [ -n "$artifact_file" ]; then
551+ gh release upload ${{ github.ref_name }} "$artifact_file" --clobber --repo ${{ github.repository }}
552+ else
553+ echo "Warning: No uploadable file found in ${artifact_name}"
554+ fi
524555 fi
525556 done
526557
@@ -541,21 +572,17 @@ jobs:
541572 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
542573 run : |
543574 cd artifacts
544- # Upload only Agda-2.8.0 artifacts and WASM
545- for dir in *Agda-2.8.0* als-dev-wasm; do
546- if [ -d "$dir" ]; then
547- artifact_name="$dir"
548- echo "Uploading ${artifact_name}..."
549- if [ -f "${artifact_name}/${artifact_name}.zip" ]; then
550- gh release upload dev "${artifact_name}/${artifact_name}.zip" --clobber --repo ${{ github.repository }}
551- elif [ "$artifact_name" = "als-dev-wasm" ]; then
552- # Find the WASM binary (filename may vary)
553- wasm_file=$(find "${artifact_name}" -type f -name "als*" | head -1)
554- if [ -n "$wasm_file" ]; then
555- gh release upload dev "$wasm_file" --clobber --repo ${{ github.repository }}
556- else
557- echo "Warning: WASM binary not found in ${artifact_name}"
558- fi
575+ for dir in */; do
576+ artifact_name="${dir%/}"
577+ echo "Uploading ${artifact_name}..."
578+ if [ -f "${artifact_name}/${artifact_name}.zip" ]; then
579+ gh release upload dev "${artifact_name}/${artifact_name}.zip" --clobber --repo ${{ github.repository }}
580+ else
581+ artifact_file=$(find "${artifact_name}" -maxdepth 1 -type f | head -1)
582+ if [ -n "$artifact_file" ]; then
583+ gh release upload dev "$artifact_file" --clobber --repo ${{ github.repository }}
584+ else
585+ echo "Warning: No uploadable file found in ${artifact_name}"
559586 fi
560587 fi
561- done
588+ done
0 commit comments