-
-
Notifications
You must be signed in to change notification settings - Fork 47
133 lines (119 loc) · 6.39 KB
/
build-tests.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
name: Test Example Build
on:
push:
branches:
- main
pull_request:
jobs:
test:
name: "Test Examples Build (CUDA ${{ matrix.cases.cuda-version }} on ${{ matrix.cases.os }})"
runs-on: ${{ matrix.cases.os }}
timeout-minutes: 60
strategy:
matrix:
cases:
- { os: "ubuntu-20.04", cuda-version: "11.2.2", source: "nvidia" }
- { os: "ubuntu-22.04", cuda-version: "11.8.0", source: "nvidia" }
- {
os: "ubuntu-20.04",
cuda-version: "11.6.2",
source: "nvidia",
toolchain: "llvm",
toolchain-version: "16",
}
- {
os: "ubuntu-22.04",
cuda-version: "11.5.1-1ubuntu1",
source: "ubuntu",
}
- { os: "windows-2019", cuda-version: "10.1.243", source: "nvidia" }
- { os: "windows-2019", cuda-version: "11.6.2", source: "nvidia" }
steps:
- uses: actions/checkout@v4
- uses: bazelbuild/setup-bazelisk@v3
- name: Mount bazel cache
if: ${{ !startsWith(matrix.cases.os, 'windows') }}
uses: actions/cache@v4
with:
path: ~/.cache/bazel
key: bazel-${{ matrix.cases.os }}-cuda-${{ matrix.cases.cuda-version }}-${{ hashFiles('.bazelversion') }}
- name: Setup build environment
uses: ./.github/actions/set-build-env
with:
os: ${{ matrix.cases.os }}
cuda-version: ${{ matrix.cases.cuda-version }}
source: ${{ matrix.cases.source }}
toolchain: ${{ matrix.cases.toolchain }}
toolchain-version: ${{ matrix.cases.toolchain-version }}
- name: Bazel build config for LLVM
if: ${{ !startsWith(matrix.cases.os, 'windows') && matrix.cases.toolchain == 'llvm' }}
run: |
echo "build --config=clang" > $HOME/.bazelrc
echo "build:clang --@rules_cuda//cuda:archs=sm_80" >> $HOME/.bazelrc
# Check https://bazel.build/release#support-matrix, manually unroll the the strategy matrix to avoid exploding
# the combinations.
# Use Bazel with version specified in .bazelversion
- run: echo "USE_BAZEL_VERSION=$(cat .bazelversion)" >> $GITHUB_ENV
if: ${{ !startsWith(matrix.cases.os, 'windows') }}
- run: echo "USE_BAZEL_VERSION=$(cat .bazelversion)" >> $env:GITHUB_ENV
if: ${{ startsWith(matrix.cases.os, 'windows') }}
# out of @examples repo build requires WORKSPACE-based external dependency system
- run: bazelisk build --jobs=1 @rules_cuda_examples//basic:all
- run: bazelisk build --jobs=1 @rules_cuda_examples//rdc:all
- run: bazelisk build --jobs=1 @rules_cuda_examples//if_cuda:main
- run: bazelisk build --jobs=1 @rules_cuda_examples//if_cuda:main --enable_cuda=False
# in @examples repo build, bzlmod is enabled by default since Bazel 7
- run: cd examples && bazelisk build --jobs=1 //basic:all
- run: cd examples && bazelisk build --jobs=1 //rdc:all
- run: cd examples && bazelisk build --jobs=1 //if_cuda:main
- run: cd examples && bazelisk build --jobs=1 //if_cuda:main --enable_cuda=False
- run: bazelisk shutdown
# run some repo integration tests
- run: cd tests/integration && ./test_all.sh
# Use Bazel 7
- run: echo "USE_BAZEL_VERSION=7.5.0" >> $GITHUB_ENV
if: ${{ !startsWith(matrix.cases.os, 'windows') }}
- run: echo "USE_BAZEL_VERSION=7.5.0" >> $env:GITHUB_ENV
if: ${{ startsWith(matrix.cases.os, 'windows') }}
# out of @examples repo build requires WORKSPACE-based external dependency system
- run: bazelisk build --jobs=1 --noenable_bzlmod @rules_cuda_examples//basic:all
- run: bazelisk build --jobs=1 --noenable_bzlmod @rules_cuda_examples//rdc:all
- run: bazelisk build --jobs=1 --noenable_bzlmod @rules_cuda_examples//if_cuda:main
- run: bazelisk build --jobs=1 --noenable_bzlmod @rules_cuda_examples//if_cuda:main --enable_cuda=False
# in @examples repo build, bzlmod is enabled by default since Bazel 7
- run: cd examples && bazelisk build --jobs=1 //basic:all
- run: cd examples && bazelisk build --jobs=1 //rdc:all
- run: cd examples && bazelisk build --jobs=1 //if_cuda:main
- run: cd examples && bazelisk build --jobs=1 //if_cuda:main --enable_cuda=False
- run: bazelisk shutdown
# run some repo integration tests
- run: cd tests/integration && ./test_all.sh
# Use Bazel 6
- run: echo "USE_BAZEL_VERSION=6.4.0" >> $GITHUB_ENV
if: ${{ !startsWith(matrix.cases.os, 'windows') }}
- run: echo "USE_BAZEL_VERSION=6.4.0" >> $env:GITHUB_ENV
if: ${{ startsWith(matrix.cases.os, 'windows') }}
- run: bazelisk build --jobs=1 @rules_cuda_examples//basic:all
- run: bazelisk build --jobs=1 @rules_cuda_examples//rdc:all
- run: bazelisk build --jobs=1 @rules_cuda_examples//if_cuda:main
- run: bazelisk build --jobs=1 @rules_cuda_examples//if_cuda:main --enable_cuda=False
- run: cd examples && bazelisk build --jobs=1 --enable_bzlmod //basic:all
- run: cd examples && bazelisk build --jobs=1 --enable_bzlmod //rdc:all
- run: cd examples && bazelisk build --jobs=1 --enable_bzlmod //if_cuda:main
- run: cd examples && bazelisk build --jobs=1 --enable_bzlmod //if_cuda:main --enable_cuda=False
- run: bazelisk shutdown
# Use Bazel 5
- run: echo "USE_BAZEL_VERSION=5.4.1" >> $GITHUB_ENV
if: ${{ !startsWith(matrix.cases.os, 'windows') }}
- run: echo "USE_BAZEL_VERSION=5.4.1" >> $env:GITHUB_ENV
if: ${{ startsWith(matrix.cases.os, 'windows') }}
- run: bazelisk build --jobs=1 @rules_cuda_examples//basic:all
- run: bazelisk build --jobs=1 @rules_cuda_examples//rdc:all
- run: bazelisk build --jobs=1 @rules_cuda_examples//if_cuda:main
- run: bazelisk build --jobs=1 @rules_cuda_examples//if_cuda:main --enable_cuda=False
# bzlmod is not covered, our separate @rules_cuda_examples repo setup doesn't play well with it
# - run: cd examples && bazelisk build --jobs=1 --experimental_enable_bzlmod //basic:all
# - run: cd examples && bazelisk build --jobs=1 --experimental_enable_bzlmod //rdc:all
# - run: cd examples && bazelisk build --jobs=1 --experimental_enable_bzlmod //if_cuda:main
# - run: cd examples && bazelisk build --jobs=1 --experimental_enable_bzlmod //if_cuda:main --enable_cuda=False
- run: bazelisk shutdown