|
12 | 12 | - '*-check-build'
|
13 | 13 |
|
14 | 14 | jobs:
|
15 |
| - build: |
| 15 | + build-mac-win: |
16 | 16 | runs-on: ${{ matrix.os }}
|
17 |
| - |
18 | 17 | strategy:
|
19 | 18 | fail-fast: false
|
20 | 19 | matrix:
|
21 | 20 | ghc: ['9.0.1', '8.10.7', '8.10.6', '8.8.4', '8.6.5']
|
22 |
| - os: [ubuntu-18.04, macOS-latest, windows-latest] |
| 21 | + os: [macOS-latest, windows-latest] |
23 | 22 | cabal: ['3.6']
|
24 | 23 |
|
25 | 24 | steps:
|
@@ -154,6 +153,127 @@ jobs:
|
154 | 153 | name: haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.${{ steps.compress_wrapper_binary.outputs.extension }}
|
155 | 154 | path: ${{ steps.compress_wrapper_binary.outputs.path }}
|
156 | 155 |
|
| 156 | + build-linux: |
| 157 | + runs-on: ubuntu-latest |
| 158 | + container: alpine:3.12 |
| 159 | + |
| 160 | + strategy: |
| 161 | + fail-fast: false |
| 162 | + matrix: |
| 163 | + ghc: ['9.0.1', '8.10.7', '8.10.6', '8.8.4', '8.6.5'] |
| 164 | + cabal: ['3.6'] |
| 165 | + |
| 166 | + steps: |
| 167 | + - uses: actions/checkout@v2 |
| 168 | + with: |
| 169 | + submodules: true |
| 170 | + - uses: haskell/actions/setup@v1 |
| 171 | + with: |
| 172 | + ghc-version : ${{ matrix.ghc }} |
| 173 | + cabal-version: ${{ matrix.cabal }} |
| 174 | + |
| 175 | + - name: Use modified cabal.project for ghc9 |
| 176 | + if: ${{ matrix.ghc == '9.0.1' }} |
| 177 | + run: cp cabal-ghc901.project cabal.project |
| 178 | + |
| 179 | + - name: Shorten binary names |
| 180 | + run: | |
| 181 | + sed -i.bak -e 's/haskell-language-server/hls/g' \ |
| 182 | + -e 's/haskell_language_server/hls/g' \ |
| 183 | + haskell-language-server.cabal cabal.project |
| 184 | + sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \ |
| 185 | + src/**/*.hs exe/*.hs |
| 186 | +
|
| 187 | + - name: Set some linux specific things |
| 188 | + if: matrix.os == 'ubuntu-18.04' |
| 189 | + env: |
| 190 | + GHC_VER: ${{ matrix.ghc }} |
| 191 | + run: | |
| 192 | + echo "LINUX_CABAL_ARGS=--enable-executable-static --ghc-options=-split-sections" >> $GITHUB_ENV |
| 193 | + echo "GHC_VERSION=$GHC_VER" >> $GITHUB_ENV |
| 194 | +
|
| 195 | + - name: Build server |
| 196 | + # Try building it twice in case of flakey builds on Windows |
| 197 | + run: | |
| 198 | + cabal build exe:hls -O2 $LINUX_CABAL_ARGS || \ |
| 199 | + cabal build exe:hls -O2 $LINUX_CABAL_ARGS -j1 |
| 200 | +
|
| 201 | + - name: Compress server binary |
| 202 | + id: compress_server_binary |
| 203 | + run: | |
| 204 | + HLS_BUILD=$(find dist-newstyle \( -name 'hls' -o -name 'hls.exe' \) -type f) |
| 205 | + HLS=haskell-language-server-${{env.GHC_VERSION}} |
| 206 | + mv $HLS_BUILD $HLS${{env.EXE_EXT}} |
| 207 | + if [[ "$OSTYPE" == "msys" ]]; then |
| 208 | + 7z a $HLS.zip $HLS${{env.EXE_EXT}} |
| 209 | + echo ::set-output name=path::$HLS.zip |
| 210 | + echo ::set-output name=content_type::application/zip |
| 211 | + echo ::set-output name=extension::zip |
| 212 | + else |
| 213 | + gzip --best $HLS |
| 214 | + echo ::set-output name=path::$HLS.gz |
| 215 | + echo ::set-output name=content_type::application/gzip |
| 216 | + echo ::set-output name=extension::gz |
| 217 | + fi |
| 218 | +
|
| 219 | + - name: Upload server to release |
| 220 | + if: ${{ !contains(github.ref_name, 'check') }} |
| 221 | + uses: actions/upload-release-asset@v1.0.2 |
| 222 | + env: |
| 223 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 224 | + with: |
| 225 | + upload_url: ${{ github.event.release.upload_url }} |
| 226 | + asset_path: ${{ steps.compress_server_binary.outputs.path }} |
| 227 | + asset_name: haskell-language-server-${{ runner.OS }}-${{ env.GHC_VERSION }}${{env.EXE_EXT}}.${{ steps.compress_server_binary.outputs.extension }} |
| 228 | + asset_content_type: ${{ steps.compress_server_binary.outputs.content_type }} |
| 229 | + |
| 230 | + - name: Upload server to workflow artifacts |
| 231 | + uses: actions/upload-artifact@v2 |
| 232 | + with: |
| 233 | + name: haskell-language-server-${{ runner.OS }}-${{ matrix.ghc }}${{env.EXE_EXT}}.${{ steps.compress_server_binary.outputs.extension }} |
| 234 | + path: ${{ steps.compress_server_binary.outputs.path }} |
| 235 | + |
| 236 | + - name: Build wrapper |
| 237 | + if: matrix.ghc == '8.10.7' |
| 238 | + run: cabal build exe:hls-wrapper -O2 $LINUX_CABAL_ARGS |
| 239 | + |
| 240 | + - name: Compress wrapper binary |
| 241 | + if: matrix.ghc == '8.10.7' |
| 242 | + id: compress_wrapper_binary |
| 243 | + run: | |
| 244 | + HLS_WRAPPER_BUILD=$(find dist-newstyle \( -name 'hls-wrapper' -o -name 'hls-wrapper.exe' \) -type f) |
| 245 | + HLS_WRAPPER=haskell-language-server-wrapper |
| 246 | + mv $HLS_WRAPPER_BUILD $HLS_WRAPPER${{env.EXE_EXT}} |
| 247 | + if [[ "$OSTYPE" == "msys" ]]; then |
| 248 | + 7z a $HLS_WRAPPER.zip $HLS_WRAPPER${{env.EXE_EXT}} |
| 249 | + echo ::set-output name=path::$HLS_WRAPPER.zip |
| 250 | + echo ::set-output name=content_type::application/zip |
| 251 | + echo ::set-output name=extension::zip |
| 252 | + else |
| 253 | + gzip --best $HLS_WRAPPER |
| 254 | + echo ::set-output name=path::$HLS_WRAPPER.gz |
| 255 | + echo ::set-output name=content_type::application/gzip |
| 256 | + echo ::set-output name=extension::gz |
| 257 | + fi |
| 258 | +
|
| 259 | + - name: Upload wrapper to the release |
| 260 | + if: ${{ matrix.ghc == '8.10.7' && !contains(github.ref_name, 'check') }} |
| 261 | + uses: actions/upload-release-asset@v1.0.2 |
| 262 | + env: |
| 263 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 264 | + with: |
| 265 | + upload_url: ${{ github.event.release.upload_url }} |
| 266 | + asset_path: ${{ steps.compress_wrapper_binary.outputs.path }} |
| 267 | + asset_name: haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.${{ steps.compress_wrapper_binary.outputs.extension }} |
| 268 | + asset_content_type: ${{ steps.compress_wrapper_binary.outputs.content_type}} |
| 269 | + |
| 270 | + - name: Upload wrapper to workflow artifacts |
| 271 | + uses: actions/upload-artifact@v2 |
| 272 | + if: matrix.ghc == '8.10.7' |
| 273 | + with: |
| 274 | + name: haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.${{ steps.compress_wrapper_binary.outputs.extension }} |
| 275 | + path: ${{ steps.compress_wrapper_binary.outputs.path }} |
| 276 | + |
157 | 277 | # generates a custom tarball with sources, used by `ghcup compile hls`
|
158 | 278 | src-tar:
|
159 | 279 | needs: build
|
|
0 commit comments