-
Notifications
You must be signed in to change notification settings - Fork 5
220 lines (213 loc) · 8.24 KB
/
build.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: Build
permissions:
contents: read
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_TERM_COLOR: always
CHEZMOI_MODIFY_MANAGER_BUILDER: github-ci
RUST_BACKTRACE: 1
RUSTFLAGS: "-D warnings"
RUSTUP_MAX_RETRIES: 10
jobs:
modern-default:
# Test modern compilers on standard platforms on Linux.
name: "Test: ${{ matrix.target }}, Rust ${{ matrix.rust }} (default configuration)"
runs-on: ubuntu-latest
env:
CARGO_PROFILE_DEV_DEBUG: 1
CARGO_PROFILE_DEV_SPLIT_DEBUGINFO: ${{ matrix.debug_info }}
RUSTFLAGS: -D warnings -Clink-arg=-Wl,--compress-debug-sections=zlib
strategy:
fail-fast: false
matrix:
target:
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- armv7-unknown-linux-gnueabihf
- armv7-unknown-linux-musleabihf
- i686-unknown-linux-gnu
- i686-unknown-linux-musl
# Unfortunately, As of 1.76 nightly rust uses calls not supported by
# wine, so we can't run the cross-tests any more
#- x86_64-pc-windows-gnu
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
# Some lower priority targets too (not currently built as releases)
- powerpc-unknown-linux-gnu
- powerpc64-unknown-linux-gnu
rust:
- stable
- nightly
debug_info:
- packed
include:
# RISCV doesn't work with split debug info (see rust-lang/rust#110224)
- target: riscv64gc-unknown-linux-gnu
rust: stable
debug_info: off
- target: riscv64gc-unknown-linux-gnu
rust: nightly
debug_info: off
steps:
- uses: actions/checkout@v4
- name: Environment info
run: |
echo "rustup --version:"; rustup --version
echo "rustup show:"; rustup show
- name: Install Rust
run: rustup install --profile minimal ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- name: Install cross
uses: taiki-e/install-action@cross
- name: Cache builds
uses: Swatinem/rust-cache@v2.7.3
with:
key: ${{ matrix.target }}-${{ matrix.rust }}
- name: Cross compile
run: cross test --no-run --locked --target ${{ matrix.target }} --verbose
- name: Cross test
run: cross test --locked --target ${{ matrix.target }} --verbose
- name: Compress binary
if: matrix.rust == 'stable' && matrix.target != 'x86_64-pc-windows-gnu'
run: |
mkdir chezmoi_modify_manager
cp target/${{ matrix.target }}/debug/chezmoi_modify_manager chezmoi_modify_manager/
if [[ -f target/${{ matrix.target }}/debug/chezmoi_modify_manager.dwp ]]; then
# No split debug info for RISCV
cp target/${{ matrix.target }}/debug/chezmoi_modify_manager.dwp chezmoi_modify_manager/
fi
tar cf chezmoi_modify_manager.tar chezmoi_modify_manager
zstd -T0 -6 chezmoi_modify_manager.tar
- uses: actions/upload-artifact@v4
if: matrix.rust == 'stable' && matrix.target != 'x86_64-pc-windows-gnu'
with:
name: chezmoi_modify_manager_${{ matrix.target }}.zst
path: chezmoi_modify_manager.tar.zst
retention-days: 7
- name: Clean up temporary items
run: |
rm -rf chezmoi_modify_manager chezmoi_modify_manager.tar chezmoi_modify_manager.tar.zst
configurations:
# Test non-standard configurations, MSRV and Rust versions
name: "Test: \"${{ matrix.features }}\" (Linux), Rust ${{ matrix.rust }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
features:
- --no-default-features
- --no-default-features --features=updater-tls-rusttls
- --no-default-features --features=keyring
rust:
- 1.75.0
- stable
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup install --profile minimal ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- name: Cache builds
uses: Swatinem/rust-cache@v2.7.3
with:
save-if: ${{ matrix.features == '--no-default-features --features=updater-tls-native-vendored' }}
- name: Compile
run: cargo test --locked ${{ matrix.features }} --verbose --no-run
- name: Test
run: cargo test --locked ${{ matrix.features }} --verbose
- name: Test updater
if: matrix.features == '--no-default-features --features=updater-tls-rusttls'
run: |
echo n | cargo run --locked ${{ matrix.features }} -- --upgrade
- name: Test no updater exit code
if: matrix.features != '--no-default-features --features=updater-tls-rusttls'
run: |
# Because GitHub Actions exits on failure we need to do this
bash -c "cargo run --locked ${{ matrix.features }} -- --upgrade; if [[ \$? -eq 0 ]]; then exit 1; fi"
exotic-os:
# Test native builds on non-Linux platforms
name: "Test: ${{ matrix.target }} on ${{ matrix.os }} with ${{ matrix.rust }}"
runs-on: ${{ matrix.os }}
env:
CARGO_PROFILE_DEV_DEBUG: 1
CARGO_PROFILE_DEV_SPLIT_DEBUGINFO: "packed"
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-msvc
os: windows-latest
suffix: .exe
debug-suffix: .pdb
rust: stable
- target: x86_64-pc-windows-msvc
os: windows-latest
suffix: .exe
debug-suffix: .pdb
rust: nightly
- target: x86_64-pc-windows-gnu
os: windows-latest
suffix: .exe
debug-suffix: .pdb
rust: stable
- target: x86_64-pc-windows-gnu
os: windows-latest
suffix: .exe
debug-suffix: .pdb
rust: nightly
- target: x86_64-apple-darwin
os: macos-latest
suffix:
debug-suffix: .dSYM
rust: stable
- target: aarch64-apple-darwin
os: macos-latest
suffix:
debug-suffix: .dSYM
rust: stable
- target: x86_64-apple-darwin
os: macos-latest
suffix:
debug-suffix: .dSYM
rust: nightly
steps:
- uses: actions/checkout@v4
- name: Environment info
run: |
echo "rustup --version:"; rustup --version
echo "rustup show:"; rustup show
- name: Install Rust
run: rustup install --no-self-update --profile minimal ${{ matrix.rust }} && rustup default ${{ matrix.rust }} && rustup target add ${{ matrix.target }}
- name: Cache builds
uses: Swatinem/rust-cache@v2.7.3
with:
key: ${{ matrix.os }}-${{ matrix.target }}-${{ matrix.rust }}
- name: Compile
run: cargo test --no-run --locked --target ${{ matrix.target }} --verbose
- name: Test
run: cargo test --locked --target ${{ matrix.target }} --verbose
- name: Compress binary
if: matrix.rust == 'stable' && matrix.target != 'x86_64-pc-windows-gnu'
run: |
mkdir chezmoi_modify_manager
cp target/${{ matrix.target }}/debug/chezmoi_modify_manager${{ matrix.suffix }} chezmoi_modify_manager/
cp -r target/${{ matrix.target }}/debug/chezmoi_modify_manager${{ matrix.debug-suffix }} chezmoi_modify_manager/
tar cf chezmoi_modify_manager.tar chezmoi_modify_manager
zstd -T0 -6 chezmoi_modify_manager.tar
- uses: actions/upload-artifact@v4
if: matrix.rust == 'stable' && matrix.target != 'x86_64-pc-windows-gnu'
with:
name: chezmoi_modify_manager_${{ matrix.target }}.zst
path: chezmoi_modify_manager.tar.zst
retention-days: 7
- name: Clean up temporary items
if: matrix.os != 'windows-latest'
# I cannot get this cleanup to work on Windows. The cache just gets to include uneeded things
run: |
rm -rf chezmoi_modify_manager chezmoi_modify_manager.tar chezmoi_modify_manager.tar.zst