11name : Continuous integration
22on :
33 push :
4- branches : master
54 pull_request :
65 branches : master
76 workflow_dispatch : # allows manual triggering
@@ -16,245 +15,13 @@ concurrency:
1615 cancel-in-progress : ${{ github.ref != 'refs/heads/master' }}
1716
1817jobs :
19- lint :
20- name : Format & Lint
21- runs-on : ubuntu-24.04
22- steps :
23- - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
24- - uses : tweag/configure-bazel-remote-cache-auth@144b0b915f13a418f5eafe2f68d19564ec136c62 # v0.1.1
25- with :
26- buildbuddy_api_key : ${{ secrets.BUILDBUDDY_API_KEY }}
27- bazelrc_path : .bazelrc.auth
28- - uses : ./.github/actions/set_tcp_keepalive_time
29- - uses : extractions/netrc@f6f1722d05ce2890aa86fd9654565b1214ac53a4 # v2
30- with :
31- machine : api.github.com
32- password : ${{ secrets.GITHUB_TOKEN }}
33- - name : Configure
34- run : |
35- cat >>.bazelrc.local <<EOF
36- common --config=ci
37- EOF
38- - run : |
39- bazelisk test buildifier:buildifier_test
40-
41- test-nixpkgs :
42- name : Build & Test - Nixpkgs
43- strategy :
44- fail-fast : false
45- matrix :
46- os : [ubuntu-24.04, macos-13]
47- module : [rules_haskell, rules_haskell_nix, rules_haskell_tests]
48- bzlmod : [true, false]
49- ghc :
50- - 9.4.8
51- - 9.6.5
52- - 9.8.2
53- exclude :
54- - module : rules_haskell_nix
55-
56- bzlmod : false
57- # TODO: in a MODULE.bazel file we declare version specific dependencies, would need to use stack snapshot json
58- # and stack config per GHC version
59- - ghc : 9.8.2
60- bzlmod : true
61- - ghc : 9.6.5
62- bzlmod : true
63- runs-on : ${{ matrix.os }}
64- env :
65- NIX_SHELL_ARGS : --arg docTools false --argstr ghcVersion ${{ matrix.ghc }}
66- steps :
67- - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
68- - uses : ./.github/actions/free_disk_space_on_linux
69- - name : Mount Bazel cache
70- uses : actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
71- with :
72- path : ~/repo-cache
73- key : repo-cache-${{ runner.os }}-nixpkgs-${{ env.cache-version }}
74- - uses : cachix/install-nix-action@9280e7aca88deada44c930f1e2c78e21c3ae3edd # v31.7.0
75- with :
76- nix_path : nixpkgs=./nixpkgs/default.nix
77- extra_nix_config : |
78- trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
79- extra-substituters = https://cache.iog.io
80- - uses : tweag/configure-bazel-remote-cache-auth@144b0b915f13a418f5eafe2f68d19564ec136c62 # v0.1.1
81- with :
82- buildbuddy_api_key : ${{ secrets.BUILDBUDDY_API_KEY }}
83- bazelrc_path : .bazelrc.auth
84- - uses : ./.github/actions/set_tcp_keepalive_time
85- - uses : extractions/netrc@f6f1722d05ce2890aa86fd9654565b1214ac53a4 # v2
86- with :
87- machine : api.github.com
88- password : ${{ secrets.GITHUB_TOKEN }}
89- - name : Configure
90- run : |
91- case ${{ runner.os }} in
92- macOS) BUILD_CONFIG=macos-nixpkgs;;
93- Linux) BUILD_CONFIG=linux-nixpkgs;;
94- esac
95- cat >>.bazelrc.local <<EOF
96- common --config=ci
97- build --config=$BUILD_CONFIG
98- common --enable_bzlmod=${{ matrix.bzlmod }}
99- EOF
100- cp .bazelrc.local rules_haskell_nix
101- cp .bazelrc.local rules_haskell_tests
102- - name : Build & test - rules_haskell
103- if : matrix.module == 'rules_haskell'
104- uses : tweag/run-nix-shell@0d73770bd05096508387d191649e5e858a3c2654 # v0.2.1
105- with :
106- options : ${{ env.NIX_SHELL_ARGS }}
107- run : |
108- bazel test //...
109- bazel build //docs:api_html
110- bazel build //docs:guide_html
111- - name : Build & test - rules_haskell_nix
112- if : matrix.module == 'rules_haskell_nix'
113- uses : tweag/run-nix-shell@0d73770bd05096508387d191649e5e858a3c2654 # v0.2.1
114- with :
115- options : ${{ env.NIX_SHELL_ARGS }}
116- working-directory : rules_haskell_nix
117- run : bazel test //...
118- - name : Build & test - rules_haskell_tests
119- if : matrix.module == 'rules_haskell_tests'
120- uses : tweag/run-nix-shell@0d73770bd05096508387d191649e5e858a3c2654 # v0.2.1
121- with :
122- options : ${{ env.NIX_SHELL_ARGS }}
123- working-directory : rules_haskell_tests
124- run : |
125- # XXX run start script `--with-bzlmod=true` when supported
126- if ! ${{ matrix.bzlmod }}; then
127- ./tests/run-start-script.sh --use-nix --with-bzlmod=${{ matrix.bzlmod }}
128- fi
129- bazel build //tests:run-tests
130- # Shutdown Bazel to free up memory
131- # https://github.com/tweag/rules_haskell/issues/2089.
132- bazel shutdown
133- # Execute the tests dumping out memory/process information before and after each test.
134- RHT_PRINT_MEMORY=true ./bazel-ci-bin/tests/run-tests
135- bazel coverage //...
136-
137- test-bindist :
138- name : Build & Test - bindist
139- strategy :
140- fail-fast : false
141- matrix :
142- os : [ubuntu-24.04, macos-13, windows-2022]
143- module : [rules_haskell, rules_haskell_tests]
144- bzlmod : [true, false]
145- ghc :
146- - 9.4.8
147- - 9.6.5
148- - 9.8.2
149- exclude :
150- # TODO: in a MODULE.bazel file we declare version specific dependencies, would need to use stack snapshot json
151- # and stack config per GHC version
152- - ghc : 9.8.2
153- bzlmod : true
154- - ghc : 9.6.5
155- bzlmod : true
156- # currently proto-lens-protoc (read: protoc-gen-haskell) fails with an access violation on Windows
157- - ghc : 9.6.5
158- os : windows-2022
159- - ghc : 9.8.2
160- os : windows-2022
161- env :
162- GHC_VERSION : ${{ matrix.ghc }}
163- runs-on : ${{ matrix.os }}
164- steps :
165- - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
166- - uses : ./.github/actions/free_disk_space_on_linux
167- - name : Mount Bazel cache
168- uses : actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
169- with :
170- path : ~/repo-cache
171- key : repo-cache-${{ runner.os }}-bindist-${{ env.cache-version }}
172- - uses : tweag/configure-bazel-remote-cache-auth@144b0b915f13a418f5eafe2f68d19564ec136c62 # v0.1.1
173- with :
174- buildbuddy_api_key : ${{ secrets.BUILDBUDDY_API_KEY }}
175- bazelrc_path : .bazelrc.auth
176- - uses : ./.github/actions/set_tcp_keepalive_time
177- - uses : extractions/netrc@f6f1722d05ce2890aa86fd9654565b1214ac53a4 # v2
178- with :
179- machine : api.github.com
180- password : ${{ secrets.GITHUB_TOKEN }}
181- - name : Configure
182- shell : bash
183- run : |
184- case "${{ runner.os }},${{ matrix.module }}" in
185- macOS,*) BUILD_CONFIG=macos-bindist;;
186- Linux,*) BUILD_CONFIG=linux-bindist;;
187- Windows,rules_haskell) BUILD_CONFIG=ci-windows-bindist-rules-haskell;;
188- Windows,rules_haskell_tests) BUILD_CONFIG=ci-windows-bindist-rules-haskell-tests;;
189- esac
190- if [[ ${{ runner.os }} == Windows ]]; then
191- output_root_setting="startup --output_user_root=C:/_bzl"
192- # On windows, we use a separate remote cache for bzlmod,
193- # because the c dependency analysis is leaking absolute paths which are different
194- if ${{ matrix.bzlmod }}; then
195- bzlmod_cache_silo_key='build --remote_default_exec_properties=bzlmod-cache-silo-key=bzlmod'
196- else
197- bzlmod_cache_silo_key='build --remote_default_exec_properties=bzlmod-cache-silo-key=workspace'
198- fi
199- else
200- output_root_setting=""
201- bzlmod_cache_silo_key=""
202- fi
203- cat >>.bazelrc.local <<EOF
204- common --config=ci
205- build --config=$BUILD_CONFIG
206- $output_root_setting
207- $bzlmod_cache_silo_key
208- common --enable_bzlmod=${{ matrix.bzlmod }}
209- EOF
210- cp .bazelrc.local rules_haskell_tests
211- - name : Build & test - rules_haskell
212- if : matrix.module == 'rules_haskell'
213- shell : bash
214- run : |
215- # Quote the package specifier so that it works on Windows
216- bazelisk test "//..."
217-
218- - name : Build & test - rules_haskell_tests
219- if : matrix.module == 'rules_haskell_tests'
220- shell : bash
221- run : |
222- cd rules_haskell_tests
223- ./tests/run-start-script.sh --use-bindists --with-bzlmod=${{ matrix.bzlmod }}
224- # Quote the package specifier so that it works on Windows
225- bazelisk test "//..."
226- # Test stack_snapshot pinning
227- # NOTE keep in sync with tests/RunTests.hs
228- bazelisk run @stackage-pinning-test-unpinned//:pin
229- bazelisk build @stackage-pinning-test//:hspec
230-
231- - name : Collect Logs
232- id : collect_logs
233- if : failure()
234- shell : bash
235- run : |
236- mkdir -p logs
237- if [[ ${{ matrix.module }} == 'rules_haskell_tests' ]]; then
238- dir=rules_haskell_tests
239- else
240- dir=.
241- fi
242- base=$( cd "$dir" ; bazelisk info output_base )
243- find "$base" -mindepth 1 -maxdepth 1 -name "java*.log.*" -print0 | xargs -0rI % cp % logs/
244-
245- - name : Upload Logs
246- if : ${{ failure() && steps.collect_logs.conclusion == 'success' }}
247- uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
248- with :
249- name : Logs ${{ matrix.os }} ${{ matrix.module }} ${{ matrix.bzlmod }}
250- path : logs
25118
25219 examples-bindist :
25320 name : Build & Test Examples - bindist
25421 strategy :
25522 fail-fast : false
25623 matrix :
257- os : [ubuntu-24.04, macos-13, macos-14, windows-2022]
24+ os : [windows-2022]
25825 bzlmod : [true, false]
25926 bazel :
26027 - " 6.x"
31683 working-directory : examples
31784 run : |
31885 # Quote the package specifier so that it works on Windows
86+ bazelisk info output_path
31987 bazelisk build "//..."
32088
32189 - name : Test
32593 # Quote the package specifier so that it works on Windows
32694 bazelisk test "//..."
32795 - name : Setup tmate session
328- if : ${{ failure() }}
32996 uses : mxschmitt/action-tmate@v3
33097 with :
33198 limit-access-to-actor : true
0 commit comments