Skip to content

Commit

Permalink
[ ci ] Target both Agda-2.6.4.3 and Agda-2.7.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
banacorn committed Dec 5, 2024
1 parent a9d8bae commit 6703ff5
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 58 deletions.
121 changes: 63 additions & 58 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,43 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, macos-13, windows-latest]
agda: ['2.7.0.1', '2.6.4.3']
fail-fast: false
steps:

- name: 📥 Checkout repository
uses: actions/checkout@v4

- name: 🏗 Install yq (Windows)
- name: 📤 Install yq (Windows)
if: runner.os == 'Windows'
uses: frenck/action-setup-yq@v1

- name: 🔍 Determine Stack resolver & GHC version
- name: 🎛️ Determine which version of Agda to target
run: |
STACK_RESOLVER=$(yq .resolver stack.yaml)
GHC_VERSION=$(echo $(yq .compiler stack.yaml) | cut -c 5-)
STACK_YAML=$(echo stack-9.2-Agda-${{ matrix.agda }}.yaml)
STACK_YAML_ARG="--stack-yaml $(echo stack-9.2-Agda-${{ matrix.agda }}.yaml)"
if [[ ${{ matrix.os }} == "ubuntu-latest" ]]; then
ARTEFACT="als-Agda-${{ matrix.agda }}-ubuntu"
fi
if [[ ${{ matrix.os }} == "macos-latest" ]]; then
ARTEFACT="als-Agda-${{ matrix.agda }}-macos-arm64"
fi
if [[ ${{ matrix.os }} == "macos-13" ]]; then
ARTEFACT="als-Agda-${{ matrix.agda }}-macos-x64"
fi
if [[ ${{ matrix.os }} == "windows-latest" ]]; then
ARTEFACT="als-Agda-${{ matrix.agda }}-windows"
fi
echo STACK_YAML_ARG="${STACK_YAML_ARG}" >> "${GITHUB_ENV}"
echo STACK_YAML="${STACK_YAML}" >> "${GITHUB_ENV}"
echo ARTE="${ARTEFACT}" >> "${GITHUB_ENV}"
- name: 🎛️ Determine Stack resolver & GHC version
run: |
STACK_RESOLVER=$(yq .resolver $STACK_YAML)
GHC_VERSION=$(echo $(yq .compiler $STACK_YAML) | cut -c 5-)
echo STACK_RESOLVER="${STACK_RESOLVER}" >> "${GITHUB_ENV}"
echo GHC_VERSION="${GHC_VERSION}" >> "${GITHUB_ENV}"
Expand All @@ -46,11 +69,20 @@ jobs:
enable-stack: true
stack-version: 'latest'

- name: 🔍 Determine Stack root
- name: 🎛️ Determine Stack root
run: |
STACK_ROOT="$(stack path --stack-root)"
STACK_ROOT="$(stack path $STACK_YAML_ARG --stack-root)"
echo STACK_ROOT="${STACK_ROOT}" >> "${GITHUB_ENV}"
- name: 🔍 Review all variables
run: |
echo "STACK_YAML = ${STACK_YAML}"
echo "STACK_YAML_ARG = ${STACK_YAML_ARG}"
echo "STACK_RESOLVER = ${STACK_RESOLVER}"
echo "ARTEFACT = ${ARTEFACT}"
echo "GHC_VERSION = ${GHC_VERSION}"
echo "STACK_ROOT = ${STACK_ROOT}"
# things to be restored:
# Include STACK_RESOLVER in cache key, otherwise caches accumulate build products for different resolvers.

Expand All @@ -73,27 +105,27 @@ jobs:
${{ matrix.os }}-stack-resolver-${{ env.STACK_RESOLVER }}-work
# actions:
- name: Set PKG_CONFIG_PATH for the ICU library (on macOS)
- name: ⚙️ Set PKG_CONFIG_PATH for the ICU library (on macOS)
if: runner.os == 'macOS'
run: |
echo PKG_CONFIG_PATH="$(brew --prefix)/opt/icu4c/lib/pkgconfig" >> "${GITHUB_ENV}"
- name: Install the icu library (on Windows)
- name: 📥 Install the icu library (on Windows)
if: runner.os == 'Windows'
run: |
stack exec -- pacman -S --noconfirm mingw-w64-x86_64-icu mingw-w64-x86_64-pkgconf
stack exec $STACK_YAML_ARG -- pacman -S --noconfirm mingw-w64-x86_64-icu mingw-w64-x86_64-pkgconf
- name: 📸 Build Snapshot
run: stack build --no-terminal --only-snapshot -j1
run: stack build $STACK_YAML_ARG --no-terminal --only-snapshot -j1

- name: 🧰 Build Dependencies
run: stack build --no-terminal --only-dependencies
- name: 🏗️ Build Dependencies
run: stack build $STACK_YAML_ARG --no-terminal --only-dependencies

- name: 🧰 Build ALS
run: stack build
- name: 🏗️ Build ALS
run: stack build $STACK_YAML_ARG

- name: 🧰 Build Testings
run: stack build --test --no-terminal --only-dependencies
- name: 🏗️ Build Testings
run: stack build $STACK_YAML_ARG --test --no-terminal --only-dependencies

# things to be cached

Expand Down Expand Up @@ -128,7 +160,7 @@ jobs:
echo "dylib_dir: $dylib_dir"
# find the path of "als"
executable=$(find "$(stack path --local-install-root)"/bin -name "als")
executable=$(find "$(stack path $STACK_YAML_ARG --local-install-root)"/bin -name "als")
echo "executable: $executable"
# remove the old dylib, and make a new one
Expand Down Expand Up @@ -207,11 +239,11 @@ jobs:
id: zip
run: |
# locate the data-dir
datadir=$(find "$(stack path --snapshot-install-root)/share" -type d -name "Agda-*")
datadir=$(find "$(stack path $STACK_YAML_ARG --snapshot-install-root)/share" -type d -name "Agda-*")
echo "datadir: $datadir"
# locate the executable
executable=$(find "$(stack path --local-install-root)/bin" -name "als")
executable=$(find "$(stack path $STACK_YAML_ARG --local-install-root)/bin" -name "als")
echo "executable: $executable"
# make a temporary directory for compresssing
Expand All @@ -223,35 +255,22 @@ jobs:
cp "$executable" zip/
# compress
if [[ ${{ runner.os }} == "Linux" ]]; then
cd zip
zip -r als-ubuntu.zip ./*
cd ..
mv zip/als-ubuntu.zip .
fi
if [[ ${{ matrix.os }} == "macos-latest" ]]; then
cd zip
zip -r als-macos-arm64.zip ./*
cd ..
mv zip/als-macos-arm64.zip .
fi
if [[ ${{ matrix.os }} == "macos-13" ]]; then
cd zip
zip -r als-macos-x64.zip ./*
cd ..
mv zip/als-macos-x64.zip .
fi
cd zip
zip -r $ARTEFACT.zip ./*
cd ..
mv zip/$ARTEFACT.zip .
- name: 📦 Bundle executable, DLLs and data files (on Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
# locate the data-dir
$snapshot = (stack path --snapshot-install-root)
$snapshot = (stack path $STACK_YAML_ARG --snapshot-install-root)
$datadir = (ls $snapshot\share *Agda-* -Recurse -Directory).FullName
# locate the executable
$local = (stack path --local-install-root)
$local = (stack path $STACK_YAML_ARG --local-install-root)
$executable = (ls $local\bin *als.exe* -Recurse -File).FullName
# make a temporary directory for compresssing
Expand All @@ -260,7 +279,7 @@ jobs:
cp $executable zip/
# include text-icu DLLs
$mingw64bin = (stack path --extra-library-dirs).split(", ") -match "\\bin"
$mingw64bin = (stack path $STACK_YAML_ARG --extra-library-dirs).split(", ") -match "\\bin"
ls $mingw64bin
cp (ls $mingw64bin *libicudt*) zip/
cp (ls $mingw64bin *libicuin*) zip/
Expand All @@ -269,31 +288,17 @@ jobs:
# compress
cd zip
Compress-Archive * als-windows.zip
Compress-Archive * $ARTEFACT.zip
cd ..
mv zip/als-windows.zip .
mv zip/$ARTEFACT.zip .

- name: 🧪 Run tests
run: stack test --ta --als-path=zip/als
run: stack test $STACK_YAML_ARG --ta --als-path=zip/als

# release (optional)
- name: 🚢 Release Artifacts
if: startsWith(github.ref, 'refs/tags/v') # so that only commits with a git tag would upload artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ ${{ matrix.os }} == "ubuntu-latest" ]]; then
gh release upload ${{ github.ref_name }} als-ubuntu.zip --clobber
fi
# arm64 macos
if [[ ${{ matrix.os }} == "macos-latest" ]]; then
gh release upload ${{ github.ref_name }} als-macos-arm64.zip --clobber
fi
# x64 macos
if [[ ${{ matrix.os }} == "macos-13" ]]; then
gh release upload ${{ github.ref_name }} als-macos-x64.zip --clobber
fi
if [[ ${{ matrix.os }} == "windows-latest" ]]; then
gh release upload ${{ github.ref_name }} als-windows.zip --clobber
fi
run: gh release upload ${{ github.ref_name }} $ARTEFACT.zip --clobber
20 changes: 20 additions & 0 deletions stack-9.2-Agda-2.7.0.1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
resolver: lts-20.26
compiler: ghc-9.2.8
# Allow a newer minor version of GHC than the snapshot specifies
compiler-check: newer-minor

packages:
- .

extra-deps:
- Agda-2.7.0.1
- lsp-2.7.0.0@sha256:2a64b40a69fd9638056ca552d5660203019473061cff1d09dccc0c94e40a275c,3834
- lsp-types-2.3.0.0@sha256:ca17a686bda5dc7ff04105ca7081dce5a90bcd050c8800a13efd68b7f0901f1c,34215
- lsp-test-0.17.1.0@sha256:f54757a564b46783cf67b13f4cb4ebc45e43f5afc3604d9757ee387c091b73e9,4406
- mod-0.2.0.1@sha256:eeb316fef3a8c12f4e83bbeeea748e74d75fca54d4498d574ace92e464adb05a,2409
- row-types-1.0.1.2@sha256:4d4c7cb95d06a32b28ba977852d52a26b4c1f695ef083a6fd874ab6d79933b64,3071

flags:
Agda:
# optimise-heavily: true
enable-cluster-counting: true

0 comments on commit 6703ff5

Please sign in to comment.