From c58ed6ef4fd560d1cf033ca23acd7f86a8802749 Mon Sep 17 00:00:00 2001 From: Ting-Gian LUA Date: Thu, 21 Nov 2024 13:56:30 +0800 Subject: [PATCH] [ ci ] Make Agda binary distributable hence cachable --- .github/workflows/test.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f51e0aee..75c2d4cf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,9 +41,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: | @@ -53,7 +55,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 @@ -94,6 +97,24 @@ 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 + ls "${{ env.STACK_LOCAL_BIN }}" + cp "${{ env.STACK_LOCAL_BIN }}"/agda "${dist}" + + else + cp ${{ env.STACK_LOCAL_BIN }}/agda "${dist}" + # strip "${dist}"/agda + fi + + ls "${dist}" + file "${dist}"/agda + # things to be cached - name: 💾 Cache stack global package db if: always() && env.AGDA_INSTALLED != '0' && steps.stack-global.outputs.cache-hit != 'true'