Skip to content

Commit

Permalink
[ ci ] Make Agda binary distributable hence cachable
Browse files Browse the repository at this point in the history
  • Loading branch information
banacorn committed Nov 21, 2024
1 parent 0e2c17a commit f115fe5
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
agda: ["Agda-2.6.4", "Agda-2.7.0"]
agda: ["Agda-2.7.0"]
# agda: ["Agda-2.6.4", "Agda-2.7.0"]
fail-fast: false

# Steps represent a sequence of tasks that will be executed as part of the job
Expand All @@ -41,9 +42,11 @@ jobs:
cabal-update: false
enable-stack: true

# $DIST is where the binary & its dependencies is placed
- name: ๐Ÿ› ๏ธ Setting variables
run: |
echo "STACK_LOCAL_BIN=$(stack path --local-bin)" >> "$GITHUB_ENV"
echo "DIST=${{ matrix.agda }}-${{ matrix.os }}" >> "$GITHUB_ENV"
- name: ๐Ÿ” Reviewing variables
run: |
Expand All @@ -53,7 +56,8 @@ jobs:
echo "stack-path = ${{ steps.haskell-setup.outputs.stack-path }}"
echo "stack-exe = ${{ steps.haskell-setup.outputs.stack-exe }}"
echo "stack-root = ${{ steps.haskell-setup.outputs.stack-root }}"
echo "STACK_LOCAL_BIN = $STACK_LOCAL_BIN"
echo "STACK_LOCAL_BIN = $STACK_LOCAL_BIN"
echo "DIST = $DIST"
# cached stuff to be restored:
- name: ๐Ÿ’พ Restore cached stack global package db
Expand All @@ -78,9 +82,6 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: ๐Ÿ› ๏ธ Add Stack install directory to PATH
run: echo $STACK_LOCAL_BIN >> $GITHUB_PATH

- name: ๐Ÿ” Check if Agda has been installed
id: check-agda
Expand All @@ -94,6 +95,30 @@ jobs:
which agda
agda --version
- name: ๐Ÿ“ฆ Move artefacts to ${{ env.DIST }}
continue-on-error: true
run: |
dist=${{ env.DIST }}
mkdir -p "${dist}"
if [[ ${{ runner.os }} == "Windows" ]]; then
cp ${{ env.STACK_LOCAL_BIN }}/agda "${dist}"
else
cp ${{ env.STACK_LOCAL_BIN }}/agda "${dist}"
fi
ls "${dist}"
strip "${dist}"/agda
file "${dist}"/agda
- name: ๐Ÿ› ๏ธ Add ${{ env.DIST }} to PATH
run: echo ${{ env.DIST }} >> $GITHUB_PATH

- name: ๐Ÿ” Check if Agda has been installed again
continue-on-error: true
run: which agda

# things to be cached
- name: ๐Ÿ’พ Cache stack global package db
if: always() && env.AGDA_INSTALLED != '0' && steps.stack-global.outputs.cache-hit != 'true'
Expand Down

0 comments on commit f115fe5

Please sign in to comment.