-
Notifications
You must be signed in to change notification settings - Fork 3
252 lines (227 loc) · 8.67 KB
/
build.yml
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
name: Build kernel images
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- created
jobs:
base-linting:
name: base-linting
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Lint Dockerfile, Shell scripts, YAML
uses: github/super-linter@v4
env:
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Linters to enable
VALIDATE_BASH: true
VALIDATE_BASH_EXEC: true
VALIDATE_DOCKERFILE_HADOLINT: true
VALIDATE_YAML: true
run-hooks:
name: Run pre-commit hooks
runs-on: ubuntu-22.04
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install pre-commit
run: |
pip install --upgrade pip
pip install --upgrade pre-commit
- name: Run pre-commit hooks ✅
run: pre-commit run --all-files --hook-stage manual
build_python_kernels:
runs-on:
group: ubuntu-22.04-8cpu-public
permissions:
id-token: write
packages: write
strategy:
fail-fast: false
matrix:
version: ["3.9", "3.10"] # TODO: Add 3.11 after fixing dependency conflicts
identifier: [base, base-gpu]
env:
VERSION: ${{ matrix.version }}
TARGET: python_${VERSION//./_}
BUILD_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
GITHUB_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
steps:
- uses: actions/checkout@v3
- name: Install Task
uses: arduino/setup-task@e26d8975574116b0097a1161e0fe16ba75d84c1c # v1.0.3
with:
repo-token: ${{ github.token }}
- run: |
task python:base:copy-files IDENTIFIER="base" NBL_PYTHON_VERSION=${{ matrix.version }}
if [[ "${{ matrix.identifier }}" == "base-gpu" ]];
then
task python:base:copy-files IDENTIFIER=${{ matrix.identifier }} NBL_PYTHON_VERSION=${{ matrix.version }}
fi
task python:noteable:copy-files IDENTIFIER=${{ matrix.identifier }} NBL_PYTHON_VERSION=${{ matrix.version }}
- run: scripts/set-variables.sh ${{ github.ref_name || github.ref }} ${{ github.event_name }} ${{ github.event.pull_request.number }}
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Set target
id: target
run: |
if [[ "${{ matrix.identifier }}" == "base" ]]
then
target="python_${VERSION//./_}"
else
target="python_${VERSION//./_}_gpu"
fi
echo "TARGET=${target}" >> "$GITHUB_OUTPUT"
- uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 # v2.9.1
- name: Build python kernels
uses: docker/bake-action@f32f8b8d70bc284af19f8148dd14ad1d2fbc6c28 # v3.1.0
with:
push: ${{ github.event_name != 'pull_request' }}
targets: ${{ steps.target.outputs.TARGET }}
build_rlang_kernels:
runs-on: ubuntu-22.04
permissions:
id-token: write
packages: write
strategy:
matrix:
version: [4.3.0]
env:
VERSION: ${{ matrix.version }}
BUILD_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
GITHUB_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
steps:
- uses: actions/checkout@v3
- name: Install Task
uses: arduino/setup-task@e26d8975574116b0097a1161e0fe16ba75d84c1c # v1.0.3
with:
repo-token: ${{ github.token }}
- run: |
task r:base:copy-files NBL_LANGUAGE_VERSION=${{ matrix.version }}
- run: scripts/set-variables.sh ${{ github.ref_name || github.ref }} ${{ github.event_name }} ${{ github.event.pull_request.number }}
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Set target
id: target
run: echo "TARGET=rlang_${VERSION//./_}" >> "$GITHUB_OUTPUT"
- uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 # v2.9.1
- name: Build kernels
uses: docker/bake-action@f32f8b8d70bc284af19f8148dd14ad1d2fbc6c28 # v3.1.0
with:
push: ${{ github.event_name != 'pull_request' }}
targets: ${{ steps.target.outputs.TARGET }}
build_rust_kernels:
runs-on: ubuntu-22.04
permissions:
id-token: write
packages: write
strategy:
matrix:
version: [1.70.0]
env:
VERSION: ${{ matrix.version }}
BUILD_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
GITHUB_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
steps:
- uses: actions/checkout@v3
- name: Install Task
uses: arduino/setup-task@e26d8975574116b0097a1161e0fe16ba75d84c1c # v1.0.3
with:
repo-token: ${{ github.token }}
- run: |
task rust:base:copy-files NBL_LANGUAGE_VERSION=${{ matrix.version }}
- run: scripts/set-variables.sh ${{ github.ref_name || github.ref }} ${{ github.event_name }} ${{ github.event.pull_request.number }}
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Set target
id: target
run: echo "TARGET=rust_${VERSION//./_}" >> "$GITHUB_OUTPUT"
- uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 # v2.9.1
- name: Build kernels
uses: docker/bake-action@f32f8b8d70bc284af19f8148dd14ad1d2fbc6c28 # v3.1.0
with:
push: ${{ github.event_name != 'pull_request' }}
targets: ${{ steps.target.outputs.TARGET }}
build_deno_kernels:
runs-on: ubuntu-22.04
permissions:
id-token: write
packages: write
strategy:
matrix:
version: ["1.37"]
env:
VERSION: ${{ matrix.version }}
BUILD_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
GITHUB_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
steps:
- uses: actions/checkout@v3
- name: Install Task
uses: arduino/setup-task@e26d8975574116b0097a1161e0fe16ba75d84c1c # v1.0.3
with:
repo-token: ${{ github.token }}
- run: |
task deno:base:copy-files NBL_LANGUAGE_VERSION=${{ matrix.version }}
- run: scripts/set-variables.sh ${{ github.ref_name || github.ref }} ${{ github.event_name }} ${{ github.event.pull_request.number }}
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Set target
id: target
run: echo "TARGET=deno_${VERSION//./_}" >> "$GITHUB_OUTPUT"
- uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 # v2.9.1
- name: Build kernels
uses: docker/bake-action@f32f8b8d70bc284af19f8148dd14ad1d2fbc6c28 # v3.1.0
with:
push: ${{ github.event_name != 'pull_request' }}
targets: ${{ steps.target.outputs.TARGET }}
create_release:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-22.04
steps:
- name: Checkout the code
uses: actions/checkout@v3
with:
# We need to pull tags as well, so that we can
# grab the latest releases for changelog actions
fetch-depth: 0
# Get information from the CHANGELOG. By default,
# this action grabs the latest version
- name: Get latest CHANGELOG version
id: changelog_reader
uses: mindsers/changelog-reader-action@b97ce03a10d9bdbb07beb491c76a5a01d78cd3ef
with:
path: ./CHANGELOG.md
- name: Create/update release
uses: ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5
with:
# This pulls from the "Get Changelog Entry" step above, referencing it's ID to get its outputs object.
# See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
tag: ${{ steps.changelog_reader.outputs.version }}
name: Release ${{ steps.changelog_reader.outputs.version }}
body: ${{ steps.changelog_reader.outputs.changes }}
allowUpdates: false
token: ${{ secrets.NBL_GITHUB_PACKAGES_TOKEN }}