-
-
Notifications
You must be signed in to change notification settings - Fork 43
165 lines (147 loc) · 5.56 KB
/
integration-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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Integration Build
on:
workflow_dispatch:
issue_comment:
types: [created]
jobs:
test-manual:
name: "Integration Test Build (Manual)"
if: github.event_name == 'workflow_dispatch'
runs-on: ${{ matrix.cases.os }}
timeout-minutes: 60
strategy:
matrix:
cases:
- {
os: "ubuntu-20.04",
cuda-version: "11.6.2",
source: "nvidia",
toolchain: "nvcc",
}
- {
os: "ubuntu-20.04",
cuda-version: "11.6.2",
source: "nvidia",
toolchain: "llvm",
toolchain-version: "16",
}
steps:
- uses: actions/checkout@v3
- uses: bazelbuild/setup-bazelisk@v2
- name: Mount bazel cache
if: ${{ !startsWith(matrix.cases.os, 'windows') }}
uses: actions/cache@v3
with:
path: ~/.cache/bazel
key: ${{ matrix.cases.toolchain }}-${{ matrix.cases.toolchain-version }}
- 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 --cxxopt=--cuda-gpu-arch=sm_80 >> $HOME/.bazelrc"
- run: cd examples && bazelisk build --verbose_failures --cuda_archs='compute_80,sm_80' @rules_cuda_examples//nccl:perf_binaries
- run: bazelisk shutdown
# based on https://dev.to/zirkelc/trigger-github-workflow-for-comment-on-pull-request-45l2
pre-test-comment:
name: "Integration Test Build - Set commit status pending"
if: github.event.issue.pull_request && contains(github.event.comment.body, '/test')
runs-on: ubuntu-latest
steps:
- name: Get PR branch
uses: xt0rted/pull-request-comment-branch@v2
id: comment-branch
- name: Set commit status as pending
uses: myrotvorets/set-commit-status-action@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
sha: ${{ steps.comment-branch.outputs.head_sha }}
status: pending
test-comment:
name: "Integration Test Build (CUDA ${{ matrix.cases.cuda-version }} on ${{ matrix.cases.os }})"
needs: [pre-test-comment]
runs-on: ${{ matrix.cases.os }}
timeout-minutes: 60
strategy:
matrix:
cases:
- {
os: "ubuntu-20.04",
cuda-version: "11.6.2",
source: "nvidia",
toolchain: "nvcc",
}
- {
os: "ubuntu-20.04",
cuda-version: "11.6.2",
source: "nvidia",
toolchain: "llvm",
toolchain-version: "16",
}
steps:
- name: Get PR branch
uses: xt0rted/pull-request-comment-branch@v2
id: comment-branch
- name: Checkout PR branch
uses: actions/checkout@v3
with:
ref: ${{ steps.comment-branch.outputs.head_ref }}
- uses: bazelbuild/setup-bazelisk@v2
- name: Mount bazel cache
if: ${{ !startsWith(matrix.cases.os, 'windows') }}
uses: actions/cache@v3
with:
path: ~/.cache/bazel
key: ${{ matrix.cases.toolchain }}-${{ matrix.cases.toolchain-version }}
- 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 --cxxopt=--cuda-gpu-arch=sm_80 >> $HOME/.bazelrc"
- run: cd examples && bazelisk build --verbose_failures --cuda_archs='compute_80,sm_80' @rules_cuda_examples//nccl:perf_binaries
- run: bazelisk shutdown
post-test-comment:
name: "Integration Test Build - Set commit status as test result"
needs: [test-comment]
runs-on: ubuntu-latest
steps:
- name: Get PR branch
uses: xt0rted/pull-request-comment-branch@v2
id: comment-branch
- name: Set latest commit status as ${{ job.status }}
uses: myrotvorets/set-commit-status-action@master
if: always()
with:
sha: ${{ steps.comment-branch.outputs.head_sha }}
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
- name: Add comment to PR
uses: actions/github-script@v6
if: always()
with:
script: |
const name = '${{ github.workflow }}';
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
const success = '${{ job.status }}' === 'success';
const body = `${name}: ${success ? 'succeeded ✅' : 'failed ❌'}\n${url}`;
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
})