From e6e07e8c9d233e63c585be9037180ec58091617d Mon Sep 17 00:00:00 2001 From: Artem Pelenitsyn Date: Mon, 13 Mar 2023 10:24:15 -0400 Subject: [PATCH] CI: cabal-3.10 compat: actions/cache has to go before cabal update --- .github/workflows/validate.yml | 78 +++++++++++++++++----------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 0421bb52079..e02df98ccf8 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -57,6 +57,20 @@ jobs: - uses: actions/checkout@v3 + # See the following link for a breakdown of the following step + # https://github.com/haskell/actions/issues/7#issuecomment-745697160 + # + # See https://github.com/haskell/cabal/pull/8739 for why Windows is excluded + - if: ${{ runner.os != 'Windows' }} + uses: actions/cache@v3 + with: + # validate.sh uses a special build dir + path: | + ${{ steps.setup-haskell.outputs.cabal-store }} + dist-* + key: ${{ runner.os }}-${{ matrix.ghc }}-20220419-${{ github.sha }} + restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-20220419- + # See https://github.com/haskell/cabal/pull/8739 - name: Sudo chmod to permit ghcup to update its cache run: | @@ -73,20 +87,6 @@ jobs: ghc-version: ${{ matrix.ghc }} cabal-version: latest # latest is mandatory for cabal-testsuite, see https://github.com/haskell/cabal/issues/8133 - # See the following link for a breakdown of the following step - # https://github.com/haskell/actions/issues/7#issuecomment-745697160 - # - # See https://github.com/haskell/cabal/pull/8739 for why Windows is excluded - - if: ${{ runner.os != 'Windows' }} - uses: actions/cache@v3 - with: - # validate.sh uses a special build dir - path: | - ${{ steps.setup-haskell.outputs.cabal-store }} - dist-* - key: ${{ runner.os }}-${{ matrix.ghc }}-20220419-${{ github.sha }} - restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-20220419- - - name: Work around git problem https://bugs.launchpad.net/ubuntu/+source/git/+bug/1993586 (cabal PR #8546) run: | git config --global protocol.file.allow always @@ -206,6 +206,20 @@ jobs: - uses: actions/checkout@v3 + # See the following link for a breakdown of the following step + # https://github.com/haskell/actions/issues/7#issuecomment-745697160 + # + # See https://github.com/haskell/cabal/pull/8739 for why Windows is excluded + - if: ${{ runner.os != 'Windows' }} + uses: actions/cache@v3 + with: + # validate.sh uses a special build dir + path: | + ${{ steps.setup-haskell.outputs.cabal-store }} + dist-* + key: ${{ runner.os }}-${{ matrix.ghc }}-20220419-${{ github.sha }} + restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-20220419- + # See https://github.com/haskell/cabal/pull/8739 - name: Sudo chmod to permit ghcup to update its cache run: | @@ -227,20 +241,6 @@ jobs: ghc --version cabal update - # See the following link for a breakdown of the following step - # https://github.com/haskell/actions/issues/7#issuecomment-745697160 - # - # See https://github.com/haskell/cabal/pull/8739 for why Windows is excluded - - if: ${{ runner.os != 'Windows' }} - uses: actions/cache@v3 - with: - # validate.sh uses a special build dir - path: | - ${{ steps.setup-haskell.outputs.cabal-store }} - dist-* - key: ${{ runner.os }}-${{ matrix.ghc }}-20220419-${{ github.sha }} - restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-20220419- - - name: Work around git problem https://bugs.launchpad.net/ubuntu/+source/git/+bug/1993586 (cabal PR #8546) run: | git config --global protocol.file.allow always @@ -348,17 +348,6 @@ jobs: git fetch origin $GITHUB_SHA:temporary-ci-branch git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) - - name: Install extra compiler - run: | - apt-get update - apt-get install -y ghc-${{ matrix.extra-ghc }}-dyn - - - uses: haskell/actions/setup@v2 - id: setup-haskell - with: - ghc-version: ${{ matrix.ghc }} - cabal-version: latest # latest is mandatory for cabal-testsuite, see https://github.com/haskell/cabal/issues/8133 - # As we are reusing the cached build dir from the previous step # the generated artifacts are available here, # including the cabal executable and the test suite @@ -370,6 +359,17 @@ jobs: key: ${{ runner.os }}-${{ matrix.ghc }}-20220419-${{ github.sha }} restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-20220419- + - name: Install extra compiler + run: | + apt-get update + apt-get install -y ghc-${{ matrix.extra-ghc }}-dyn + + - uses: haskell/actions/setup@v2 + id: setup-haskell + with: + ghc-version: ${{ matrix.ghc }} + cabal-version: latest # latest is mandatory for cabal-testsuite, see https://github.com/haskell/cabal/issues/8133 + - name: Install cabal-plan run: | cd $(mktemp -d)