Skip to content

Commit e6303f5

Browse files
committed
Merge build-mac-win and build-linux
1 parent 338afef commit e6303f5

File tree

1 file changed

+20
-133
lines changed

1 file changed

+20
-133
lines changed

.github/workflows/build.yml

Lines changed: 20 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,22 @@ on:
88
- '*-check-build'
99

1010
jobs:
11-
build-mac-win:
12-
defaults:
13-
run:
14-
shell: bash
11+
build:
1512
runs-on: ${{ matrix.os }}
13+
container: ${{ (matrix.os == 'ubuntu-18.04' && 'alpine:3.12') || '' }}
1614
strategy:
1715
fail-fast: false
1816
matrix:
1917
ghc: ['9.0.1', '8.10.7', '8.10.6', '8.8.4', '8.6.5']
20-
os: [macOS-latest, windows-latest]
18+
os: [ubuntu-18.04, macOS-latest, windows-latest]
2119
cabal: ['3.6']
2220

2321
steps:
22+
- name: Install system dependencies
23+
if: matrix.os == 'ubuntu-18.04'
24+
run: |
25+
apk add --no-cache curl gcc g++ gmp-dev ncurses-dev libffi-dev make xz gzip tar perl git bash sudo binutils-gold
26+
apk add --no-cache zlib zlib-dev zlib-static gmp gmp-dev ncurses-static
2427
- uses: actions/checkout@v2
2528
with:
2629
submodules: true
@@ -29,9 +32,18 @@ jobs:
2932
ghc-version : ${{ matrix.ghc }}
3033
cabal-version: ${{ matrix.cabal }}
3134

35+
# some alpines come with integer-simple instead of integer-gmp
36+
- name: Force integer-simple
37+
if: matrix.os == 'ubuntu-18.04'
38+
run: |
39+
if ghc --info | grep -q integer-simple ; then
40+
echo -e 'package blaze-textual\n flags: +integer-simple' >> cabal.project.local
41+
fi
42+
3243
- name: Use modified cabal.project for ghc9
3344
if: ${{ matrix.ghc == '9.0.1' }}
3445
run: cp cabal-ghc901.project cabal.project
46+
shell: bash
3547

3648
- name: Shorten binary names
3749
run: |
@@ -40,6 +52,7 @@ jobs:
4052
haskell-language-server.cabal cabal.project
4153
sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \
4254
src/**/*.hs exe/*.hs
55+
shell: bash
4356

4457
- name: Set some window specific things
4558
if: matrix.os == 'windows-latest'
@@ -48,6 +61,7 @@ jobs:
4861
run: |
4962
echo "EXE_EXT=.exe" >> $GITHUB_ENV
5063
echo "GHC_VERSION=$GHC_VER" >> $GITHUB_ENV
64+
shell: bash
5165

5266
- name: Set some linux specific things
5367
if: matrix.os == 'ubuntu-18.04'
@@ -78,134 +92,7 @@ jobs:
7892
7993
- name: Compress server binary
8094
id: compress_server_binary
81-
run: |
82-
HLS_BUILD=$(find dist-newstyle \( -name 'hls' -o -name 'hls.exe' \) -type f)
83-
HLS=haskell-language-server-${{env.GHC_VERSION}}
84-
mv $HLS_BUILD $HLS${{env.EXE_EXT}}
85-
if [[ "$OSTYPE" == "msys" ]]; then
86-
7z a $HLS.zip $HLS${{env.EXE_EXT}}
87-
echo ::set-output name=path::$HLS.zip
88-
echo ::set-output name=content_type::application/zip
89-
echo ::set-output name=extension::zip
90-
else
91-
gzip --best $HLS
92-
echo ::set-output name=path::$HLS.gz
93-
echo ::set-output name=content_type::application/gzip
94-
echo ::set-output name=extension::gz
95-
fi
96-
97-
- name: Upload server to release
98-
if: ${{ !contains(github.ref_name, 'check') }}
99-
uses: actions/[email protected]
100-
env:
101-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102-
with:
103-
upload_url: ${{ github.event.release.upload_url }}
104-
asset_path: ${{ steps.compress_server_binary.outputs.path }}
105-
asset_name: haskell-language-server-${{ runner.OS }}-${{ env.GHC_VERSION }}${{env.EXE_EXT}}.${{ steps.compress_server_binary.outputs.extension }}
106-
asset_content_type: ${{ steps.compress_server_binary.outputs.content_type }}
107-
108-
- name: Upload server to workflow artifacts
109-
uses: actions/upload-artifact@v2
110-
with:
111-
name: haskell-language-server-${{ runner.OS }}-${{ matrix.ghc }}${{env.EXE_EXT}}.${{ steps.compress_server_binary.outputs.extension }}
112-
path: ${{ steps.compress_server_binary.outputs.path }}
113-
114-
- name: Build wrapper
115-
if: matrix.ghc == '8.10.7'
116-
run: cabal build exe:hls-wrapper -O2 $LINUX_CABAL_ARGS
117-
118-
- name: Compress wrapper binary
119-
if: matrix.ghc == '8.10.7'
120-
id: compress_wrapper_binary
121-
run: |
122-
HLS_WRAPPER_BUILD=$(find dist-newstyle \( -name 'hls-wrapper' -o -name 'hls-wrapper.exe' \) -type f)
123-
HLS_WRAPPER=haskell-language-server-wrapper
124-
mv $HLS_WRAPPER_BUILD $HLS_WRAPPER${{env.EXE_EXT}}
125-
if [[ "$OSTYPE" == "msys" ]]; then
126-
7z a $HLS_WRAPPER.zip $HLS_WRAPPER${{env.EXE_EXT}}
127-
echo ::set-output name=path::$HLS_WRAPPER.zip
128-
echo ::set-output name=content_type::application/zip
129-
echo ::set-output name=extension::zip
130-
else
131-
gzip --best $HLS_WRAPPER
132-
echo ::set-output name=path::$HLS_WRAPPER.gz
133-
echo ::set-output name=content_type::application/gzip
134-
echo ::set-output name=extension::gz
135-
fi
136-
137-
- name: Upload wrapper to the release
138-
if: ${{ matrix.ghc == '8.10.7' && !contains(github.ref_name, 'check') }}
139-
uses: actions/[email protected]
140-
env:
141-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
142-
with:
143-
upload_url: ${{ github.event.release.upload_url }}
144-
asset_path: ${{ steps.compress_wrapper_binary.outputs.path }}
145-
asset_name: haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.${{ steps.compress_wrapper_binary.outputs.extension }}
146-
asset_content_type: ${{ steps.compress_wrapper_binary.outputs.content_type}}
147-
148-
- name: Upload wrapper to workflow artifacts
149-
uses: actions/upload-artifact@v2
150-
if: matrix.ghc == '8.10.7'
151-
with:
152-
name: haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.${{ steps.compress_wrapper_binary.outputs.extension }}
153-
path: ${{ steps.compress_wrapper_binary.outputs.path }}
154-
155-
build-linux:
156-
runs-on: ubuntu-latest
157-
container: alpine:3.12
158-
159-
strategy:
160-
fail-fast: false
161-
matrix:
162-
ghc: ['9.0.1', '8.10.7', '8.10.6', '8.8.4', '8.6.5']
163-
cabal: ['3.6']
164-
165-
steps:
166-
- name: Install system dependencies
167-
run: |
168-
apk add --no-cache curl gcc g++ gmp-dev ncurses-dev libffi-dev make xz gzip tar perl git bash sudo binutils-gold
169-
apk add --no-cache zlib zlib-dev zlib-static gmp gmp-dev ncurses-static
170-
- uses: actions/checkout@v2
171-
- uses: haskell/actions/setup@v1
172-
with:
173-
ghc-version : ${{ matrix.ghc }}
174-
cabal-version: ${{ matrix.cabal }}
175-
# some alpines need workaround
176-
- name: Force integer-simple
177-
run: |
178-
if ghc --info | grep -q integer-simple ; then
179-
echo -e 'package blaze-textual\n flags: +integer-simple' >> cabal.project.local
180-
fi
181-
- name: Use modified cabal.project for ghc9
182-
if: ${{ matrix.ghc == '9.0.1' }}
183-
run: cp cabal-ghc901.project cabal.project
184-
185-
- name: Shorten binary names
186-
run: |
187-
sed -i.bak -e 's/haskell-language-server/hls/g' \
188-
-e 's/haskell_language_server/hls/g' \
189-
haskell-language-server.cabal cabal.project
190-
sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \
191-
src/**/*.hs exe/*.hs
192-
193-
- name: Set some linux specific things
194-
if: matrix.os == 'ubuntu-18.04'
195-
env:
196-
GHC_VER: ${{ matrix.ghc }}
197-
run: |
198-
echo "LINUX_CABAL_ARGS=--enable-executable-static --ghc-options=-split-sections" >> $GITHUB_ENV
199-
echo "GHC_VERSION=$GHC_VER" >> $GITHUB_ENV
200-
201-
- name: Build server
202-
# Try building it twice in case of flakey builds on Windows
203-
run: |
204-
cabal build exe:hls -O2 $LINUX_CABAL_ARGS || \
205-
cabal build exe:hls -O2 $LINUX_CABAL_ARGS -j1
206-
207-
- name: Compress server binary
208-
id: compress_server_binary
95+
shell: bash
20996
run: |
21097
HLS_BUILD=$(find dist-newstyle \( -name 'hls' -o -name 'hls.exe' \) -type f)
21198
HLS=haskell-language-server-${{env.GHC_VERSION}}

0 commit comments

Comments
 (0)