108 lines (107 loc) · 3.63 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
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
- 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: |
# XXX 2019-01-22 Disable start script checking on Darwin
# due to a clash between binutils and clang.
[[ ${{ matrix.os }} != macos ]] &&
nix-shell --arg docTools false --pure --run \
'./tests/run-start-script.sh --use-nix'
nix-shell --arg docTools false --pure --run '
bazel build //tests:run-tests &&
./bazel-ci-bin/tests/run-tests &&
bazel coverage //tests/...
'
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
# XXX 2019-01-22 Disable start script checking on Darwin
# due to a clash between binutils and clang.
[[ ${{ matrix.os }} != macos ]] && \
./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