-
Notifications
You must be signed in to change notification settings - Fork 1
184 lines (158 loc) · 5.4 KB
/
ci.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
name: CI
on:
push:
tags:
- v*
- pre-rel-*
env:
runtime-vm_repository: golemfactory/ya-runtime-vm
runtime-vm_version: pre-rel-v0.4.0-ITL-rc21
vm_name: ya-runtime-vm-nvidia
os_name: linux
organisation: golemfactory
docker-img_name: golem-nvidia-base
docker-img_description: Base image with Nvidia drivers for Golem VM images.
self-test-img_gvmi: self-test.gvmi
jobs:
build-golem_nvidia_base:
name: Build golem-nvidia-base
runs-on: ubuntu-20.04
steps:
- name: Install Musl
run: sudo apt-get install -y musl-tools musl
- uses: actions/checkout@v1
with:
submodules: "recursive"
- name: Tag name and version
id: tag_name
run: |
TAG=${GITHUB_REF##*/}
VERSION=${TAG#v}
VERSION=${VERSION#pre-rel-v}
echo "TAG=${TAG}" >> $GITHUB_OUTPUT
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: ./golem_nvidia_base/
push: true
# Always create `latest` tag. If not make `self_test_img` to use currently build image.
tags: |
ghcr.io/${{ env.organisation }}/${{ env.docker-img_name }}:${{ steps.tag_name.outputs.VERSION }}
ghcr.io/${{ env.organisation }}/${{ env.docker-img_name }}:${{ startsWith(steps.tag_name.outputs.TAG, 'pre-rel-') && 'beta' || 'stable' }}
ghcr.io/${{ env.organisation }}/${{ env.docker-img_name }}:latest
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=${{ env.docker-img_description }}
build-self-test-img:
name: Build self test img
needs:
- build-golem_nvidia_base
runs-on: ubuntu-20.04
env:
gvmkit-build_tag: v0.3.13
gvmkit-build_dir: gvmkit-build
gvmkit-build_archive: gvmkit-build-x86_64-unknown-linux-gnu.tar.gz
self-test-img_tag: self-test
rust_stable: 1.70.0
steps:
- uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_stable }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.rust_stable }}
components: rustfmt, clippy
- name: Check lockfile
uses: actions-rs/cargo@v1
with:
command: tree
args: --locked
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Check clippy lints
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features --workspace -- -D warnings
- name: Unit tests
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --locked
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build Docker image for GPU
uses: docker/build-push-action@v4
with:
context: self_test_img
push: false
tags: ${{ env.self-test-img_tag }}
- name: Download gvmkit-build
if: startsWith(github.ref, 'refs/tags/')
uses: robinraju/[email protected]
with:
repository: golemfactory/gvmkit-build-rs
tag: ${{ env.gvmkit-build_tag }}
fileName: ${{ env.gvmkit-build_archive }}
extract: true
out-file-path: ${{ env.gvmkit-build_dir }}
tarBall: false
zipBall: false
- name: Build GVMkit image
if: startsWith(github.ref, 'refs/tags/')
run: |
${{ env.gvmkit-build_dir }}/gvmkit-build ${{ env.self-test-img_tag }}:latest -o ${{ env.self-test-img_gvmi }}
- uses: actions/upload-artifact@v2
with:
name: self_test_img
path: |
${{ env.self-test-img_gvmi }}
- name: Download ya-runtime-vm
uses: robinraju/[email protected]
with:
repository: ${{ env.runtime-vm_repository }}
tag: ${{ env.runtime-vm_version }}
fileName: ya-runtime-vm-${{ env.os_name }}-${{ env.runtime-vm_version }}.tar.gz
extract: true
out-file-path: .
tarBall: false
zipBall: false
- name: Build .deb
id: deb
run: |
chmod +x debian/build-deb.sh
./debian/build-deb.sh ${{ github.ref }} ${{ env.self-test-img_gvmi }} ya-runtime-vm-${{ env.os_name }}-${{ env.runtime-vm_version }}/ya-runtime-vm
- uses: actions/upload-artifact@v2
with:
name: deb
path: |
${{ steps.deb.outputs.deb }}
release:
name: Release
needs:
- build-self-test-img
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v2
with:
name: deb
path: dist/
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: dist/*
prerelease: ${{ startsWith(github.ref, 'refs/tags/pre-rel-v') }}