-
Notifications
You must be signed in to change notification settings - Fork 159
220 lines (218 loc) · 6.83 KB
/
release.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
name: release
on:
release:
types: [published]
jobs:
goreleaser:
if: github.repository == 'tensorchord/envd'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.19.10
- name: Docker Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERIO_USERNAME }}
password: ${{ secrets.DOCKERIO_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: upload gobin
uses: actions/upload-artifact@v4
with:
name: gobin_${{ github.event.release.tag_name }}
retention-days: 1
path: |
dist/envd_linux_amd64_v1/envd
dist/envd_darwin_all/envd
if-no-files-found: error
pypi_publish:
needs: goreleaser
# only trigger on main repo when tag starts with v
if: github.repository == 'tensorchord/envd' && startsWith(github.ref, 'refs/tags/v')
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
matrix:
os: [macos-11, ubuntu-20.04]
steps:
- uses: actions/checkout@v4
- name: Get gobin
uses: actions/download-artifact@v4
with:
name: gobin_${{ github.event.release.tag_name }}
path: dist/
- name: Configure linux build environment
if: runner.os == 'Linux'
run: |
mkdir -p bin
mv dist/envd_linux_amd64_v1/envd bin/envd
chmod +x bin/envd
- name: Configure macOS build environment
if: runner.os == 'macOS'
run: |
mkdir -p bin
mv dist/envd_darwin_all/envd bin/envd
chmod +x bin/envd
- name: setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
env:
CIBW_ARCHS_MACOS: arm64, x86_64
CIBW_ARCHS_LINUX: auto64
CIBW_SKIP: pp*
- name: Build source distribution
if: runner.os == 'Linux' # Only release source under linux to avoid conflict
run: |
python -m pip install wheel
python setup.py sdist
mv dist/*.tar.gz wheelhouse/
- name: Upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m pip install --upgrade pip
python -m pip install twine
python -m twine upload wheelhouse/*
image_publish:
name: Build & push images
# only trigger on main repo when tag starts with v
if: github.repository == 'tensorchord/envd' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: goreleaser
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Docker Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERIO_USERNAME }}
password: ${{ secrets.DOCKERIO_TOKEN }}
- name: Docker Buildx
run: |
./base-images/build.sh
envd_starship_publish:
name: Push starship image to Docker Hub
runs-on: ubuntu-latest
needs: goreleaser
steps:
- uses: actions/checkout@v4
- name: Docker Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERIO_USERNAME }}
password: ${{ secrets.DOCKERIO_TOKEN }}
- name: Docker Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
file: base-images/envd-starship/envd-starship.Dockerfile
platforms: linux/amd64,linux/arm64
tags: tensorchord/starship:v0.0.1
cache-from: type=gha
cache-to: type=gha,mode=max
envd_image_push:
name: Build & push envd images
# only trigger on main repo when tag starts with v
if: github.repository == 'tensorchord/envd' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: goreleaser
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Docker Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERIO_USERNAME }}
password: ${{ secrets.DOCKERIO_TOKEN }}
- name: Docker Buildx
run: |
./base-images/envd/build.sh
cache_publish:
name: Build & Push the remote cache
# only trigger on main repo when tag starts with v
if: github.repository == 'tensorchord/envd' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
strategy:
matrix:
build_func: ["build", "build_gpu_11_2", "build_gpu_11_3", "build_gpu_11_6"]
include:
- build_func: build
tag_suffix: ""
- build_func: build_gpu_11_2
tag_suffix: "-cuda-11.2.2-cudnn-8"
- build_func: build_gpu_11_3
tag_suffix: "-cuda-11.3.1-cudnn-8"
- build_func: build_gpu_11_6
tag_suffix: "-cuda-11.6.2-cudnn-8"
needs: image_publish
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Get gobin
uses: actions/download-artifact@v4
with:
name: gobin_${{ github.event.release.tag_name }}
path: dist/
- name: Configure linux build environment
if: runner.os == 'Linux'
run: |
mv dist/envd_linux_amd64_v1/envd /usr/local/bin/envd
chmod +x /usr/local/bin/envd
- name: Docker Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERIO_USERNAME }}
password: ${{ secrets.DOCKERIO_TOKEN }}
- name: Build and push
run: ./base-images/remote-cache/build-and-push-remote-cache.sh
env:
BUILD_FUNC: ${{ matrix.build_func }}
TAG_SUFFIX: ${{ matrix.TAG_SUFFIX }}
ENVD_BUILD_OWNER: 1000