-
Notifications
You must be signed in to change notification settings - Fork 61
292 lines (283 loc) · 8.32 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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
name: CI
on:
push:
branches: ['*']
tags: ['*']
pull_request:
schedule:
# Every Sunday at 1:30
- cron: '30 1 * * 0'
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: i686-unknown-linux-musl,x86_64-unknown-linux-musl,aarch64-unknown-linux-musl
components: clippy, rustfmt
- name: Build
run: |
cargo --locked build --profile release
- name: Install Test Dependencies
run: |
sudo apt-get update
sudo apt-get install quilt gnupg2 libio-pty-perl
- name: Test
env:
STG_PROVE_OPTS: "--jobs=2"
STG_TEST_OPTS: "--verbose-log"
STG_PROFILE: "release"
run: |
timeout 900s make -C t prove
- name: Show Failures
if: ${{ failure() }}
run: |
make -C t show-failure-results
- name: Install Doc Dependencies
run: |
sudo apt-get install asciidoc asciidoctor docbook-xsl-ns xmlto
- name: Build Docs Asciidoc
run: |
make -j2 doc
- name: Build Docs Asciidoctor
env:
USE_ASCIIDOCTOR: "1"
run: |
make -j2 doc
- name: Install HTML Docs
env:
USE_ASCIIDOCTOR: "1"
run: |
make -j2 htmldir="$GITHUB_WORKSPACE"/stgit-html install-html
- name: Upload HTML Docs
uses: actions/upload-artifact@v4
with:
name: html-doc
path: ${{ github.workspace }}/stgit-html
- name: Install cargo-deb
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-deb
- name: Install cargo-generate-rpm
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-generate-rpm
version: "^0.14.0"
- name: Install aarch64 Dependencies
run: |
sudo apt-get install gcc-aarch64-linux-gnu
- name: Static Build x86_64
run: |
make build-static-x86_64
- name: Static Build i686
run: |
make build-static-i686
- name: Build Build aarch64
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: "aarch64-linux-gnu-gcc"
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_STRIP: "aarch64-linux-gnu-strip"
run: |
make build-static-aarch64
- name: Build Packages
env:
USE_ASCIIDOCTOR: "1"
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: "aarch64-linux-gnu-gcc"
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_STRIP: "aarch64-linux-gnu-strip"
run: |
make packages
- name: Upload Packages
uses: actions/upload-artifact@v4
with:
name: stgit-packages
path: target/pkg/*
build-and-test:
name: Build and Test
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
profile: dev
toolchain: stable
- os: ubuntu-latest
profile: dev
toolchain: nightly
- os: macos-latest
profile: dev
toolchain: stable
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: Build
run: |
cargo --locked build --profile ${{ matrix.profile }}
- name: Install Test Dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get update
sudo apt-get install quilt gnupg2 libio-pty-perl
- name: Install Test Dependencies
if: ${{ matrix.os == 'macos-latest' }}
run: |
# coreutils provides the `timeout` command used to wrap `make` below.
# gnu-sed is needed by some tests (e.g. t3400-pick.sh).
brew install coreutils cpanminus gnu-sed
echo "$(brew --prefix)/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH
echo "$(brew --prefix)/opt/coreutils/libexec/gnubin" >> $GITHUB_PATH
sudo cpanm IO::Pty
- name: Test
env:
STG_PROVE_OPTS: "--jobs=2"
STG_TEST_OPTS: "--verbose-log"
STG_PROFILE: ${{ matrix.profile }}
run: |
timeout 900s make -C t prove
- name: Show Failures
if: ${{ failure() }}
run: |
make -C t show-failure-results
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Run Unit Tests
run: |
cargo --locked test
clippy:
name: Clippy Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- name: Clippy Checks
run: |
cargo --locked clippy -- --deny warnings
rustfmt:
name: Format Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- name: Check formatting
run: |
cargo --locked fmt --all --check
api-docs:
name: API Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Build docs
run: |
cargo rustdoc -- --deny warnings
windows-build:
name: Windows Build
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Build
run: |
cargo --locked build --profile release
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: diffutils make
path-type: inherit
- name: Test
shell: msys2 {0}
env:
STG_PROVE_OPTS: "--jobs=2"
STG_TEST_OPTS: "--verbose-log"
STG_PROFILE: "release"
run: |
timeout 900s make -C t prove
- name: Show Failures
if: ${{ failure() }}
shell: msys2 {0}
run: |
make -C t show-failure-results
- name: Install Wix Toolset v4
run: |
dotnet tool install --global wix --version 4.0.0
- name: Install Wix UI Extension
run: |
wix extension add -g WixToolset.UI.wixext
- name: Build MSI Installer
shell: msys2 {0}
run: |
make -C contrib/wix
- name: Upload MSI Package
uses: actions/upload-artifact@v4
with:
name: stgit-msi-package
path: contrib/wix/stgit-*.msi
github-release:
name: GitHub Release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
needs: [release, windows-build]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch Tag
run: |
git fetch --force origin "+${GITHUB_REF}:${GITHUB_REF}"
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: Make source archive
run: |
./contrib/release/make-archive.sh artifacts
- name: Latest Changes
run: |
./contrib/release/latest-changelog.awk CHANGELOG.md >latest-changes.md
- name: Draft Release
uses: softprops/action-gh-release@v1
with:
draft: true
body_path: latest-changes.md
fail_on_unmatched_files: true
files: |
artifacts/stgit-*.tar.gz
artifacts/stgit-packages/*.deb
artifacts/stgit-packages/*.rpm
artifacts/stgit-msi-package/*.msi