-
-
Notifications
You must be signed in to change notification settings - Fork 4
160 lines (152 loc) · 7.79 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
on: [push, pull_request]
name: Continuous integration
env:
CI: 1
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
RUSTFLAGS: "-D warnings -W bare-trait-objects"
NIGHTLY_VERSION: "nightly-2023-02-09"
ZIG_VERSION: "0.11.0"
jobs:
all:
name: Build on ${{ matrix.os }}, ${{ matrix.target }} (audit=${{ matrix.audit || 'false' }}, rustfmt=${{ matrix.rustfmt || 'false' }}, no_build_tests=${{ matrix.no_build_tests || 'false' }}, no_run_tests=${{ matrix.no_run_tests || 'false' }}, no_release_build=${{ matrix.no_release_build || 'false' }}, zigbuild=${{ matrix.zigbuild || 'false' }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# GNU/Linux
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
audit: true
rustfmt: true
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: ubuntu-latest
target: i686-unknown-linux-gnu
zigbuild: true
- os: ubuntu-latest
target: riscv64gc-unknown-linux-gnu
no_build_tests: true # NOTE: Relocations in generic ELF (EM: 243)
no_release_build: true # NOTE: Relocations in generic ELF (EM: 243)
zigbuild: true # NOTE: tests linking fail with "error: unknown directive .cfi_label .Ldummy"
# - os: ubuntu-latest
# target: i686-unknown-linux-musl # NOTE: target 'i686-unknown-linux-musl' not found in channel
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu # NOTE: Relocations in generic ELF (EM: 183)
zigbuild: true
- os: ubuntu-latest
target: aarch64-unknown-linux-musl # NOTE: Relocations in generic ELF (EM: 183)
zigbuild: true
# - os: ubuntu-latest
# target: riscv64gc-unknown-linux-musl # NOTE: toolchain ... does not contain component 'rust-std' for target
# macOS
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
no_run_tests: true # NOTE: Bad CPU type in executable (os error 86)
# Windows
- os: windows-latest
target: x86_64-pc-windows-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: windows-latest
target: i686-pc-windows-msvc
- os: windows-latest
target: i686-pc-windows-gnu
zigbuild: true
- os: windows-latest
target: aarch64-pc-windows-msvc
no_build_tests: true # NOTE: could not execute process
#zigbuild: true # NOTE: tests linking fails with "zig.exe: InvalidUtf8 error: UnableToSpawnSelf"
# - os: windows-latest
# target: aarch64-pc-windows-gnullvm # NOTE: can't find crate for `core`
# FreeBSD
- os: ubuntu-latest
target: x86_64-unknown-freebsd
no_build_tests: true # NOTE: ld: cannot find -lexecinfo: No such file or directory
no_release_build: true # NOTE: ld: cannot find -lexecinfo: No such file or directory
#zigbuild: true # NOTE: tests linking fails "unsupported target 'x86_64-unknown-freebsd'"
# - os: ubuntu-latest
# target: i686-unknown-freebsd # NOTE: target 'i686-unknown-freebsd' not found in channel
# - os: ubuntu-latest
# target: aarch64-unknown-freebsd # NOTE: toolchain ... does not contain component 'rust-std' for target
# - os: ubuntu-latest
# target: riscv64gc-unknown-freebsd # NOTE: toolchain ... does not contain component 'rust-std' for target
# NetBSD
- os: ubuntu-latest
target: x86_64-unknown-netbsd
no_build_tests: true # NOTE: ld: cannot find -lexecinfo: No such file or directory
no_release_build: true # NOTE: ld: cannot find -lexecinfo: No such file or directory
#zigbuild: true # NOTE: tests linking fails "Error: unsupported target 'x86_64-unknown-netbsd'"
# - os: ubuntu-latest
# target: i686-unknown-netbsd # NOTE: toolchain ... does not contain component 'rust-std' for target
# - os: ubuntu-latest
# target: aarch64-unknown-netbsd # NOTE: toolchain ... does not contain component 'rust-std' for target
# - os: ubuntu-latest
# target: aarch64_be-unknown-netbsd # NOTE: toolchain ... does not contain component 'rust-std' for target
# - os: ubuntu-latest
# target: riscv64gc-unknown-netbsd # NOTE: toolchain ... does not contain component 'rust-std' for target
# OpenBSD
# - os: ubuntu-latest
# target: x86_64-unknown-openbsd # NOTE: toolchain ... does not contain component 'rust-std' for target
# - os: ubuntu-latest
# target: i686-unknown-openbsd # NOTE: toolchain ... does not contain component 'rust-std' for target
# - os: ubuntu-latest
# target: aarch64-unknown-openbsd # NOTE: toolchain ... does not contain component 'rust-std' for target
# - os: ubuntu-latest
# target: riscv64gc-unknown-openbsd # NOTE: toolchain ... does not contain component 'rust-std' for target
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
run: |
rustup update --no-self-update
rustup target add ${{ matrix.target }}
rustup install --force-non-host $(cat rust-toolchain)-${{ matrix.target }}
rustup default $(cat rust-toolchain)-${{ matrix.target }}
rustup component add clippy rust-src
- name: Install Nightly and Rustfmt
if: ${{ matrix.rustfmt }}
run: |
rustup install "${NIGHTLY_VERSION}"
rustup component add --toolchain "${NIGHTLY_VERSION}" rustfmt
- name: Install Zig
if: ${{ matrix.zigbuild }}
uses: korandoru/setup-zig@v1
with:
zig-version: ${{ env.ZIG_VERSION }}
- run: zig version
if: ${{ matrix.zigbuild }}
- name: Install Zigbuild
if: ${{ matrix.zigbuild }}
run: cargo install --locked cargo-zigbuild
- name: Check vulnerabilities with existing patches
if: ${{ matrix.audit }}
run: |
ISSUES_WITHOUT_PATCHES=($(cargo audit --json | jq --raw-output '.vulnerabilities.list[] | select(.versions.patched | length == 0) | .advisory.id' | sed 's!^! --ignore !' | tr -d '\n'))
cargo audit ${ISSUES_WITHOUT_PATCHES[@]}
- name: Rustfmt
if: ${{ matrix.rustfmt }}
run: cargo "+${NIGHTLY_VERSION}" fmt --all -- --check
- name: Check
run: cargo check --locked --verbose --all-features --target=${{ matrix.target }}
- name: Clippy
run: cargo clippy -- -D warnings -D clippy::dbg_macro -D clippy::print_stderr -D clippy::print_stdout
- name: Build Tests
if: ${{ !matrix.no_build_tests && !matrix.zigbuild }}
run: cargo test --no-run --locked --verbose --all-features --target=${{ matrix.target }}
- name: Zigbuild Tests
if: ${{ !matrix.no_build_tests && matrix.zigbuild }}
run: cargo zigbuild --tests --locked --verbose --all-features --target=${{ matrix.target }}
- name: Run Tests
if: ${{ !matrix.no_build_tests && !matrix.no_run_tests && !matrix.zigbuild }}
run: cargo test --locked --verbose --all-features --target=${{ matrix.target }}
- name: Build Release
if: ${{ !matrix.no_release_build && !matrix.zigbuild }}
run: cargo build --locked --verbose --all-features --release --target=${{ matrix.target }}
- name: Zigbuild Release
if: ${{ !matrix.no_release_build && matrix.zigbuild }}
run: cargo zigbuild --locked --verbose --all-features --release --target=${{ matrix.target }}