-
Notifications
You must be signed in to change notification settings - Fork 43
83 lines (81 loc) · 2.59 KB
/
ci.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
name: CI
on:
push:
branches:
- main
- feature/*
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
bazel-version:
- 6.0.0
- 5.3.1
env:
USE_BAZEL_VERSION: ${{ matrix.bazel-version }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Mount Bazel cache
uses: actions/cache@v3
with:
path: ~/.cache/bazel
key: bazel-${{ matrix.bazel-version }}-${{ github.sha }}
restore-keys: |
bazel-${{ matrix.bazel-version }}-
bazel-
- name: Setup build tools
run: |
TOOLS_DIR="${HOME}/.cache/tools"
mkdir -p "${TOOLS_DIR}/bin/"
curl -Ls -o "${TOOLS_DIR}/bin/bazel" "https://github.com/bazelbuild/bazelisk/releases/download/v1.14.0/bazelisk-linux-amd64"
chmod +x "${TOOLS_DIR}/bin/bazel"
curl -Ls -o "${TOOLS_DIR}/bin/buildifier" "https://github.com/bazelbuild/buildtools/releases/download/0.29.0/buildifier"
chmod +x "${TOOLS_DIR}/bin/buildifier"
curl -Ls -o "${TOOLS_DIR}/bin/kind" "https://github.com/kubernetes-sigs/kind/releases/download/v0.11.1/kind-linux-amd64"
chmod +x "${TOOLS_DIR}/bin/kind"
echo "${TOOLS_DIR}/bin" >> $GITHUB_PATH
- name: Setup kind cluster
run: |
./create_kind_cluster.sh
- name: Build
run: |
bazel build //...
- name: Check
# run downloaded version of buildifier to reduce uncached build times
# see: bazel run //:buildifier-check
run: |
find . -type f \(\
-name '*.bzl' \
-o -name '*.sky' \
-o -name BUILD \
-o -name BUILD.bazel \
-o -name WORKSPACE \
-o -name WORKSPACE.bazel \
\) | xargs buildifier \
-mode=check \
-lint=warn \
--warnings=-module-docstring,-function-docstring,-function-docstring-header,-function-docstring-args,-function-docstring-return,-print \
|| {
buildifier_exit_code=$?
echo "Error: failed buildifier checks. Please run \"bazel run //:buildifier-fix\" and commit the changes."
exit $buildifier_exit_code
}
- name: Test
run: |
bazel test //...
- name: Build examples
run: |
cd examples
bazel build //...
- name: Test examples
run: |
cd examples
bazel test //...
- name: E2E
run: |
cd examples
./e2e-test.sh