-
Notifications
You must be signed in to change notification settings - Fork 12
145 lines (126 loc) · 4.68 KB
/
latest-dependencies.yaml
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
name: latest-dependencies
permissions:
contents: read
on:
pull_request:
push:
branches:
- main
schedule:
# Weekly, i.e. on Monday at 03:20 UTC
- cron: "20 3 * * 1"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUST_BACKTRACE: short
jobs:
run:
strategy:
fail-fast: false # don't give up on the whole matrix if one variant fails
matrix:
# Keep list of targets in sync with `test.yaml`.
include:
- target: aarch64-apple-darwin
# M1 runner on macos-14
runner_os: macos-14
default_target: true
runnable: true
- target: armv7-unknown-linux-gnueabihf
runner_os: ubuntu-latest
default_target: false
runnable: false
- target: x86_64-apple-darwin
runner_os: macos-latest
default_target: true
runnable: true
- target: x86_64-unknown-linux-gnu
runner_os: ubuntu-latest
default_target: true
runnable: true
- target: x86_64-unknown-linux-musl
runner_os: ubuntu-latest
default_target: false
runnable: true
- target: x86_64-pc-windows-msvc
runner_os: windows-latest
default_target: true
runnable: true
runs-on: ${{ matrix.runner_os }}
steps:
- name: Install build tools for musl libc
if: matrix.target == 'x86_64-unknown-linux-musl'
# To avoid HTTP 404 when package index has been updated, we run `update` first.
run: >-
sudo apt -y update &&
sudo apt -y install musl-tools
- name: Install build tools for ARMv7
if: matrix.target == 'armv7-unknown-linux-gnueabihf'
# To avoid HTTP 404 when package index has been updated, we run `update` first.
run: >-
sudo apt -y update &&
sudo apt -y install gcc-arm-linux-gnueabihf
- name: Install Rust toolchain
# Use latest stable Rust version.
uses: dtolnay/rust-toolchain@stable
with:
# This target also needs to be specified explicitly in every build step!
# Otherwise the default toolchain might be used unintentionally.
targets: ${{ matrix.target }}
- name: Install Cargo helpers
run: >-
cargo install cargo-hack
# Check out the repository before the remaining steps that depend on it.
# All preceding steps are independent of the repository contents.
- name: Check out repository
uses: actions/checkout@v4
- name: Cache Rust toolchain and build artifacts
uses: Swatinem/rust-cache@v2
with:
# The cache should not be shared between different workflows, jobs, and targets.
shared-key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.target }}
- name: Update Rust to latest version
run: >-
rustup update
- name: Update crates to latest versions
run: >-
cargo update --verbose
- name: Build with feature combinations
run: >-
cargo hack --each-feature build --locked
--target ${{ matrix.target }}
- name: Run tests (bins/lib/tests/examples) with feature combinations
if: matrix.runnable
run: >-
cargo hack --each-feature test --locked
--target ${{ matrix.target }}
--bins --lib --tests --examples
# Compile and run doctests, which have been excluded in the previous
# step(s).
#
# Doctests may use any features and there is no easy way to activate
# certain features only for some doctests, so we run them without
# `cargo-hack`.
#
# When cross-compiling the doctests are skipped silently, even with the
# default target options that should include them!
#
# See https://github.com/rust-lang/cargo/issues/7040 for an (unstable)
# feature flag that should one day allow us to cross-compile doctests.
#
# For now, we cannot cross-compile doctests and must always run them on
# the runner's native platform.
- name: Run doctests with all features enabled
if: matrix.default_target
run: >-
cargo test --locked --all-features
--doc
- name: Build package with all features enabled
# We allow dirty state here because it is only expected after update.
run: >-
cargo package --locked --all-features --allow-dirty
--target ${{ matrix.target }}