forked from tweag/rules_haskell
-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (145 loc) · 5.21 KB
/
workflow.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Continuous integration
on: [push]
env:
# Bump this number to invalidate the GH actions cache
cache-version: 0
jobs:
test-nixpkgs:
name: Build & Test - Nixpkgs
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos]
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v2
- name: Mount Bazel cache
uses: actions/cache@v2
with:
path: ~/repo-cache
key: repo-cache-${{ runner.os }}-nixpkgs-${{ env.cache-version }}
- uses: cachix/install-nix-action@v12
with:
nix_path: nixpkgs=./nixpkgs/default.nix
extra_nix_config: |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
extra-substituters = https://hydra.iohk.io
- name: Configure
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
run: |
case ${{ matrix.os }} in
macos) BUILD_CONFIG=macos-nixpkgs;;
ubuntu) BUILD_CONFIG=linux-nixpkgs;;
esac
cat >.bazelrc.local <<EOF
common --config=ci
build --config=$BUILD_CONFIG
build --remote_header=x-buildbuddy-api-key="$BUILDBUDDY_API_KEY"
EOF
cat >~/.netrc <<EOF
machine api.github.com
password ${{ secrets.GITHUB_TOKEN }}
EOF
- name: Check Bazel version
run: |
nix-shell --arg docTools false --pure --run .ci/check-bazel-version
- name: Build & test
run: |
nix-shell --arg docTools false --pure --run '
set -euo pipefail
./tests/run-start-script.sh --use-nix
bazel build //tests:run-tests
./bazel-ci-bin/tests/run-tests
bazel coverage //tests/...
bazel build //docs:api_html
bazel build //docs:guide_html
'
test-nixpkgs-cross:
name: Build & Test - Cross
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Mount Bazel cache
uses: actions/cache@v2
with:
path: ~/repo-cache
key: repo-cache-${{ runner.os }}-nixpkgs-${{ env.cache-version }}
- uses: cachix/install-nix-action@v12
with:
nix_path: nixpkgs=./nixpkgs/default.nix
extra_nix_config: |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
extra-substituters = https://hydra.iohk.io
- name: Configure
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
run: |
cat >.bazelrc.local <<EOF
common --config=ci
build --config=linux-nixpkgs
build --remote_header=x-buildbuddy-api-key="$BUILDBUDDY_API_KEY"
EOF
ln -sr .bazelrc.local examples/arm/.bazelrc.local
cat >~/.netrc <<EOF
machine api.github.com
password ${{ secrets.GITHUB_TOKEN }}
EOF
- name: Check Bazel version
run: |
nix-shell --arg docTools false --pure --run .ci/check-bazel-version
- name: Build & test
run: |
cd examples/arm
nix-shell --arg docTools false --pure --run "bazel build //... --platforms=//:linux_aarch64"
nix-shell --arg docTools false --pure qemu-shell.nix --run "qemu-aarch64 bazel-ci-bin/example"
nix-shell --arg docTools false --pure qemu-shell.nix --run "qemu-aarch64 bazel-ci-bin/example2"
test-bindist:
name: Build & Test - bindist
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v2
- name: Mount Bazel cache
uses: actions/cache@v2
with:
path: ~/repo-cache
key: repo-cache-${{ runner.os }}-bindist-${{ env.cache-version }}
- name: Install Bazel
shell: bash
run: |
BAZEL_DIR="$(.ci/fetch-bazel-bindist)"
mv $BAZEL_DIR $HOME/bazel
- name: Configure
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
shell: bash
run: |
case ${{ matrix.os }} in
macos) BUILD_CONFIG=macos-bindist;;
ubuntu) BUILD_CONFIG=linux-bindist;;
windows) BUILD_CONFIG=windows-bindist;;
esac
cat >.bazelrc.local <<EOF
common --config=ci
build --config=$BUILD_CONFIG
build --remote_header=x-buildbuddy-api-key="$BUILDBUDDY_API_KEY"
EOF
cat >~/.netrc <<EOF
machine api.github.com
password ${{ secrets.GITHUB_TOKEN }}
EOF
- name: Build & test
shell: bash
run: |
export PATH=$HOME/bazel:$PATH
[[ ${{ matrix.os }} == macos ]] && export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
./tests/run-start-script.sh --use-bindists
bazel test //tests/...
# Test stack_snapshot pinning
# NOTE keep in sync with tests/RunTests.hs
bazel run @stackage-pinning-test-unpinned//:pin
bazel build @stackage-pinning-test//:hspec