From 0bb71d10fa763b2f8f3382885d635ad1cfa09752 Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Wed, 8 Feb 2023 00:34:22 +0100 Subject: [PATCH 01/12] Try to fix ghcup cache in CI via sudo chmod --- .github/workflows/validate.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 9c9ac2f4a3e..8019581f078 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -57,6 +57,11 @@ jobs: - uses: actions/checkout@v3 + - name: Sudo chmod to permit ghcup to update its cache + run: | + sudo mkdir -p /usr/local/.ghcup/cache + sudo chmod -R g+wr /usr/local/.ghcup/cache + - uses: haskell/actions/setup@v2 id: setup-haskell with: From b3a843a861cbddbe8ae9d44b20250d806f331cd3 Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Wed, 8 Feb 2023 10:39:15 +0100 Subject: [PATCH 02/12] Revert "Try to fix ghcup cache in CI via sudo chmod" This reverts commit 0bb71d10fa763b2f8f3382885d635ad1cfa09752. --- .github/workflows/validate.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 8019581f078..9c9ac2f4a3e 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -57,11 +57,6 @@ jobs: - uses: actions/checkout@v3 - - name: Sudo chmod to permit ghcup to update its cache - run: | - sudo mkdir -p /usr/local/.ghcup/cache - sudo chmod -R g+wr /usr/local/.ghcup/cache - - uses: haskell/actions/setup@v2 id: setup-haskell with: From b3f378222886ddd754ccccc2a79fa500b78f4998 Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Wed, 8 Feb 2023 10:52:05 +0100 Subject: [PATCH 03/12] Try not caching store in validate jobs to avoid double package bugs --- .github/workflows/validate.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 9c9ac2f4a3e..40bfc0c1162 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -65,14 +65,14 @@ jobs: # See the following link for a breakdown of the following step # https://github.com/haskell/actions/issues/7#issuecomment-745697160 - - uses: actions/cache@v2 - 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- + #- uses: actions/cache@v2 + # 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: | From 696b8dd9202e01d3b541e6983f9b52d6ce05a851 Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Wed, 8 Feb 2023 10:59:00 +0100 Subject: [PATCH 04/12] Revert "Try not caching store in validate jobs to avoid double package bugs" This reverts commit b3f378222886ddd754ccccc2a79fa500b78f4998. --- .github/workflows/validate.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 40bfc0c1162..9c9ac2f4a3e 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -65,14 +65,14 @@ jobs: # See the following link for a breakdown of the following step # https://github.com/haskell/actions/issues/7#issuecomment-745697160 - #- uses: actions/cache@v2 - # 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- + - uses: actions/cache@v2 + 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: | From 432fc2f3093ab12206a35ba8133036b73efd7f33 Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Wed, 8 Feb 2023 11:02:21 +0100 Subject: [PATCH 05/12] Try not to cache store on Windows in validate jobs to avoid double directory package bugs. --- .github/workflows/validate.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 9c9ac2f4a3e..d952d1b3aff 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -65,7 +65,8 @@ jobs: # See the following link for a breakdown of the following step # https://github.com/haskell/actions/issues/7#issuecomment-745697160 - - uses: actions/cache@v2 + - if: ${{ runner.os != 'Windows' }} + uses: actions/cache@v2 with: # validate.sh uses a special build dir path: | From a198c2b65720897a937b3da0dd224bb4201d308f Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Wed, 8 Feb 2023 11:09:05 +0100 Subject: [PATCH 06/12] Revert "Revert "Try to fix ghcup cache in CI via sudo chmod"" This reverts commit b3a843a861cbddbe8ae9d44b20250d806f331cd3. --- .github/workflows/validate.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index d952d1b3aff..72e471dbd6a 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -57,6 +57,11 @@ jobs: - uses: actions/checkout@v3 + - name: Sudo chmod to permit ghcup to update its cache + run: | + sudo mkdir -p /usr/local/.ghcup/cache + sudo chmod -R g+wr /usr/local/.ghcup/cache + - uses: haskell/actions/setup@v2 id: setup-haskell with: From 25ccfe56e230e93eca751311b74581859c9a93e5 Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Wed, 8 Feb 2023 11:11:37 +0100 Subject: [PATCH 07/12] Try sudo only on (new) Linux, where it should be available --- .github/workflows/validate.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 72e471dbd6a..bc0714920de 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -59,9 +59,10 @@ jobs: - name: Sudo chmod to permit ghcup to update its cache run: | - sudo mkdir -p /usr/local/.ghcup/cache - sudo chmod -R g+wr /usr/local/.ghcup/cache - + if [[ "${{ runner.os }}" == "Linux" ]]; then + sudo mkdir -p /usr/local/.ghcup/cache + sudo chmod -R 777 /usr/local/.ghcup/cache + fi - uses: haskell/actions/setup@v2 id: setup-haskell with: From 31e00394090c6b6c9f09d4dfa0f767fccd9c0989 Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Wed, 8 Feb 2023 11:30:39 +0100 Subject: [PATCH 08/12] Also change the user --- .github/workflows/validate.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index bc0714920de..76d0dd6b7e9 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -61,7 +61,8 @@ jobs: run: | if [[ "${{ runner.os }}" == "Linux" ]]; then sudo mkdir -p /usr/local/.ghcup/cache - sudo chmod -R 777 /usr/local/.ghcup/cache + sudo chown -R $USER /usr/local/.ghcup + sudo chmod -R 777 /usr/local/.ghcup fi - uses: haskell/actions/setup@v2 id: setup-haskell From f799af83b59aeddf995ec4b94f4e9d9b60a50e49 Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Wed, 8 Feb 2023 11:58:44 +0100 Subject: [PATCH 09/12] Document the particular hack snippets in validate.yml --- .github/workflows/validate.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 76d0dd6b7e9..06e13241197 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -57,6 +57,7 @@ jobs: - uses: actions/checkout@v3 + # See https://github.com/haskell/cabal/pull/8739 - name: Sudo chmod to permit ghcup to update its cache run: | if [[ "${{ runner.os }}" == "Linux" ]]; then @@ -72,6 +73,8 @@ jobs: # 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@v2 with: From 07853911c2b3137c660bb0c728f54f707cb8e9f4 Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Wed, 8 Feb 2023 12:50:16 +0100 Subject: [PATCH 10/12] Add an extra diagnostic ls for ghcup dirs --- .github/workflows/validate.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 06e13241197..658101b5aec 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -61,7 +61,9 @@ jobs: - name: Sudo chmod to permit ghcup to update its cache run: | if [[ "${{ runner.os }}" == "Linux" ]]; then + sudo ls -lah /usr/local/.ghcup/cache sudo mkdir -p /usr/local/.ghcup/cache + sudo ls -lah /usr/local/.ghcup/cache sudo chown -R $USER /usr/local/.ghcup sudo chmod -R 777 /usr/local/.ghcup fi From b336b7c16a94220ccbdb3c3e14e95c66b18528a7 Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Wed, 8 Feb 2023 12:56:52 +0100 Subject: [PATCH 11/12] Also hack the other affected CI scripts --- .github/workflows/bootstrap.yml | 10 ++++++++++ .github/workflows/quick-jobs.yml | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/.github/workflows/bootstrap.yml b/.github/workflows/bootstrap.yml index 885b1916bc8..b7ee746c35e 100644 --- a/.github/workflows/bootstrap.yml +++ b/.github/workflows/bootstrap.yml @@ -35,6 +35,16 @@ jobs: restore-keys: bootstrap-${{ runner.os }}-${{ matrix.ghc }}-20221115- - uses: actions/checkout@v3 + # See https://github.com/haskell/cabal/pull/8739 + - name: Sudo chmod to permit ghcup to update its cache + run: | + if [[ "${{ runner.os }}" == "Linux" ]]; then + sudo ls -lah /usr/local/.ghcup/cache + sudo mkdir -p /usr/local/.ghcup/cache + sudo ls -lah /usr/local/.ghcup/cache + sudo chown -R $USER /usr/local/.ghcup + sudo chmod -R 777 /usr/local/.ghcup + fi - name: bootstrap.py run: | GHC_VERSION=${{ matrix.ghc }} diff --git a/.github/workflows/quick-jobs.yml b/.github/workflows/quick-jobs.yml index 7d39d431cb9..4bcc6ece2bd 100644 --- a/.github/workflows/quick-jobs.yml +++ b/.github/workflows/quick-jobs.yml @@ -28,6 +28,16 @@ jobs: with: path: ~/.cabal/store key: linux-store-meta + # See https://github.com/haskell/cabal/pull/8739 + - name: Sudo chmod to permit ghcup to update its cache + run: | + if [[ "${{ runner.os }}" == "Linux" ]]; then + sudo ls -lah /usr/local/.ghcup/cache + sudo mkdir -p /usr/local/.ghcup/cache + sudo ls -lah /usr/local/.ghcup/cache + sudo chown -R $USER /usr/local/.ghcup + sudo chmod -R 777 /usr/local/.ghcup + fi - name: ghcup run: | ghcup config set cache true @@ -66,6 +76,16 @@ jobs: with: path: ~/.cabal/store key: linux-store-doctest + # See https://github.com/haskell/cabal/pull/8739 + - name: Sudo chmod to permit ghcup to update its cache + run: | + if [[ "${{ runner.os }}" == "Linux" ]]; then + sudo ls -lah /usr/local/.ghcup/cache + sudo mkdir -p /usr/local/.ghcup/cache + sudo ls -lah /usr/local/.ghcup/cache + sudo chown -R $USER /usr/local/.ghcup + sudo chmod -R 777 /usr/local/.ghcup + fi - name: ghcup run: | ghcup config set cache true From bdbdc7947c7a47f69d1a39c2bfca29dfad8dd8cf Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Wed, 8 Feb 2023 13:06:12 +0100 Subject: [PATCH 12/12] Also print the version of ghcup used for debugging --- .github/workflows/bootstrap.yml | 1 + .github/workflows/quick-jobs.yml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.github/workflows/bootstrap.yml b/.github/workflows/bootstrap.yml index b7ee746c35e..b404cacfb08 100644 --- a/.github/workflows/bootstrap.yml +++ b/.github/workflows/bootstrap.yml @@ -48,6 +48,7 @@ jobs: - name: bootstrap.py run: | GHC_VERSION=${{ matrix.ghc }} + ghcup --version ghcup config set cache true ghcup install ghc $GHC_VERSION diff --git a/.github/workflows/quick-jobs.yml b/.github/workflows/quick-jobs.yml index 4bcc6ece2bd..466ec4d57dc 100644 --- a/.github/workflows/quick-jobs.yml +++ b/.github/workflows/quick-jobs.yml @@ -40,6 +40,7 @@ jobs: fi - name: ghcup run: | + ghcup --version ghcup config set cache true ghcup install ghc recommended ghcup set ghc recommended @@ -88,6 +89,7 @@ jobs: fi - name: ghcup run: | + ghcup --version ghcup config set cache true ghcup install ghc recommended ghcup set ghc recommended