-
Notifications
You must be signed in to change notification settings - Fork 32
217 lines (189 loc) · 7.04 KB
/
build_and_upload.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
name: Build and Upload
on: [push]
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-20.04
target: x86_64-unknown-linux-musl
dir: musl
- os: ubuntu-20.04
target: aarch64-unknown-linux-musl
dir: musl-arm64
- os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
dir: gnu
# - os: windows-latest
# target: i686-pc-windows-msvc
# dir: windows
- os: macos-latest
target: x86_64-apple-darwin
dir: macos
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install musl-tools (Linux)
if: ${{ matrix.dir == 'musl' }}
run: sudo apt-get install -y musl-tools
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: ${{ matrix.target }}
- name: Install cross (only for arm64)
if: ${{ matrix.target == 'aarch64-unknown-linux-musl' }}
run: cargo install cross
- name: Cache cargo build
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
prefix-key: "lele"
- name: Build client
run: |
if [ "${{ matrix.target }}" = "aarch64-unknown-linux-musl" ]; then
cross build --locked --release --target "${{ matrix.target }}" --manifest-path binaries/geph5-client/Cargo.toml
else
cargo build --locked --release --target "${{ matrix.target }}" --manifest-path binaries/geph5-client/Cargo.toml
fi
- name: Move client binaries to artifacts directory
shell: bash
run: |
mkdir -p artifacts/${{ matrix.dir }}
mv target/${{ matrix.target }}/release/geph5-client artifacts/${{ matrix.dir }}/
- name: Install cargo-bundle
if: matrix.os == 'macos-latest'
run: cargo install cargo-bundle --locked --version "=0.6.0" --force
- name: Create macOS .app bundle
if: matrix.os == 'macos-latest'
run: |
cd binaries/geph5-client-gui
cargo bundle --release --target ${{ matrix.target }}
- name: Create macOS .app zip
if: matrix.os == 'macos-latest'
run: |
cd target/${{ matrix.target }}/release/bundle/osx/
zip -r "geph5-client-gui.app.zip" "Geph5.app"
mv "geph5-client-gui.app.zip" ../../../../../artifacts/${{ matrix.dir }}/
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.dir }}-latest
path: artifacts/${{ matrix.dir }}
build-bridge-exit:
name: Build Bridge, Exit, and Broker (Musl)
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install musl-tools
run: sudo apt-get install -y musl-tools
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: x86_64-unknown-linux-musl
- name: Set default host
shell: bash
run: rustup set default-host x86_64-unknown-linux-musl
- name: Cache cargo build
uses: Swatinem/rust-cache@v2
with:
key: x86_64-unknown-linux-musl-bridge-exit
- name: Build bridge and exit and broker
run: |
cargo build --locked --release --target x86_64-unknown-linux-musl --manifest-path binaries/geph5-bridge/Cargo.toml
cargo build --locked --release --target x86_64-unknown-linux-musl --manifest-path binaries/geph5-exit/Cargo.toml
cargo build --locked --release --target x86_64-unknown-linux-musl --manifest-path binaries/geph5-broker/Cargo.toml
- name: Move bridge and exit binaries to artifacts directory
run: |
mkdir -p artifacts/musl
mv target/x86_64-unknown-linux-musl/release/geph5-bridge artifacts/musl/
mv target/x86_64-unknown-linux-musl/release/geph5-broker artifacts/musl/
mv target/x86_64-unknown-linux-musl/release/geph5-exit artifacts/musl/
- name: Upload bridge and exit artifacts
uses: actions/upload-artifact@v3
with:
name: musl-latest
path: artifacts/musl
# build-windows-gui:
# runs-on: windows-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
#
# - name: Install Rust
# uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: stable
# override: true
# target: i686-pc-windows-msvc
#
# - name: Set default host
# shell: bash
# run: rustup set default-host i686-pc-windows-msvc
#
# - name: Cache cargo build
# uses: Swatinem/rust-cache@v2
# with:
# key: i686-pc-windows-msvc-gui
#
# - name: Build Windows GUI client
# run: |
# cargo build --locked --release --target i686-pc-windows-msvc --manifest-path binaries/geph5-client/Cargo.toml --all-features
# cargo build --locked --release --target i686-pc-windows-msvc --manifest-path binaries/geph5-client-gui/Cargo.toml
#
# - name: Build Windows installer
# shell: bash
# run: |
# choco install innosetup
# cp target/i686-pc-windows-msvc/release/geph5-client-gui packaging/windows
# cp target/i686-pc-windows-msvc/release/geph5-client packaging/windows
# cp binaries/geph5-client/windows-lib/* packaging/windows
# iscc packaging/windows/setup.iss
#
# - name: Move Windows GUI artifacts
# shell: bash
# run: |
# mkdir -p artifacts/windows-gui
# cp packaging/windows/Output/* artifacts/windows-gui/
# cp target/i686-pc-windows-msvc/release/geph5-client-gui artifacts/windows-gui/
#
# - name: Upload Windows GUI artifact
# uses: actions/upload-artifact@v3
# with:
# name: windows-gui-latest
# path: artifacts/windows-gui
upload:
if: github.ref == 'refs/heads/master'
needs: [build, build-bridge-exit]
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- dir: gnu
- dir: musl
- dir: musl-arm64
- dir: macos
# - dir: windows
# - dir: windows-gui
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Set up AWS configuration
run: |
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws configure set region apac
aws configure set output json
- name: Upload to Cloudflare R2
run: |
aws s3 cp ./artifacts/${{ matrix.dir }}-latest s3://geph5/${{ matrix.dir }}-latest --recursive --endpoint-url=https://b5e397a549f0e6543dba8e1d83ca9924.r2.cloudflarestorage.com