-
Notifications
You must be signed in to change notification settings - Fork 2
145 lines (133 loc) · 4.11 KB
/
rust.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
# Main CI workflow to validate PRs and branches are correctly formatted
# and pass tests.
#
# I took some of these workflows/jobs from
# https://github.com/ClementTsang/bottom
#
# - cargo fmt
# - cargo test (built/test in separate steps)
name: ci
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
env:
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 0
concurrency:
group: ${{ github.workflow }}-${{ github.event.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != '12932/cf_speedtest' }}
jobs:
# Check if things should be skipped.
pre-job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- name: Check if this action should be skipped
id: skip_check
uses: fkirc/[email protected]
with:
skip_after_successful_duplicate: "true"
paths: '[".cargo/**", ".github/workflows/ci.yml", "sample_configs/**", "src/**", "tests/**", "build.rs", "Cargo.lock", "Cargo.toml", "clippy.toml", "rustfmt.toml", "Cross.toml"]'
do_not_skip: '["workflow_dispatch", "push"]'
# Runs rustfmt + tests on the main supported platforms.
supported:
needs: pre-job
runs-on: ${{ matrix.info.os }}
if: ${{ needs.pre-job.outputs.should_skip != 'true' }}
strategy:
fail-fast: false
matrix:
info:
- {
os: "ubuntu-latest",
target: "x86_64-unknown-linux-gnu",
cross: false,
}
- {
os: "ubuntu-latest",
target: "aarch64-unknown-linux-gnu",
cross: true,
}
- {
os: "ubuntu-latest",
target: "i686-unknown-linux-gnu",
cross: true,
rust: stable,
}
- {
os: "windows-2019",
target: "x86_64-pc-windows-msvc",
cross: false,
}
- {
os: "ubuntu-latest",
target: "x86_64-unknown-linux-musl",
cross: true,
rust: stable,
}
- {
os: "ubuntu-latest",
target: "i686-unknown-linux-musl",
cross: true,
rust: stable,
}
# armv6
- {
os: "ubuntu-latest",
target: "arm-unknown-linux-musleabi",
cross: true,
rust: stable,
}
# arm5
- {
os: "ubuntu-latest",
target: "armv5te-unknown-linux-musleabi",
cross: true,
rust: stable,
}
features: ["--all-features", "--no-default-features"]
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt
target: ${{ matrix.info.target }}
- name: Enable Rust cache
uses: Swatinem/[email protected]
if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }} # If it is a PR, only if not a fork
with:
shared-key: build-cache-${{ matrix.info.target }}
- name: Check cargo fmt
run: cargo fmt --all -- --check
- name: Build tests
uses: actions-rs/[email protected]
with:
command: test
args: --no-run --locked ${{ matrix.features }} --target=${{ matrix.info.target }}
use-cross: ${{ matrix.info.cross }}
env:
RUST_BACKTRACE: full
- name: Run tests
uses: actions-rs/[email protected]
with:
command: test
args: --no-fail-fast ${{ matrix.features }} --target=${{ matrix.info.target }} -- --nocapture --quiet
use-cross: ${{ matrix.info.cross }}
env:
RUST_BACKTRACE: full
completion:
name: "CI Pass Check"
needs: [supported]
runs-on: "ubuntu-latest"
steps:
- name: CI Passed
run: |
echo "CI workflow completed."