From ce57b1dc0eeb87b0cfe33cca42a5c30fc58f6620 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 4 Jan 2022 21:47:38 +0100 Subject: [PATCH 01/10] Extract out ci build setup --- .github/actions/setup-build/action.yml | 111 +++++++++++++++++++++++++ .github/workflows/bench.yml | 68 +-------------- .github/workflows/caching.yml | 96 +-------------------- .github/workflows/flags.yml | 77 +---------------- .github/workflows/hackage.yml | 57 +------------ .github/workflows/test.yml | 87 +------------------ 6 files changed, 126 insertions(+), 370 deletions(-) create mode 100644 .github/actions/setup-build/action.yml diff --git a/.github/actions/setup-build/action.yml b/.github/actions/setup-build/action.yml new file mode 100644 index 0000000000..bdaa9a0fe4 --- /dev/null +++ b/.github/actions/setup-build/action.yml @@ -0,0 +1,111 @@ +name: "Cached build" +description: "Setup the build using cache" +inputs: + ghc: + description: "Ghc version" + required: true + cabal: + description: "Cabal version" + required: false + default: "3.6" + os: + description: "Operating system: Linux, Windows or macOS" + required: true +runs: + using: "composite" + steps: + - uses: haskell/actions/setup@v1 + id: HaskEnvSetup + with: + ghc-version : ${{ inputs.ghc }} + cabal-version: ${{ inputs.cabal }} + enable-stack: false + + - if: inputs.os == 'Windows' + name: (Windows) Platform config + run: | + echo "CABAL_PKGS_DIR=C:\\cabal\\packages" >> $GITHUB_ENV + - if: ( inputs.os == 'Linux' ) || ( inputs.os == 'macOS' ) + name: (Linux,macOS) Platform config + run: | + echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV + + # Needs to be before Cache Cabal so the cache can detect changes to the modified cabal.project file + - if: inputs.ghc == '9.0.1' || inputs.ghc == '9.2.1' + name: (GHC 9.0/9.2) Use modified `cabal.project` + env: + GHCVER: ${{ inputs.ghc }} + run: | + # File has some protections preventing regular `rm`. + # (most probably sticky bit is set on $HOME) + # `&&` insures `rm -f` return is positive. + # Many platforms aslo have `alias cp='cp -i'`. + rm -f -v cabal.project && cp -v cabal-ghc${GHCVER//./}.project cabal.project + + - if: inputs.os == 'Windows' && inputs.ghc == '8.8.4' + name: (Windows,GHC 8.8) Modify `cabal.project` to workaround segfaults + run: | + echo "package floskell" >> cabal.project + echo " ghc-options: -O0" >> cabal.project + + # Shorten binary names as a workaround for filepath length limits in Windows, + # but since tests are hardcoded on this workaround - + # all platforms (in 2021-12-07) need it. + # All workflows which distinquishes cache on `cabal.project` needs this. + - name: Workaround shorten binary names + run: | + sed -i.bak -e 's/haskell-language-server/hls/g' \ + -e 's/haskell_language_server/hls/g' \ + haskell-language-server.cabal cabal.project + sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \ + src/**/*.hs exe/*.hs + + - name: Retrieving `cabal.project` Hackage timestamp + run: | + # Form: index-state: 2021-11-29T08:11:08Z + INDEX_STATE_ENTRY=$(grep index-state cabal.project) + # Form: 2021-11-29T08-11-08Z + INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-') + echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV + + # We have to restore package sources before `cabal update` + # cause it overwrites the hackage index with the cached one + - name: Hackage sources cache + uses: actions/cache@v2 + env: + cache-name: hackage-sources + with: + path: ${{ env.CABAL_PKGS_DIR }} + key: ${{ env.cache-name }}-${{ env.INDEX_STATE }} + restore-keys: ${{ env.cache-name }}- + + # To ensure we get the lastest hackage index without telying in the haskell action logic + # It has to be done before `cabal freeze` to make it aware of the new index + - run: cabal update + + - name: Form the package list ('cabal.project.freeze') + run: | + cabal v2-freeze && \ + echo "" && \ + echo 'Output:' && \ + echo "" && \ + cat 'cabal.project.freeze' && \ + echo "" || \ + echo 'WARNING: Could not produce the `freeze`.' + + - name: Compiled deps cache + id: compiled-deps + uses: actions/cache@v2 + env: + cache-name: compiled-deps + with: + path: ${{ steps.HaskEnvSetup.outputs.cabal-store }} + key: ${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }} + restore-keys: | + ${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-${{ env.INDEX_STATE }}- + ${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}- + ${{ env.cache-name }}-${{ inputs.os }}- + + # We remove the freeze file cause it could interfere the build + - name: "Remove freeze file" + run: rm -f cabal.project.freeze diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 37cb975a9b..bcce85f2ee 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -47,7 +47,6 @@ jobs: matrix: ghc: ['8.10.7'] os: [ubuntu-latest] - cabal: ['3.6'] # This code is fitted to the strategy: assumes Linux is used ... etc, # change of the strategy may require changing the bootstrapping/run code @@ -57,71 +56,10 @@ jobs: - run: git fetch origin master # check the master branch for benchmarking - - uses: haskell/actions/setup@v1 - id: HaskEnvSetup - with: - ghc-version : ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} - enable-stack: false - - - name: Linux Platform config - run: | - echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV - - # All workflows which distinquishes cache on `cabal.project` needs this. - - name: Workaround shorten binary names - run: | - sed -i.bak -e 's/haskell-language-server/hls/g' \ - -e 's/haskell_language_server/hls/g' \ - haskell-language-server.cabal cabal.project - sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \ - src/**/*.hs exe/*.hs - - - name: Retrieving `cabal.project` Hackage timestamp - run: | - # Form: index-state: 2021-11-29T08:11:08Z - INDEX_STATE_ENTRY=$(grep index-state cabal.project) - # Form: 2021-11-29T08-11-08Z - INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-') - echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV - - # We have to restore package sources before `cabal update` - # cause it overwrites the hackage index with the cached one - - name: Hackage sources cache - uses: actions/cache@v2 - env: - cache-name: hackage-sources - with: - path: ${{ env.CABAL_PKGS_DIR }} - key: ${{ env.cache-name }}-${{ env.INDEX_STATE }} - restore-keys: ${{ env.cache-name }}- - - # To ensure we get the lastest hackage index and not relying on haskell action logic - # It has to be done before `cabal freeze` to make it aware of the new index - - run: cabal update - - - name: Form the package list ('cabal.project.freeze') - run: | - cabal v2-freeze && \ - echo "" && \ - echo 'Output:' && \ - echo "" && \ - cat 'cabal.project.freeze' && \ - echo '' || \ - echo 'WARNING: Could not produce the `freeze`.' - - - name: Compiled deps cache - id: compiled-deps - uses: actions/cache@v2 - env: - cache-name: compiled-deps + - uses: .github/actions/setup-build with: - path: ${{ steps.HaskEnvSetup.outputs.cabal-store }} - key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }} - restore-keys: | - ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}- - ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}- - ${{ env.cache-name }}-${{ runner.os }}- + ghc: ${{ matrix.ghc }} + os: ${{ runner.os }} # max-backjumps is increased as a temporary solution # for dependency resolution failure diff --git a/.github/workflows/caching.yml b/.github/workflows/caching.yml index 6e9a7306c7..c072895735 100644 --- a/.github/workflows/caching.yml +++ b/.github/workflows/caching.yml @@ -86,104 +86,14 @@ jobs: , "macOS-latest" , "windows-latest" ] - cabal: ['3.6'] steps: - uses: actions/checkout@v2 - - uses: haskell/actions/setup@v1 - id: HaskEnvSetup + - uses: .github/actions/setup-build with: - ghc-version : ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} - enable-stack: false - - - if: runner.os == 'Windows' - name: (Windows) Platform config - run: | - echo "CABAL_PKGS_DIR=C:\\cabal\\packages" >> $GITHUB_ENV - - if: ( runner.os == 'Linux' ) || ( runner.os == 'macOS' ) - name: (Linux,macOS) Platform config - run: | - echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV - - # Needs to be before Cache Cabal so the cache can detect changes to the modified cabal.project file - - if: matrix.ghc == '9.0.1' - name: (GHC 9.0.1) Use modified `cabal.project` - run: | - # File has some protections preventing regular `rm`. - # (most probably sticky bit is set on $HOME) - # `&&` insures `rm -f` return is positive. - # Many platforms also have `alias cp='cp -i'`. - rm -f -v cabal.project && cp -v cabal-ghc901.project cabal.project - - if: runner.os == 'Windows' && matrix.ghc == '8.8.4' - name: (Windows,GHC 8.8) Modify `cabal.project` to workaround segfaults - run: | - echo "package floskell" >> cabal.project - echo " ghc-options: -O0" >> cabal.project - - # Shorten binary names as a workaround for filepath length limits in Windows, - # but since tests are hardcoded on this workaround - - # all platforms (in 2021-12-07) need it. - # All workflows which distinquishes cache on `cabal.project` needs this. - - name: Workaround shorten binary names - run: | - sed -i.bak -e 's/haskell-language-server/hls/g' \ - -e 's/haskell_language_server/hls/g' \ - haskell-language-server.cabal cabal.project - sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \ - src/**/*.hs exe/*.hs - - - name: Retrieving `cabal.project` Hackage timestamp - run: | - # Form: index-state: 2021-11-29T08:11:08Z - INDEX_STATE_ENTRY=$(grep index-state cabal.project) - # Form: 2021-11-29T08-11-08Z - INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-') - echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV - - # 2021-12-02: NOTE: Cabal Hackage source tree storage does not depend on OS or GHC really, - # but can depend on `base`. - # But this caching is happens only inside `master` for `master` purposes of compiling the deps - # so having a shared pool here that depends only on Hackage pin & does not depend on `base` is "good enough" - # & used such because it preserves 10% of a global cache storage pool. - # We have to restore package sources before `cabal update` - # cause it overwrites the hackage index with the cached one - - name: Hackage sources cache - uses: actions/cache@v2 - env: - cache-name: hackage-sources - with: - path: ${{ env.CABAL_PKGS_DIR }} - key: ${{ env.cache-name }}-${{ env.INDEX_STATE }} - restore-keys: ${{ env.cache-name }}- - - # To ensure we get the lastest hackage index and not relying on haskell action logic - # It has to be done before `cabal freeze` to make it aware of the new index - - run: cabal update - - - name: Form the package list ('cabal.project.freeze') - run: | - cabal v2-freeze && \ - echo "" && \ - echo 'Output:' && \ - echo "" && \ - cat 'cabal.project.freeze' && \ - echo '' || \ - echo 'WARNING: Could not produce the `freeze`.' - - - name: Compiled deps cache - id: compiled-deps - uses: actions/cache@v2 - env: - cache-name: compiled-deps - with: - path: ${{ steps.HaskEnvSetup.outputs.cabal-store }} - key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }} - restore-keys: | - ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}- - ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}- - ${{ env.cache-name }}-${{ runner.os }}- + ghc: ${{ matrix.ghc }} + os: ${{ runner.os }} - if: steps.compiled-deps.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.ghc == '8.10.7' name: Download sources for bench diff --git a/.github/workflows/flags.yml b/.github/workflows/flags.yml index ac95aeac80..4f37b7f7b8 100644 --- a/.github/workflows/flags.yml +++ b/.github/workflows/flags.yml @@ -47,85 +47,14 @@ jobs: ] os: [ "ubuntu-latest" ] - cabal: ['3.6'] steps: - uses: actions/checkout@v2 - - uses: haskell/actions/setup@v1 - id: HaskEnvSetup + - uses: .github/actions/setup-build with: - ghc-version : ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} - enable-stack: false - - - if: runner.os == 'Windows' - name: (Windows) Platform config - run: | - echo "CABAL_PKGS_DIR=C:\\cabal\\packages" >> $GITHUB_ENV - - if: ( runner.os == 'Linux' ) || ( runner.os == 'macOS' ) - name: (Linux,macOS) Platform config - run: | - echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV - - # All workflows which distinquishes cache on `cabal.project` needs this. - - name: Workaround shorten binary names - run: | - sed -i.bak -e 's/haskell-language-server/hls/g' \ - -e 's/haskell_language_server/hls/g' \ - haskell-language-server.cabal cabal.project - sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \ - src/**/*.hs exe/*.hs - - - name: Retrieving `cabal.project` Hackage timestamp - run: | - # Form: index-state: 2021-11-29T08:11:08Z - INDEX_STATE_ENTRY=$(grep index-state cabal.project) - # Form: 2021-11-29T08-11-08Z - INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-') - echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV - - # We have to restore package sources before `cabal update` - # cause it overwrites the hackage index with the cached one - - name: Hackage sources cache - uses: actions/cache@v2 - env: - cache-name: hackage-sources - with: - path: ${{ env.CABAL_PKGS_DIR }} - key: ${{ env.cache-name }}-${{ env.INDEX_STATE }} - restore-keys: ${{ env.cache-name }}- - - # To ensure we get the lastest hackage index and not relying on haskell action logic - # It has to be done before `cabal freeze` to make it aware of the new index - - run: cabal update - - - name: Form the package list ('cabal.project.freeze') - run: | - cabal v2-freeze && \ - echo "" && \ - echo 'Output:' && \ - echo "" && \ - cat 'cabal.project.freeze' && \ - echo '' || \ - echo 'WARNING: Could not produce the `freeze`.' - - - name: Compiled deps cache - id: compiled-deps - uses: actions/cache@v2 - env: - cache-name: compiled-deps - with: - path: ${{ steps.HaskEnvSetup.outputs.cabal-store }} - key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }} - restore-keys: | - ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}- - ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}- - ${{ env.cache-name }}-${{ runner.os }}- - - # Removing freeze file cause it breaks builds with alternative flags - - name: Remove freeze file - run: rm -f cabal.project.freeze + ghc: ${{ matrix.ghc }} + os: ${{ runner.os }} - name: Build `hls-graph` with flags run: cabal v2-build hls-graph --flags="pedantic embed-files stm-stats" diff --git a/.github/workflows/hackage.yml b/.github/workflows/hackage.yml index 0c16b40cfd..da0f08e0ba 100644 --- a/.github/workflows/hackage.yml +++ b/.github/workflows/hackage.yml @@ -53,61 +53,10 @@ jobs: - uses: actions/checkout@v2 - - uses: haskell/actions/setup@v1 - id: HaskEnvSetup + - uses: .github/actions/setup-build with: - ghc-version : ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} - enable-stack: false - - - name: Linux Platform config - run: | - echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV - - - name: Retrieving `cabal.project` Hackage timestamp - run: | - # Form: index-state: 2021-11-29T08:11:08Z - INDEX_STATE_ENTRY=$(grep index-state cabal.project) - # Form: 2021-11-29T08-11-08Z - INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-') - echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV - - - name: Hackage sources cache - uses: actions/cache@v2 - env: - cache-name: hackage-sources - with: - path: ${{ env.CABAL_PKGS_DIR }} - key: ${{ env.cache-name }}-${{ env.INDEX_STATE }} - restore-keys: ${{ env.cache-name }}- - - # To ensure we get the lastest hackage index and not relying on haskell action logic - # It has to be done before `cabal freeze` to make it aware of the new index - - name: "Ensure we will use hackage head" - run: cabal update - - - name: Form the package list ('cabal.project.freeze') - run: | - cabal v2-freeze && \ - echo "" && \ - echo 'Output:' && \ - echo "" && \ - cat 'cabal.project.freeze' && \ - echo '' || \ - echo 'WARNING: Could not produce the `freeze`.' - - - name: Compiled deps cache - id: compiled-deps - uses: actions/cache@v2 - env: - cache-name: compiled-deps - with: - path: ${{ steps.HaskEnvSetup.outputs.cabal-store }} - key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }} - restore-keys: | - ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}- - ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}- - ${{ env.cache-name }}-${{ runner.os }}- + ghc: ${{ matrix.ghc }} + os: ${{ runner.os }} - name: "Run cabal check" run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f83653a0be..aeae84d34c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -98,91 +98,10 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: haskell/actions/setup@v1 - id: HaskEnvSetup + - uses: .github/actions/setup-build with: - ghc-version : ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} - enable-stack: false - - - if: runner.os == 'Windows' - name: (Windows) Platform config - run: | - echo "CABAL_PKGS_DIR=C:\\cabal\\packages" >> $GITHUB_ENV - - if: ( runner.os == 'Linux' ) || ( runner.os == 'macOS' ) - name: (Linux,macOS) Platform config - run: | - echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV - - # Needs to be before Cache Cabal so the cache can detect changes to the modified cabal.project file - - if: matrix.ghc == '9.0.1' - name: (GHC 9.0) Use modified `cabal.project` - run: | - # File has some protections preventing regular `rm`. - # (most probably sticky bit is set on $HOME) - # `&&` insures `rm -f` return is positive. - # Many platforms aslo have `alias cp='cp -i'`. - rm -f -v cabal.project && cp -v cabal-ghc901.project cabal.project - - if: runner.os == 'Windows' && matrix.ghc == '8.8.4' - name: (Windows,GHC 8.8) Modify `cabal.project` to workaround segfaults - run: | - echo "package floskell" >> cabal.project - echo " ghc-options: -O0" >> cabal.project - - # All workflows which distinquishes cache on `cabal.project` needs this. - - name: Workaround shorten binary names - run: | - sed -i.bak -e 's/haskell-language-server/hls/g' \ - -e 's/haskell_language_server/hls/g' \ - haskell-language-server.cabal cabal.project - sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \ - src/**/*.hs exe/*.hs - - - name: Retrieving `cabal.project` Hackage timestamp - run: | - # Form: index-state: 2021-11-29T08:11:08Z - INDEX_STATE_ENTRY=$(grep index-state cabal.project) - # Form: 2021-11-29T08-11-08Z - INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-') - echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV - - # We have to restore package sources before `cabal update` - # cause it overwrites the hackage index with the cached one - - name: Hackage sources cache - uses: actions/cache@v2 - env: - cache-name: hackage-sources - with: - path: ${{ env.CABAL_PKGS_DIR }} - key: ${{ env.cache-name }}-${{ env.INDEX_STATE }} - restore-keys: ${{ env.cache-name }}- - - # To ensure we get the lastest hackage index and not relying on haskell action logic - # It has to be done before `cabal freeze` to make it aware of the new index - - run: cabal update - - - name: Form the package list ('cabal.project.freeze') - run: | - cabal v2-freeze && \ - echo "" && \ - echo 'Output:' && \ - echo "" && \ - cat 'cabal.project.freeze' && \ - echo '' || \ - echo 'WARNING: Could not produce the `freeze`.' - - - name: Compiled deps cache - id: compiled-deps - uses: actions/cache@v2 - env: - cache-name: compiled-deps - with: - path: ${{ steps.HaskEnvSetup.outputs.cabal-store }} - key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }} - restore-keys: | - ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}- - ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}- - ${{ env.cache-name }}-${{ runner.os }}- + ghc: ${{ matrix.ghc }} + os: ${{ runner.os }} # repeating builds to workaround segfaults in windows and ghc-8.8.4 - name: Build From 67f9b92c11cc2178073b0c7e519cf65a7f38e9df Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 4 Jan 2022 21:52:07 +0100 Subject: [PATCH 02/10] Correct action path --- .github/workflows/bench.yml | 2 +- .github/workflows/caching.yml | 2 +- .github/workflows/flags.yml | 2 +- .github/workflows/hackage.yml | 2 +- .github/workflows/test.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index bcce85f2ee..d99683fc52 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -56,7 +56,7 @@ jobs: - run: git fetch origin master # check the master branch for benchmarking - - uses: .github/actions/setup-build + - uses: ./.github/actions/setup-build with: ghc: ${{ matrix.ghc }} os: ${{ runner.os }} diff --git a/.github/workflows/caching.yml b/.github/workflows/caching.yml index c072895735..bb8dcb3583 100644 --- a/.github/workflows/caching.yml +++ b/.github/workflows/caching.yml @@ -90,7 +90,7 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: .github/actions/setup-build + - uses: ./.github/actions/setup-build with: ghc: ${{ matrix.ghc }} os: ${{ runner.os }} diff --git a/.github/workflows/flags.yml b/.github/workflows/flags.yml index 4f37b7f7b8..6f2f3d0b6d 100644 --- a/.github/workflows/flags.yml +++ b/.github/workflows/flags.yml @@ -51,7 +51,7 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: .github/actions/setup-build + - uses: ./.github/actions/setup-build with: ghc: ${{ matrix.ghc }} os: ${{ runner.os }} diff --git a/.github/workflows/hackage.yml b/.github/workflows/hackage.yml index da0f08e0ba..7093fa9a62 100644 --- a/.github/workflows/hackage.yml +++ b/.github/workflows/hackage.yml @@ -53,7 +53,7 @@ jobs: - uses: actions/checkout@v2 - - uses: .github/actions/setup-build + - uses: ./.github/actions/setup-build with: ghc: ${{ matrix.ghc }} os: ${{ runner.os }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aeae84d34c..c7a8eadcde 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -98,7 +98,7 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: .github/actions/setup-build + - uses: ./.github/actions/setup-build with: ghc: ${{ matrix.ghc }} os: ${{ runner.os }} From 2c885080990cd9ec2a229a57cc9d33bab6307787 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 4 Jan 2022 21:57:16 +0100 Subject: [PATCH 03/10] Add required shell property --- .github/actions/setup-build/action.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/actions/setup-build/action.yml b/.github/actions/setup-build/action.yml index bdaa9a0fe4..c94dc77b73 100644 --- a/.github/actions/setup-build/action.yml +++ b/.github/actions/setup-build/action.yml @@ -25,10 +25,12 @@ runs: name: (Windows) Platform config run: | echo "CABAL_PKGS_DIR=C:\\cabal\\packages" >> $GITHUB_ENV + shell: bash - if: ( inputs.os == 'Linux' ) || ( inputs.os == 'macOS' ) name: (Linux,macOS) Platform config run: | echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV + shell: bash # Needs to be before Cache Cabal so the cache can detect changes to the modified cabal.project file - if: inputs.ghc == '9.0.1' || inputs.ghc == '9.2.1' @@ -41,12 +43,14 @@ runs: # `&&` insures `rm -f` return is positive. # Many platforms aslo have `alias cp='cp -i'`. rm -f -v cabal.project && cp -v cabal-ghc${GHCVER//./}.project cabal.project + shell: bash - if: inputs.os == 'Windows' && inputs.ghc == '8.8.4' name: (Windows,GHC 8.8) Modify `cabal.project` to workaround segfaults run: | echo "package floskell" >> cabal.project echo " ghc-options: -O0" >> cabal.project + shell: bash # Shorten binary names as a workaround for filepath length limits in Windows, # but since tests are hardcoded on this workaround - @@ -59,6 +63,7 @@ runs: haskell-language-server.cabal cabal.project sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \ src/**/*.hs exe/*.hs + shell: bash - name: Retrieving `cabal.project` Hackage timestamp run: | @@ -67,6 +72,7 @@ runs: # Form: 2021-11-29T08-11-08Z INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-') echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV + shell: bash # We have to restore package sources before `cabal update` # cause it overwrites the hackage index with the cached one @@ -82,6 +88,7 @@ runs: # To ensure we get the lastest hackage index without telying in the haskell action logic # It has to be done before `cabal freeze` to make it aware of the new index - run: cabal update + shell: bash - name: Form the package list ('cabal.project.freeze') run: | @@ -92,6 +99,7 @@ runs: cat 'cabal.project.freeze' && \ echo "" || \ echo 'WARNING: Could not produce the `freeze`.' + shell: bash - name: Compiled deps cache id: compiled-deps @@ -109,3 +117,4 @@ runs: # We remove the freeze file cause it could interfere the build - name: "Remove freeze file" run: rm -f cabal.project.freeze + shell: bash From 3bbc8b7d5e546fa8ecc9e8edd954e9104c51424d Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 4 Jan 2022 22:26:10 +0100 Subject: [PATCH 04/10] Remove unused cabal version --- .github/workflows/hackage.yml | 1 - .github/workflows/test.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/hackage.yml b/.github/workflows/hackage.yml index 7093fa9a62..56e2acb724 100644 --- a/.github/workflows/hackage.yml +++ b/.github/workflows/hackage.yml @@ -38,7 +38,6 @@ jobs: "8.10.7", "8.8.4", "8.6.5"] - cabal: ['3.6'] exclude: - ghc: "9.0.1" package: "hls-brittany-plugin" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c7a8eadcde..fa597e173b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -65,7 +65,6 @@ jobs: os: [ "ubuntu-latest" , "macOS-latest" ] - cabal: ['3.6'] include: # only test supported ghc major versions - os: ubuntu-latest From 378c1cef999207c3136f1e11ea0e5da01384fc39 Mon Sep 17 00:00:00 2001 From: Javier Neira Date: Wed, 5 Jan 2022 12:58:43 +0100 Subject: [PATCH 05/10] Update .github/actions/setup-build/action.yml Co-authored-by: Michael Peyton Jones --- .github/actions/setup-build/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-build/action.yml b/.github/actions/setup-build/action.yml index c94dc77b73..385558a78f 100644 --- a/.github/actions/setup-build/action.yml +++ b/.github/actions/setup-build/action.yml @@ -75,7 +75,7 @@ runs: shell: bash # We have to restore package sources before `cabal update` - # cause it overwrites the hackage index with the cached one + # because it overwrites the hackage index with the cached one - name: Hackage sources cache uses: actions/cache@v2 env: From c0e1903d9011d661ad3606c204ecc87d4a3bcf7d Mon Sep 17 00:00:00 2001 From: Javier Neira Date: Wed, 5 Jan 2022 12:59:02 +0100 Subject: [PATCH 06/10] Update .github/actions/setup-build/action.yml Co-authored-by: Michael Peyton Jones --- .github/actions/setup-build/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-build/action.yml b/.github/actions/setup-build/action.yml index 385558a78f..833833f627 100644 --- a/.github/actions/setup-build/action.yml +++ b/.github/actions/setup-build/action.yml @@ -32,7 +32,7 @@ runs: echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV shell: bash - # Needs to be before Cache Cabal so the cache can detect changes to the modified cabal.project file + # Needs to be before the caching step so that the cache can detect changes to the modified cabal.project file - if: inputs.ghc == '9.0.1' || inputs.ghc == '9.2.1' name: (GHC 9.0/9.2) Use modified `cabal.project` env: From b422d5f7c0b12a468f30e882f5270b346278eb48 Mon Sep 17 00:00:00 2001 From: Javier Neira Date: Wed, 5 Jan 2022 13:10:15 +0100 Subject: [PATCH 07/10] Update .github/actions/setup-build/action.yml Co-authored-by: Michael Peyton Jones --- .github/actions/setup-build/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-build/action.yml b/.github/actions/setup-build/action.yml index 833833f627..de47183714 100644 --- a/.github/actions/setup-build/action.yml +++ b/.github/actions/setup-build/action.yml @@ -114,7 +114,7 @@ runs: ${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}- ${{ env.cache-name }}-${{ inputs.os }}- - # We remove the freeze file cause it could interfere the build + # We remove the freeze file because it could interfere with the build - name: "Remove freeze file" run: rm -f cabal.project.freeze shell: bash From 8cd5e7fdc6d0568d0e219caae2cb970523c370cf Mon Sep 17 00:00:00 2001 From: Javier Neira Date: Wed, 5 Jan 2022 13:17:48 +0100 Subject: [PATCH 08/10] Update .github/actions/setup-build/action.yml Co-Authored-By: @michaelpj --- .github/actions/setup-build/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-build/action.yml b/.github/actions/setup-build/action.yml index de47183714..b13f76a1f1 100644 --- a/.github/actions/setup-build/action.yml +++ b/.github/actions/setup-build/action.yml @@ -85,7 +85,7 @@ runs: key: ${{ env.cache-name }}-${{ env.INDEX_STATE }} restore-keys: ${{ env.cache-name }}- - # To ensure we get the lastest hackage index without telying in the haskell action logic + # To ensure we get the latest hackage index without relying on the haskell action logic # It has to be done before `cabal freeze` to make it aware of the new index - run: cabal update shell: bash From 186d93dec9449ad635afe07f15a170b0989fb334 Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 5 Jan 2022 13:35:53 +0100 Subject: [PATCH 09/10] Copy alt project file unconditionally --- .github/actions/setup-build/action.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-build/action.yml b/.github/actions/setup-build/action.yml index b13f76a1f1..15134ac9ea 100644 --- a/.github/actions/setup-build/action.yml +++ b/.github/actions/setup-build/action.yml @@ -32,9 +32,10 @@ runs: echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV shell: bash + # This copy an alternative cabal-ghc${GHCVER}.project (for example cabal-ghc921.project) + # as main cabal-project, for not fully supported ghc versions # Needs to be before the caching step so that the cache can detect changes to the modified cabal.project file - - if: inputs.ghc == '9.0.1' || inputs.ghc == '9.2.1' - name: (GHC 9.0/9.2) Use modified `cabal.project` + - name: Use possible modified `cabal.project` env: GHCVER: ${{ inputs.ghc }} run: | @@ -42,7 +43,10 @@ runs: # (most probably sticky bit is set on $HOME) # `&&` insures `rm -f` return is positive. # Many platforms aslo have `alias cp='cp -i'`. - rm -f -v cabal.project && cp -v cabal-ghc${GHCVER//./}.project cabal.project + ALT_PROJECT_FILE=cabal-ghc${GHCVER//./}.project + if [[ -f "$ALT_PROJECT_FILE" ]]; then + rm -f -v cabal.project && cp -v "$ALT_PROJECT_FILE" cabal.project + fi shell: bash - if: inputs.os == 'Windows' && inputs.ghc == '8.8.4' From 271911014fbf5b64b846f16cec4cfd8056dffa02 Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 5 Jan 2022 13:38:46 +0100 Subject: [PATCH 10/10] Make freeze strict --- .github/actions/setup-build/action.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/actions/setup-build/action.yml b/.github/actions/setup-build/action.yml index 15134ac9ea..5a697555cc 100644 --- a/.github/actions/setup-build/action.yml +++ b/.github/actions/setup-build/action.yml @@ -100,9 +100,7 @@ runs: echo "" && \ echo 'Output:' && \ echo "" && \ - cat 'cabal.project.freeze' && \ - echo "" || \ - echo 'WARNING: Could not produce the `freeze`.' + cat 'cabal.project.freeze' shell: bash - name: Compiled deps cache