-
Notifications
You must be signed in to change notification settings - Fork 22
233 lines (187 loc) · 9.58 KB
/
package_for_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
221
222
223
224
225
226
227
228
229
230
231
232
233
name: package for release
on:
workflow_dispatch: {}
jobs:
linux:
runs-on: ubuntu-latest
steps:
- name: 🛠 Install system dependencies
run: |
sudo add-apt-repository ppa:ubuntuhandbook1/ffmpeg6
sudo apt-get update -y -qq
sudo apt-get install -y libegl1-mesa-dev libgl1-mesa-dri libxcb-xfixes0-dev ffmpeg libavcodec-dev libavformat-dev libavfilter-dev libavdevice-dev libopus-dev
- name: 🔧 Install the rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: 📥 Checkout repo
uses: actions/checkout@v4
- name: 📦 Package
run: cargo run --bin package_for_release
- uses: actions/upload-artifact@v4
with:
name: smelter_linux_x86_64.tar.gz
path: smelter_linux_x86_64.tar.gz
- uses: actions/upload-artifact@v4
with:
name: smelter_with_web_renderer_linux_x86_64.tar.gz
path: smelter_with_web_renderer_linux_x86_64.tar.gz
linux-aarch64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: "repo"
- uses: uraimo/run-on-arch-action@v2
name: Build artifact
id: build
with:
arch: aarch64
distro: ubuntu22.04
# Not required, but speeds up builds
githubToken: ${{ github.token }}
# Create an artifacts directory
setup: |
mkdir -p "${PWD}/artifacts"
# Mount the artifacts directory as /artifacts in the container
dockerRunArgs: |
--volume "${PWD}/artifacts:/artifacts"
--volume "${PWD}/repo:/repo"
# The shell to run commands with in the container
shell: /bin/sh
install: |
apt update -y -qq
apt install software-properties-common -y
add-apt-repository ppa:ubuntuhandbook1/ffmpeg6
apt-get update -y -qq
apt-get install -y libegl1-mesa-dev libgl1-mesa-dri libxcb-xfixes0-dev ffmpeg libavcodec-dev libavformat-dev libavfilter-dev libavdevice-dev libopus-dev curl git build-essential libssl-dev pkg-config libclang-dev
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
rm -rf /var/lib/apt/lists/*
# Produce a binary artifact and place it in the mounted volume
run: |
. "$HOME/.cargo/env"
cd "/repo"
cargo run --bin package_for_release
cp *.tar.gz /artifacts
- uses: actions/upload-artifact@v4
with:
name: smelter_linux_aarch64.tar.gz
path: artifacts/smelter_linux_aarch64.tar.gz
macos_x86_64:
runs-on: macos-12
steps:
- name: 🛠 Install system dependencies
run: brew install ffmpeg
- name: 🔧 Install the rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: 📥 Checkout repo
uses: actions/checkout@v4
- name: 📦 Package
run: cargo run --bin package_for_release
- uses: actions/upload-artifact@v4
with:
name: smelter_darwin_x86_64.tar.gz
path: smelter_darwin_x86_64.tar.gz
- uses: actions/upload-artifact@v4
with:
name: smelter_with_web_renderer_darwin_x86_64.tar.gz
path: smelter_with_web_renderer_darwin_x86_64.tar.gz
macos-aarch64:
runs-on: macos-14
steps:
- name: 🛠 Install system dependencies
run: brew install ffmpeg
- name: 🔧 Install the rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: 📥 Checkout repo
uses: actions/checkout@v4
- name: 📦 Package
run: cargo run --bin package_for_release
- uses: actions/upload-artifact@v4
with:
name: smelter_darwin_aarch64.tar.gz
path: smelter_darwin_aarch64.tar.gz
- uses: actions/upload-artifact@v4
with:
name: smelter_with_web_renderer_darwin_aarch64.tar.gz
path: smelter_with_web_renderer_darwin_aarch64.tar.gz
docker-amd64:
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repo
uses: actions/checkout@v4
- name: 🛠️ Setup Docker
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: 🔨 Build Smelter image
run: |
docker buildx build --platform linux/amd64 -t ghcr.io/software-mansion/smelter:${{ github.sha }} -f build_tools/docker/slim.Dockerfile .
- name: 📤 Upload image
run: docker push ghcr.io/software-mansion/smelter:${{ github.sha }}
docker-arm64:
needs: docker-amd64
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repo
uses: actions/checkout@v4
- name: 🛠️ Setup Docker
run: |
docker run --privileged --rm tonistiigi/binfmt --install all
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: 🎣 Pull Smleter AMD64 image
run: |
docker pull ghcr.io/software-mansion/smelter:${{ github.sha }}
echo "AMD64_IMAGE_ID=$(docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/software-mansion/smelter:${{ github.sha }})" >> "$GITHUB_ENV"
- name: 🔨 Build Smelter ARM64 image
run: |
docker buildx build --platform linux/arm64 -t ghcr.io/software-mansion/smelter:${{ github.sha }} -f build_tools/docker/slim.Dockerfile .
- name: ⏩ Push ARM64 image
run: |
docker push ghcr.io/software-mansion/smelter:${{ github.sha }}
echo "ARM64_IMAGE_ID=$(docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/software-mansion/smelter:${{ github.sha }})" >> "$GITHUB_ENV"
- name: 🔗 Merge AMD64 and ARM64 images
run: |
docker manifest create ghcr.io/software-mansion/smelter:${{ github.sha }} ${{ env.AMD64_IMAGE_ID }} ${{ env.ARM64_IMAGE_ID }}
docker manifest annotate ghcr.io/software-mansion/smelter:${{ github.sha }} ${{ env.AMD64_IMAGE_ID }} --arch amd64
docker manifest annotate ghcr.io/software-mansion/smelter:${{ github.sha }} ${{ env.ARM64_IMAGE_ID }} --arch arm64
- name: 📤 Upload image
run: docker manifest push ghcr.io/software-mansion/smelter:${{ github.sha }}
docker-with-web-renderer-amd64:
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repo
uses: actions/checkout@v4
- name: 🛠️ Setup Docker
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: 🔨 Build Smelter with Web Renderer image
run: |
docker buildx build --platform linux/amd64 -t ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer -f build_tools/docker/full.Dockerfile .
- name: 📤 Upload image
run: docker push ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer
docker-with-web-renderer-arm64:
needs: docker-with-web-renderer-amd64
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repo
uses: actions/checkout@v4
- name: 🛠️ Setup Docker
run: |
docker run --privileged --rm tonistiigi/binfmt --install all
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: 🎣 Pull Smleter AMD64 image
run: |
docker pull ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer
echo "AMD64_IMAGE_ID=$(docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer)" >> "$GITHUB_ENV"
- name: 🔨 Build Smelter ARM64 image
run: |
docker buildx build --platform linux/arm64 -t ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer -f build_tools/docker/full.Dockerfile .
- name: ⏩ Push ARM64 image
run: |
docker push ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer
echo "ARM64_IMAGE_ID=$(docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer)" >> "$GITHUB_ENV"
- name: 🔗 Merge AMD64 and ARM64 images
run: |
docker manifest create ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer ${{ env.AMD64_IMAGE_ID }} ${{ env.ARM64_IMAGE_ID }}
docker manifest annotate ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer ${{ env.AMD64_IMAGE_ID }} --arch amd64
docker manifest annotate ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer ${{ env.ARM64_IMAGE_ID }} --arch arm64
- name: 📤 Upload image
run: docker manifest push ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer