From 74eccb2a4f68e3d32d814daf0b44d0452f8b53ec Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Fri, 10 Dec 2021 18:15:44 +0000 Subject: [PATCH 1/7] Build linux binaries in alpine container --- .github/workflows/build.yml | 126 +++++++++++++++++++++++++++++++++++- 1 file changed, 123 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16bc6bd9a7..3147b66afc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,14 +12,13 @@ on: - '*-check-build' jobs: - build: + build-mac-win: runs-on: ${{ matrix.os }} - strategy: fail-fast: false matrix: ghc: ['9.0.1', '8.10.7', '8.10.6', '8.8.4', '8.6.5'] - os: [ubuntu-18.04, macOS-latest, windows-latest] + os: [macOS-latest, windows-latest] cabal: ['3.6'] steps: @@ -153,6 +152,127 @@ jobs: name: haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.${{ steps.compress_wrapper_binary.outputs.extension }} path: ${{ steps.compress_wrapper_binary.outputs.path }} + build-linux: + runs-on: ubuntu-latest + container: alpine:3.12 + + strategy: + fail-fast: false + matrix: + ghc: ['9.0.1', '8.10.7', '8.10.6', '8.8.4', '8.6.5'] + cabal: ['3.6'] + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - uses: haskell/actions/setup@v1 + with: + ghc-version : ${{ matrix.ghc }} + cabal-version: ${{ matrix.cabal }} + + - name: Use modified cabal.project for ghc9 + if: ${{ matrix.ghc == '9.0.1' }} + run: cp cabal-ghc901.project cabal.project + + - name: 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: Set some linux specific things + if: matrix.os == 'ubuntu-18.04' + env: + GHC_VER: ${{ matrix.ghc }} + run: | + echo "LINUX_CABAL_ARGS=--enable-executable-static --ghc-options=-split-sections" >> $GITHUB_ENV + echo "GHC_VERSION=$GHC_VER" >> $GITHUB_ENV + + - name: Build server + # Try building it twice in case of flakey builds on Windows + run: | + cabal build exe:hls -O2 $LINUX_CABAL_ARGS || \ + cabal build exe:hls -O2 $LINUX_CABAL_ARGS -j1 + + - name: Compress server binary + id: compress_server_binary + run: | + HLS_BUILD=$(find dist-newstyle \( -name 'hls' -o -name 'hls.exe' \) -type f) + HLS=haskell-language-server-${{env.GHC_VERSION}} + mv $HLS_BUILD $HLS${{env.EXE_EXT}} + if [[ "$OSTYPE" == "msys" ]]; then + 7z a $HLS.zip $HLS${{env.EXE_EXT}} + echo ::set-output name=path::$HLS.zip + echo ::set-output name=content_type::application/zip + echo ::set-output name=extension::zip + else + gzip --best $HLS + echo ::set-output name=path::$HLS.gz + echo ::set-output name=content_type::application/gzip + echo ::set-output name=extension::gz + fi + + - name: Upload server to release + if: ${{ !contains(github.ref_name, 'check') }} + uses: actions/upload-release-asset@v1.0.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ${{ steps.compress_server_binary.outputs.path }} + asset_name: haskell-language-server-${{ runner.OS }}-${{ env.GHC_VERSION }}${{env.EXE_EXT}}.${{ steps.compress_server_binary.outputs.extension }} + asset_content_type: ${{ steps.compress_server_binary.outputs.content_type }} + + - name: Upload server to workflow artifacts + uses: actions/upload-artifact@v2 + with: + name: haskell-language-server-${{ runner.OS }}-${{ matrix.ghc }}${{env.EXE_EXT}}.${{ steps.compress_server_binary.outputs.extension }} + path: ${{ steps.compress_server_binary.outputs.path }} + + - name: Build wrapper + if: matrix.ghc == '8.10.7' + run: cabal build exe:hls-wrapper -O2 $LINUX_CABAL_ARGS + + - name: Compress wrapper binary + if: matrix.ghc == '8.10.7' + id: compress_wrapper_binary + run: | + HLS_WRAPPER_BUILD=$(find dist-newstyle \( -name 'hls-wrapper' -o -name 'hls-wrapper.exe' \) -type f) + HLS_WRAPPER=haskell-language-server-wrapper + mv $HLS_WRAPPER_BUILD $HLS_WRAPPER${{env.EXE_EXT}} + if [[ "$OSTYPE" == "msys" ]]; then + 7z a $HLS_WRAPPER.zip $HLS_WRAPPER${{env.EXE_EXT}} + echo ::set-output name=path::$HLS_WRAPPER.zip + echo ::set-output name=content_type::application/zip + echo ::set-output name=extension::zip + else + gzip --best $HLS_WRAPPER + echo ::set-output name=path::$HLS_WRAPPER.gz + echo ::set-output name=content_type::application/gzip + echo ::set-output name=extension::gz + fi + + - name: Upload wrapper to the release + if: ${{ matrix.ghc == '8.10.7' && !contains(github.ref_name, 'check') }} + uses: actions/upload-release-asset@v1.0.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ${{ steps.compress_wrapper_binary.outputs.path }} + asset_name: haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.${{ steps.compress_wrapper_binary.outputs.extension }} + asset_content_type: ${{ steps.compress_wrapper_binary.outputs.content_type}} + + - name: Upload wrapper to workflow artifacts + uses: actions/upload-artifact@v2 + if: matrix.ghc == '8.10.7' + with: + name: haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.${{ steps.compress_wrapper_binary.outputs.extension }} + path: ${{ steps.compress_wrapper_binary.outputs.path }} + # generates a custom tarball with sources, used by `ghcup compile hls` src-tar: needs: build From cf722879998ec81f709abe19dbcd712409b7d900 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Fri, 10 Dec 2021 18:38:40 +0000 Subject: [PATCH 2/7] fix submodules --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3147b66afc..c28cecafe1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -164,8 +164,6 @@ jobs: steps: - uses: actions/checkout@v2 - with: - submodules: true - uses: haskell/actions/setup@v1 with: ghc-version : ${{ matrix.ghc }} From edd8314fc26c7479f183de58bad85931b610cf88 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Fri, 10 Dec 2021 18:49:21 +0000 Subject: [PATCH 3/7] install system deps --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c28cecafe1..10ba387922 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -163,6 +163,10 @@ jobs: cabal: ['3.6'] steps: + - name: Install system dependencies + run: | + apk add --no-cache curl gcc g++ gmp-dev ncurses-dev libffi-dev make xz gzip tar perl git bash sudo binutils-gold + apk add --no-cache zlib zlib-dev zlib-static gmp gmp-dev ncurses-static - uses: actions/checkout@v2 - uses: haskell/actions/setup@v1 with: From 755535405693d73bdba7c9cca1908f9cc1285db0 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Fri, 10 Dec 2021 23:51:37 +0000 Subject: [PATCH 4/7] force integer-simple --- .github/workflows/build.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 10ba387922..5041fa050c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -172,7 +172,12 @@ jobs: with: ghc-version : ${{ matrix.ghc }} cabal-version: ${{ matrix.cabal }} - +# some alpines need workaround + - name: Force integer-simple + run: | + if ghc --info | grep -q integer-simple ; then + echo -e 'package blaze-textual\n flags: +integer-simple' >> cabal.project.local + fi - name: Use modified cabal.project for ghc9 if: ${{ matrix.ghc == '9.0.1' }} run: cp cabal-ghc901.project cabal.project From 998534f600cdf30daf5db31819f0a69d8adff398 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Sat, 11 Dec 2021 08:47:21 +0000 Subject: [PATCH 5/7] Merge build-mac-win and build-linux --- .github/workflows/build.yml | 150 +++++------------------------------- 1 file changed, 20 insertions(+), 130 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5041fa050c..88ee6446b1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,16 +12,22 @@ on: - '*-check-build' jobs: - build-mac-win: + build: runs-on: ${{ matrix.os }} + container: ${{ (matrix.os == 'ubuntu-18.04' && 'alpine:3.12') || '' }} strategy: fail-fast: false matrix: ghc: ['9.0.1', '8.10.7', '8.10.6', '8.8.4', '8.6.5'] - os: [macOS-latest, windows-latest] + os: [ubuntu-18.04, macOS-latest, windows-latest] cabal: ['3.6'] steps: + - name: Install system dependencies + if: matrix.os == 'ubuntu-18.04' + run: | + apk add --no-cache curl gcc g++ gmp-dev ncurses-dev libffi-dev make xz gzip tar perl git bash sudo binutils-gold + apk add --no-cache zlib zlib-dev zlib-static gmp gmp-dev ncurses-static - uses: actions/checkout@v2 - uses: haskell/actions/setup@v1 @@ -29,9 +35,18 @@ jobs: ghc-version : ${{ matrix.ghc }} cabal-version: ${{ matrix.cabal }} + # some alpines come with integer-simple instead of integer-gmp + - name: Force integer-simple + if: matrix.os == 'ubuntu-18.04' + run: | + if ghc --info | grep -q integer-simple ; then + echo -e 'package blaze-textual\n flags: +integer-simple' >> cabal.project.local + fi + - name: Use modified cabal.project for ghc9 if: ${{ matrix.ghc == '9.0.1' }} run: cp cabal-ghc901.project cabal.project + shell: bash - name: Shorten binary names run: | @@ -40,6 +55,7 @@ jobs: 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: Set some window specific things if: matrix.os == 'windows-latest' @@ -48,6 +64,7 @@ jobs: run: | echo "EXE_EXT=.exe" >> $GITHUB_ENV echo "GHC_VERSION=$GHC_VER" >> $GITHUB_ENV + shell: bash - name: Set some linux specific things if: matrix.os == 'ubuntu-18.04' @@ -78,134 +95,7 @@ jobs: - name: Compress server binary id: compress_server_binary - run: | - HLS_BUILD=$(find dist-newstyle \( -name 'hls' -o -name 'hls.exe' \) -type f) - HLS=haskell-language-server-${{env.GHC_VERSION}} - mv $HLS_BUILD $HLS${{env.EXE_EXT}} - if [[ "$OSTYPE" == "msys" ]]; then - 7z a $HLS.zip $HLS${{env.EXE_EXT}} - echo ::set-output name=path::$HLS.zip - echo ::set-output name=content_type::application/zip - echo ::set-output name=extension::zip - else - gzip --best $HLS - echo ::set-output name=path::$HLS.gz - echo ::set-output name=content_type::application/gzip - echo ::set-output name=extension::gz - fi - - - name: Upload server to release - if: ${{ !contains(github.ref_name, 'check') }} - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ${{ steps.compress_server_binary.outputs.path }} - asset_name: haskell-language-server-${{ runner.OS }}-${{ env.GHC_VERSION }}${{env.EXE_EXT}}.${{ steps.compress_server_binary.outputs.extension }} - asset_content_type: ${{ steps.compress_server_binary.outputs.content_type }} - - - name: Upload server to workflow artifacts - uses: actions/upload-artifact@v2 - with: - name: haskell-language-server-${{ runner.OS }}-${{ matrix.ghc }}${{env.EXE_EXT}}.${{ steps.compress_server_binary.outputs.extension }} - path: ${{ steps.compress_server_binary.outputs.path }} - - - name: Build wrapper - if: matrix.ghc == '8.10.7' - run: cabal build exe:hls-wrapper -O2 $LINUX_CABAL_ARGS - - - name: Compress wrapper binary - if: matrix.ghc == '8.10.7' - id: compress_wrapper_binary - run: | - HLS_WRAPPER_BUILD=$(find dist-newstyle \( -name 'hls-wrapper' -o -name 'hls-wrapper.exe' \) -type f) - HLS_WRAPPER=haskell-language-server-wrapper - mv $HLS_WRAPPER_BUILD $HLS_WRAPPER${{env.EXE_EXT}} - if [[ "$OSTYPE" == "msys" ]]; then - 7z a $HLS_WRAPPER.zip $HLS_WRAPPER${{env.EXE_EXT}} - echo ::set-output name=path::$HLS_WRAPPER.zip - echo ::set-output name=content_type::application/zip - echo ::set-output name=extension::zip - else - gzip --best $HLS_WRAPPER - echo ::set-output name=path::$HLS_WRAPPER.gz - echo ::set-output name=content_type::application/gzip - echo ::set-output name=extension::gz - fi - - - name: Upload wrapper to the release - if: ${{ matrix.ghc == '8.10.7' && !contains(github.ref_name, 'check') }} - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ${{ steps.compress_wrapper_binary.outputs.path }} - asset_name: haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.${{ steps.compress_wrapper_binary.outputs.extension }} - asset_content_type: ${{ steps.compress_wrapper_binary.outputs.content_type}} - - - name: Upload wrapper to workflow artifacts - uses: actions/upload-artifact@v2 - if: matrix.ghc == '8.10.7' - with: - name: haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.${{ steps.compress_wrapper_binary.outputs.extension }} - path: ${{ steps.compress_wrapper_binary.outputs.path }} - - build-linux: - runs-on: ubuntu-latest - container: alpine:3.12 - - strategy: - fail-fast: false - matrix: - ghc: ['9.0.1', '8.10.7', '8.10.6', '8.8.4', '8.6.5'] - cabal: ['3.6'] - - steps: - - name: Install system dependencies - run: | - apk add --no-cache curl gcc g++ gmp-dev ncurses-dev libffi-dev make xz gzip tar perl git bash sudo binutils-gold - apk add --no-cache zlib zlib-dev zlib-static gmp gmp-dev ncurses-static - - uses: actions/checkout@v2 - - uses: haskell/actions/setup@v1 - with: - ghc-version : ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} -# some alpines need workaround - - name: Force integer-simple - run: | - if ghc --info | grep -q integer-simple ; then - echo -e 'package blaze-textual\n flags: +integer-simple' >> cabal.project.local - fi - - name: Use modified cabal.project for ghc9 - if: ${{ matrix.ghc == '9.0.1' }} - run: cp cabal-ghc901.project cabal.project - - - name: 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: Set some linux specific things - if: matrix.os == 'ubuntu-18.04' - env: - GHC_VER: ${{ matrix.ghc }} - run: | - echo "LINUX_CABAL_ARGS=--enable-executable-static --ghc-options=-split-sections" >> $GITHUB_ENV - echo "GHC_VERSION=$GHC_VER" >> $GITHUB_ENV - - - name: Build server - # Try building it twice in case of flakey builds on Windows - run: | - cabal build exe:hls -O2 $LINUX_CABAL_ARGS || \ - cabal build exe:hls -O2 $LINUX_CABAL_ARGS -j1 - - - name: Compress server binary - id: compress_server_binary + shell: bash run: | HLS_BUILD=$(find dist-newstyle \( -name 'hls' -o -name 'hls.exe' \) -type f) HLS=haskell-language-server-${{env.GHC_VERSION}} From a064ed1cea7efd89b9c6ad34348da45e7aa835bb Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Sat, 11 Dec 2021 09:08:20 +0000 Subject: [PATCH 6/7] --disable-tests --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 88ee6446b1..c09f78cc9b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -90,8 +90,8 @@ jobs: - name: Build server # Try building it twice in case of flakey builds on Windows run: | - cabal build exe:hls -O2 $LINUX_CABAL_ARGS || \ - cabal build exe:hls -O2 $LINUX_CABAL_ARGS -j1 + cabal build --disable-tests exe:hls -O2 $LINUX_CABAL_ARGS || \ + cabal build --disable-tests exe:hls -O2 $LINUX_CABAL_ARGS -j1 - name: Compress server binary id: compress_server_binary @@ -131,7 +131,7 @@ jobs: - name: Build wrapper if: matrix.ghc == '8.10.7' - run: cabal build exe:hls-wrapper -O2 $LINUX_CABAL_ARGS + run: cabal build --disable-tests exe:hls-wrapper -O2 $LINUX_CABAL_ARGS - name: Compress wrapper binary if: matrix.ghc == '8.10.7' From ce53d3de08a2ad8ace61e29caef2469ff280e184 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Sat, 11 Dec 2021 12:21:48 +0000 Subject: [PATCH 7/7] default shell --- .github/workflows/build.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c09f78cc9b..a51eab6058 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,9 +1,5 @@ name: Builds -defaults: - run: - shell: bash - on: release: types: [created] @@ -15,6 +11,9 @@ jobs: build: runs-on: ${{ matrix.os }} container: ${{ (matrix.os == 'ubuntu-18.04' && 'alpine:3.12') || '' }} + defaults: + run: + shell: ${{ (matrix.os == 'windows-latest' && 'bash') || 'sh' }} strategy: fail-fast: false matrix: @@ -46,7 +45,6 @@ jobs: - name: Use modified cabal.project for ghc9 if: ${{ matrix.ghc == '9.0.1' }} run: cp cabal-ghc901.project cabal.project - shell: bash - name: Shorten binary names run: | @@ -55,7 +53,6 @@ jobs: 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: Set some window specific things if: matrix.os == 'windows-latest' @@ -64,7 +61,6 @@ jobs: run: | echo "EXE_EXT=.exe" >> $GITHUB_ENV echo "GHC_VERSION=$GHC_VER" >> $GITHUB_ENV - shell: bash - name: Set some linux specific things if: matrix.os == 'ubuntu-18.04' @@ -95,7 +91,6 @@ jobs: - name: Compress server binary id: compress_server_binary - shell: bash run: | HLS_BUILD=$(find dist-newstyle \( -name 'hls' -o -name 'hls.exe' \) -type f) HLS=haskell-language-server-${{env.GHC_VERSION}}