forked from Barre/privaxy
-
Notifications
You must be signed in to change notification settings - Fork 1
235 lines (206 loc) · 7.15 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
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
name: CI
on: [push, pull_request]
jobs:
clippy_check:
name: Run clippy check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: clippy
override: true
- name: Install gui library packages
run: sudo apt-get update && sudo apt-get install -y libwebkit2gtk-4.0-dev build-essential libayatana-appindicator3-dev librsvg2-dev libgtk-3-dev libsoup2.4-dev libjavascriptcoregtk-4.0-dev
- name: Install trunk
uses: actions-rs/cargo@v1
with:
command: install
args: --locked --debug trunk
- name: Install webassembly rust target
run: rustup target add wasm32-unknown-unknown
# Required for tailwindcss
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 14
- name: Install node packages
working-directory: ./web_frontend
run: npm i
# We need to build the web frontend otherwise, we will not be able to compile
# the server and checks will fail.
- name: Build web frontend
run: trunk build
working-directory: ./web_frontend
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
rustfmt:
name: Check style
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
profile: minimal
override: true
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
ci:
name: CI
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- build: linux
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
- build: linux
os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-gnu
# - build: macos
# os: macos-latest
# rust: stable
# target: x86_64-apple-darwin
# - buid: macos
# os: macos-latest
# rust: stable
# target: aarch64-apple-darwin
- build: windows
os: windows-latest
rust: stable
target: x86_64-pc-windows-msvc
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache build artifacts
uses: actions/cache@v3
with:
key: no_gui-${{ matrix.os }}-${{ matrix.target }}-artifacts
path: |
./target
~/.cargo
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- name: Install rust target
run: rustup target add ${{ matrix.target }}
- name: Install cross build dependencies
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross
- name: Build server
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }} --bin privaxy --target-dir target
- uses: actions/upload-artifact@v3
if: matrix.os != 'windows-latest'
with:
name: privaxy_nogui-${{ matrix.target }}
path: |
target/${{ matrix.target }}/release/privaxy
- uses: actions/upload-artifact@v3
if: matrix.os == 'windows-latest'
with:
name: privaxy_nogui-${{ matrix.target }}
path: |
target/${{ matrix.target }}/release/privaxy.exe
ci_desktop:
name: CI Desktop
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- build: linux
os: ubuntu-latest
rust: stable
# - build: macos
# os: macos-latest
# rust: stable
- build: windows
os: windows-latest
rust: stable
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache build artifacts
uses: actions/cache@v3
with:
key: gui-${{ matrix.os }}-artifacts
path: |
./target
~/.cargo
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- name: Install trunk
uses: actions-rs/cargo@v1
with:
command: install
args: --locked --debug trunk
- name: Install webassembly rust target
run: rustup target add wasm32-unknown-unknown
# Required for tailwindcss
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 16
- if: startsWith(matrix.os, 'ubuntu') == true
name: Install gui library packages
run: sudo apt-get update && sudo apt-get install -y libwebkit2gtk-4.0-dev build-essential libayatana-appindicator3-dev librsvg2-dev libgtk-3-dev libsoup2.4-dev libjavascriptcoregtk-4.0-dev
- if: startsWith(matrix.os, 'macos') == true
name: Install rust apple arm target
run: rustup target add aarch64-apple-darwin
- if: startsWith(matrix.os, 'macos') == true
name: Install apple api key private key
run: |
mkdir -p ~/private_keys
echo "$API_KEY" >> ~/private_keys/AuthKey_"$API_KEY_ID".p8
shell: bash
env:
API_KEY: ${{secrets.APPLE_API_KEY_CONTENTS}}
API_KEY_ID: ${{secrets.APPLE_API_KEY}}
- name: Install node packages
working-directory: ./web_frontend
run: npm i
# It is required to first build the frontend as the server won't
# build if it has no access to frontend's dist directory.
- name: Build web frontend
run: trunk build --release
working-directory: ./web_frontend
- name: Build desktop app
id: desktop_app
uses: tauri-apps/tauri-action@5a6072a9edbbf71718caee364b5b96731d7580fc #v0 does not handle universal builds
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
with:
tagName: privaxy-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
releaseName: 'Privaxy v__VERSION__'
releaseBody: 'See the assets to download this version and install.'
releaseDraft: true
prerelease: false
args: ${{ startsWith(matrix.os, 'macos') == true && '--target universal-apple-darwin' || '' }}