-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy path.cirrus.yml
344 lines (330 loc) · 12.5 KB
/
.cirrus.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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
---
# BEGIN: cirrus-anchors.yml
anchors:
#- &install_cargo_make_unix
# install_cargo_make_script: ./.ci/install-cargo-make.sh
#- &build_cargo_make_unix
# build_cargo_make_cache:
# folder: $CARGO_HOME/opt/cargo-make
# fingerprint_script: |
# echo "$CIRRUS_OS"
# echo "${CI_CACHE_BUST:-}"
# echo "$RUST_VERSION"
# ./.ci/install-cargo-make.sh --print-latest
# populate_script: ./.ci/build-cargo-make.sh
# link_cargo_make_script: ln -snf "$CARGO_HOME"/opt/*/bin/* "$CARGO_HOME"/bin/
- &base_unix
env:
CARGO_HOME: /usr/local/cargo
PATH: /usr/local/cargo/bin:$PATH
install_rustup_script: |
curl -sSfL https://sh.rustup.rs | sh -s -- \
-y --default-toolchain none --profile minimal --no-modify-path
install_rust_script: rustup default "$RUST_VERSION"
cargo_cache:
folder: $CARGO_HOME/registry
fingerprint_script: |
if [ ! -f Cargo.lock ]; then
cargo generate-lockfile --quiet
fi
echo "${CIRRUS_OS}"; cat Cargo.lock
- &base_linux
install_dependencies_script: |
if command -v yum >/dev/null; then
yum install -y unzip
else
apt-get install -y unzip
fi
<<: *base_unix
#<<: *install_cargo_make_unix
- &base_freebsd
install_dependencies_script: |
pkg install -y llvm11
<<: *base_unix
#<<: *build_cargo_make_unix
- &install_target_unix
install_rustup_target_script: rustup target install "$TARGET"
#- &build_bin_unix
# build_script: |
# if [ "${CIRRUS_TAG:-}" = "nightly" ]; then
# export NIGHTLY_BUILD="$(date -u +%F)"
# fi
# cargo make build-release "--bin=$BIN" "--target=$TARGET"
# strip_script: $STRIP "target/$TARGET/release/$BIN"
# rename_script: cp "target/$TARGET/release/$BIN" "${BIN}-${TARGET}"
- &build_lib_unix
build_script: |
args=""
if [ -n "${FEATURES:-}" ]; then
args="--features $FEATURES"
fi
if [ -n "${NO_DEFAULT_FEATURES:-}" ]; then
args="$args --no-default-features"
fi
if [ -n "${ALL_FEATURES:-}" ]; then
args="$args --all-features"
fi
#cargo make build-release "--lib=$LIB" "--target=$TARGET" $args
cargo build "--release --lib=$LIB" "--target=$TARGET" $args
- &cleanup_before_upload_cache_unix
cleanup_before_upload_cache_script: rm -rf "$CARGO_HOME/registry/index"
# END: cirrus-anchors.yml
env:
RUST_VERSION: stable
MIN_SUPPORTED_RUST_VERSION: 1.46.0 # Due to clap (if in const fn)
test_task:
name: test-${RUST_VERSION}-${TARGET}
alias: tests
only_if:
#$CIRRUS_BRANCH !=~ ".*\.tmp" && $CIRRUS_BRANCH != $CIRRUS_DEFAULT_BRANCH
$CIRRUS_BRANCH !=~ ".*\.tmp"
env:
matrix:
- RUST_VERSION: stable
- RUST_VERSION: nightly
- RUST_VERSION: $MIN_SUPPORTED_RUST_VERSION
allow_failures: $RUST_VERSION == 'nightly'
matrix:
- matrix:
- env:
TARGET: x86_64-unknown-freebsd
# Temporary workaround for error `error: sysinfo not supported on
# this platform` seen on FreeBSD platforms, affecting Rustup
#
# References: https://github.com/rust-lang/rustup/issues/2774
RUSTUP_IO_THREADS: 1
freebsd_instance:
image_family: freebsd-13-0
<<: *base_freebsd
<<: *install_target_unix
#test_bin_script: cargo make test-bin "--target=$TARGET"
#test_lib_script: cargo make test-lib "--target=$TARGET"
test_lib_script: cargo test "--target=$TARGET"
<<: *cleanup_before_upload_cache_unix
#build_bin_task:
# name: build-bin-${BIN}-${TARGET}.${EXT}
# alias: build-bins
# only_if:
# $CIRRUS_TAG != '' || $CIRRUS_BRANCH == 'staging' || $CIRRUS_BRANCH ==
# 'trying'
# env:
# BIN: fnichol-cime
# RUST_BACKTRACE: "1"
# matrix:
# - matrix:
# - env:
# matrix:
# - TARGET: arm-unknown-linux-gnueabihf
# STRIP: arm-linux-gnueabihf-strip
# - TARGET: aarch64-unknown-linux-gnu
# STRIP: aarch64-linux-gnu-strip
# - TARGET: i686-unknown-linux-gnu
# STRIP: x86_64-linux-gnu-strip
# - TARGET: i686-unknown-linux-musl
# STRIP: i686-linux-musl-strip
# - TARGET: x86_64-unknown-linux-gnu
# STRIP: strip
# - TARGET: x86_64-unknown-linux-musl
# STRIP: x86_64-linux-musl-strip
# EXT: tar.gz
# container:
# image: rustembedded/cross:$TARGET
# depends_on:
# - check
# - test-stable-x86_64-unknown-linux-gnu
# <<: *base_linux
# <<: *install_target_unix
# <<: *build_bin_unix
# archive_script: tar czf "$BIN-$TARGET.$EXT" "$BIN-$TARGET"
# - env:
# TARGET: x86_64-apple-darwin
# STRIP: strip
# EXT: zip
# osx_instance:
# image: catalina-base
# depends_on:
# - check
# - test-stable-x86_64-apple-darwin
# <<: *base_macos
# <<: *install_target_unix
# <<: *build_bin_unix
# archive_script: zip "$BIN-$TARGET" "$BIN-$TARGET"
# - env:
# # Temporary workaround for error `error: sysinfo not supported on
# # this platform` seen on FreeBSD platforms, affecting Rustup
# #
# # References: https://github.com/rust-lang/rustup/issues/2774
# RUSTUP_IO_THREADS: 1
# TARGET: x86_64-unknown-freebsd
# STRIP: strip
# EXT: tar.gz
# freebsd_instance:
# image_family: freebsd-11-4
# depends_on:
# - check
# - test-stable-x86_64-unknown-freebsd
# <<: *base_freebsd
# <<: *install_target_unix
# <<: *build_bin_unix
# archive_script: tar czf "$BIN-$TARGET.$EXT" "$BIN-$TARGET"
# checksums_script: ./.ci/build-checksums.sh "$BIN-$TARGET.$EXT"
# binaries_artifacts:
# path: "$BIN-$TARGET.$EXT*"
# <<: *cleanup_before_upload_cache_unix
# - env:
# TARGET: x86_64-pc-windows-msvc
# EXT: zip
# windows_container:
# image: fnichol/windowsservercore:ltsc2019-vs2019-vctools
# depends_on:
# - check
# - test-stable-x86_64-pc-windows-msvc
# <<: *base_windows
# <<: *install_target_windows
# <<: *build_bin_windows
# archive_script: |
# Compress-Archive "$env:BIN-$env:TARGET.exe" "$env:BIN-$env:TARGET.$env:EXT"
# checksums_script:
# .\.ci\build-checksums.ps1 "$env:BIN-$env:TARGET.$env:EXT"
# binaries_artifacts:
# path: "$BIN-$TARGET.$EXT*"
# <<: *cleanup_before_upload_cache_windows
#ci_finished_task:
# name: ci-finished
# depends_on:
# - check
# - tests
# #- build-bins
# container:
# image: alpine:3
# clone_script: mkdir -p "$CIRRUS_WORKING_DIR"
# success_script: /bin/true
#create_github_release_task:
# name: create-github-release
# only_if: $CIRRUS_TAG != ''
# depends_on:
# - build-bins
# container:
# image: alpine:3
# env:
# BIN: fnichol-cime
# GITHUB_TOKEN: ENCRYPTED[78c00056ec53c8575696ccc698a8252991e4805f2d8ab303c89a002f9e05aaf5c848f64c0335dc2892b3ac2318fcaa07]
# install_dependencies_script: apk add curl git jo jq
# create_github_release_script: |
# if ! upload_url="$(
# ./.ci/cirrus-release.sh gh_create_version_release \
# "$CIRRUS_REPO_FULL_NAME" \
# "$CIRRUS_TAG"
# )"; then
# echo "xxx Failed to create release" >&2
# exit 1
# fi
# echo "$upload_url" > /tmp/upload_url
# download_cirrus_artifacts_script: |
# cr="$(readlink -f ./.ci/cirrus-release.sh)"
# manifest="$(readlink -f ".ci/$BIN.manifest.txt")"
# mkdir -p /tmp/release
# cd /tmp/release
# awk '{ print $2 }' "$manifest" | while read -r a; do
# "$cr" ci_download "build-bin-$a/binaries/$a"
# "$cr" ci_download "build-bin-$a/binaries/$a.md5"
# "$cr" ci_download "build-bin-$a/binaries/$a.sha256"
# done
# cp "$manifest" .
# ls -l "$BIN"*
# upload_github_release_artifacts_script: |
# url="$(cat /tmp/upload_url)"
# ./.ci/cirrus-release.sh gh_upload_all "$url" /tmp/release
#
#build_docker_image_docker_builder:
# name: build-docker-image-${BIN}
# alias: build-docker-images
# only_if: $CIRRUS_TAG != ''
# depends_on:
# - build-bins
# - create-github-release
# env:
# AUTHOR: Fletcher Nichol <[email protected]>
# LICENSE: MPL-2.0
# BIN: fnichol-cime
# REPO: fnichol/$BIN
# IMG: $REPO
# TARGET: x86_64-unknown-linux-musl
# EXT: tar.gz
# ARCHIVE: $BIN-$TARGET.$EXT
# DOCKER_USERNAME: ENCRYPTED[3e38482137ca39fa18416c90a31e9567c6cde8506b30ddba7d083a3799a3d7e55a919976a74b50f47274e0b69233c507]
# DOCKER_PASSWORD: ENCRYPTED[5df55aa8c424d33286f8bfecdb710231fa00809ce41dc517bead679f863ec84c6a8147b93ea9e8888513f01d8f8351a7]
# download_cirrus_artifacts_script: |
# cr="$(readlink -f ./.ci/cirrus-release.sh)"
# mkdir -p /tmp/artifacts
# cd /tmp/artifacts
# "$cr" ci_download "build-bin-$ARCHIVE/binaries/$ARCHIVE"
# "$cr" ci_download "build-bin-$ARCHIVE/binaries/$ARCHIVE.sha256"
# build_script: |
# ./.ci/build-docker-image.sh \
# "$IMG" "${CIRRUS_TAG#v}" "$REPO" "$AUTHOR" "$LICENSE" "$BIN" \
# "/tmp/artifacts/$ARCHIVE"
# login_script: |
# echo "$DOCKER_PASSWORD" \
# | docker login --username "$DOCKER_USERNAME" --password-stdin
# push_script: |
# docker push "$IMG:${CIRRUS_TAG#v}"
# if echo "${CIRRUS_TAG#v}" | grep -q -E '^\d+\.\d+.\d+$'; then
# docker push "$IMG:latest"
# fi
#
#publish_crate_task:
# name: publish-crate-${CRATE}
# alias: publish-crates
# only_if: $CIRRUS_TAG =~ 'v.*'
# depends_on:
# - create-github-release
# - build-docker-images
# env:
# CRATE: fnichol-cime
# CRATES_IO_TOKEN: ENCRYPTED[0c6ba7d0bd264cf02d59451d0135eb215d2774a9eb86e89dd9bfb3cab6a1c4aaa48a69edfb3d0ae6f4850441e6e591bb]
# container:
# image: rust:latest
# <<: *base_linux
# login_script: echo "$CRATES_IO_TOKEN" | cargo login
# publish_script: cargo publish
#
#publish_github_release_task:
# name: publish-github-release
# only_if: $CIRRUS_TAG != ''
# depends_on:
# - create-github-release
# - build-docker-images
# - publish-crates
# container:
# image: alpine:3
# env:
# GITHUB_TOKEN: ENCRYPTED[78c00056ec53c8575696ccc698a8252991e4805f2d8ab303c89a002f9e05aaf5c848f64c0335dc2892b3ac2318fcaa07]
# install_dependencies_script: apk add curl jo jq
# publish_release_script: |
# ./.ci/cirrus-release.sh gh_publish_release \
# "$CIRRUS_REPO_FULL_NAME" "$CIRRUS_TAG" CHANGELOG.md
#
#release_finished_task:
# name: release-finished
# only_if: $CIRRUS_TAG != ''
# depends_on:
# - create-github-release
# - build-docker-images
# - publish-crates
# - publish-github-release
# container:
# image: alpine:3
# clone_script: mkdir -p "$CIRRUS_WORKING_DIR"
# success_script: /bin/true
#
#trigger_nightly_release_task:
# name: trigger-nightly-release
# only_if: $CIRRUS_CRON == 'nightly'
# container:
# image: alpine:3
# env:
# GITHUB_TOKEN: ENCRYPTED[78c00056ec53c8575696ccc698a8252991e4805f2d8ab303c89a002f9e05aaf5c848f64c0335dc2892b3ac2318fcaa07]
# install_dependencies_script: apk add curl git jo jq
# trigger_release_script:
# ./.ci/cirrus-release.sh gh_update_tag "$CIRRUS_REPO_FULL_NAME" nightly