From b06fe4acbd1e9f8e295f4d7db0ae37339558225e 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 | 142 +++++++++++++++++++------------------ 1 file changed, 72 insertions(+), 70 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f51e0aee..9f56fbb4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,93 +32,95 @@ jobs: # actions: - - name: ⏬ Setup Haskell environment - id: haskell-setup - uses: haskell-actions/setup@v2 - with: - ghc-version: '9.2.8' - stack-version: latest - cabal-update: false - enable-stack: true + # - name: ⏬ Setup Haskell environment + # id: haskell-setup + # uses: haskell-actions/setup@v2 + # with: + # ghc-version: '9.2.8' + # stack-version: latest + # cabal-update: false + # enable-stack: true - 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: | echo "runner.os = ${{ runner.os }}" - echo "ghc-path = ${{ steps.haskell-setup.outputs.ghc-path }}" - echo "ghc-exe = ${{ steps.haskell-setup.outputs.ghc-exe }}" - 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 "ghc-path = ${{ steps.haskell-setup.outputs.ghc-path }}" + # echo "ghc-exe = ${{ steps.haskell-setup.outputs.ghc-exe }}" + # 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 "DIST = $DIST" - # cached stuff to be restored: - - name: 💾 Restore cached stack global package db - id: stack-global - uses: actions/cache/restore@v4 - with: - path: ${{ steps.haskell-setup.outputs.stack-root }} - key: ${{ runner.os }}-stack-global-${{ matrix.agda }} - restore-keys: | - ${{ runner.os }}-stack-global + # # cached stuff to be restored: + # - name: 💾 Restore cached stack global package db + # id: stack-global + # uses: actions/cache/restore@v4 + # with: + # path: ${{ steps.haskell-setup.outputs.stack-root }} + # key: ${{ runner.os }}-stack-global-${{ matrix.agda }} + # restore-keys: | + # ${{ runner.os }}-stack-global - - name: 💾 Restore stack-installed binaries in ~/.local/bin - id: stack-binaries - uses: actions/cache/restore@v4 - with: - path: ${{ env.STACK_LOCAL_BIN }} - key: ${{ runner.os }}-stack-binaries-${{ matrix.agda }} - restore-keys: | - ${{ runner.os }}-stack-binaries + # - name: 💾 Restore stack-installed binaries in ~/.local/bin + # id: stack-binaries + # uses: actions/cache/restore@v4 + # with: + # path: ${{ env.STACK_LOCAL_BIN }} + # key: ${{ runner.os }}-stack-binaries-${{ matrix.agda }} + # restore-keys: | + # ${{ runner.os }}-stack-binaries - - name: ⏬ Setup Node.js environment - uses: actions/setup-node@v4 - with: - node-version: 20.x + # - name: ⏬ Setup Node.js environment + # 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: 🛠️ Add Stack install directory to PATH + # run: echo $STACK_LOCAL_BIN >> $GITHUB_PATH - - name: 🔍 Check if Agda has been installed - id: check-agda - continue-on-error: true - run: which agda + # - name: 🔍 Check if Agda has been installed + # id: check-agda + # continue-on-error: true + # run: which agda - - name: ⏬ Install Agda - if: ${{ steps.check-agda.outcome == 'failure'}} - run: | - stack install --resolver=lts-20.26 ${{ matrix.agda }} - which agda - agda --version + # - name: ⏬ Install Agda + # if: ${{ steps.check-agda.outcome == 'failure'}} + # run: | + # stack install --resolver=lts-20.26 ${{ matrix.agda }} + # which agda + # agda --version - # things to be cached - - name: 💾 Cache stack global package db - 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 }} + # # things to be cached + # - name: 💾 Cache stack global package db + # 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() && env.AGDA_INSTALLED != '0' && steps.stack-binaries.outputs.cache-hit != 'true' - uses: actions/cache/save@v4 - with: - path: ${{ env.STACK_LOCAL_BIN }} - key: ${{ steps.stack-binaries.outputs.cache-primary-key }} + # - name: 💾 Cache stack-installed binaries + # if: always() && env.AGDA_INSTALLED != '0' && steps.stack-binaries.outputs.cache-hit != 'true' + # uses: actions/cache/save@v4 + # with: + # path: ${{ env.STACK_LOCAL_BIN }} + # key: ${{ steps.stack-binaries.outputs.cache-primary-key }} - - name: ⏬ Install NPM Dependencies - run: npm install + # - name: ⏬ Install NPM Dependencies + # run: npm install - - name: 🔨 Build stuff - run: npm run build + # - name: 🔨 Build stuff + # run: npm run build - - name: 🚗 Run tests (Linux) - if: runner.os == 'Linux' - run: xvfb-run -a npm test + # - name: 🚗 Run tests (Linux) + # if: runner.os == 'Linux' + # run: xvfb-run -a npm test - - name: 🚗 Run tests (Windows, MacOS) - if: runner.os != 'Linux' - run: npm test + # - name: 🚗 Run tests (Windows, MacOS) + # if: runner.os != 'Linux' + # run: npm test