Skip to content

Commit

Permalink
[ ci ] Only ask Stack to install Agda if it has not been installed
Browse files Browse the repository at this point in the history
  • Loading branch information
banacorn committed Nov 20, 2024
1 parent 10df67f commit 53a8f96
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,36 @@ jobs:
- name: πŸ› οΈ Add Stack install directory to PATH
run: echo $STACK_LOCAL_BIN >> $GITHUB_PATH

- name: ⏬ Install Agda
- name: πŸ” Check if Agda has been installed
id: check-agda
continue-on-error: true
run: |
stack exec ${{ matrix.agda }} -- --version
- name: πŸ” FAILED
if: ${{ failure() }}
run: |
echo "FAILED"
- name: πŸ” SUCCEED
if: ${{ success() }}
run: |
echo "SUCCEED"
- name: πŸ” Display if Agda has been installed 2
if: ${{ steps.check-agda.outcome == 'failure'}}
run: |
echo $?
echo "AGDA_INSTALLED = $AGDA_INSTALLED"
echo "AGDA_INSTALLED = $?"
echo "AGDA_INSTALLED=$?" >> "$GITHUB_ENV"
- name: βœ… Verify Agda is ready
if: ${{ success() && steps.check-agda.outcome == 'success'}}
run: echo "Agda already installed, skipping installation"

- name: ⏬ Install Agda because it has not been installed
if: ${{ failure() && steps.check-agda.outcome == 'failure'}}
run: |
stack install --resolver=lts-20.26 ${{ matrix.agda }}
which agda
Expand All @@ -91,14 +120,14 @@ jobs:
# things to be cached

- name: πŸ’Ύ Cache stack global package db
if: always() && steps.stack-global.outputs.cache-hit != 'true'
if: always() && env.AGDA_INSTALLED != '0' && steps.stack-global.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ steps.haskell-setup.outputs.stack-root }}
key: ${{ steps.stack-global.outputs.cache-primary-key }}

- name: πŸ’Ύ Cache stack-installed binaries
if: always() && steps.stack-binaries.outputs.cache-hit != 'true'
if: always() && env.AGDA_INSTALLED != '0' && steps.stack-binaries.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ env.STACK_LOCAL_BIN }}
Expand Down

0 comments on commit 53a8f96

Please sign in to comment.