-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (79 loc) · 2.73 KB
/
Copy pathci.yml
File metadata and controls
85 lines (79 loc) · 2.73 KB
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
name: CI
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
quality:
name: Format, lint, and test
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Rust 1.95
uses: dtolnay/rust-toolchain@4be7066ada62dd38de10e7b70166bc74ed198c30
with:
toolchain: 1.95.0
components: rustfmt, clippy
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run tests
run: cargo test --all-features --locked
native-release-build:
name: Build ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
- runner: macos-latest
target: x86_64-apple-darwin
- runner: macos-latest
target: aarch64-apple-darwin
- runner: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.runner }}
steps:
- name: Check out source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Rust 1.95 target
uses: dtolnay/rust-toolchain@4be7066ada62dd38de10e7b70166bc74ed198c30
with:
toolchain: 1.95.0
targets: ${{ matrix.target }}
- name: Ensure target standard library is installed
run: rustup target add ${{ matrix.target }} --toolchain 1.95.0
- name: Build release binary
run: cargo build --locked --release --target ${{ matrix.target }}
musl-static-smoke:
name: Build and inspect x86_64 MUSL
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Rust 1.95
uses: dtolnay/rust-toolchain@4be7066ada62dd38de10e7b70166bc74ed198c30
with:
toolchain: 1.95.0
- name: Install cross 0.2.5
run: cargo install cross --version 0.2.5 --locked
- name: Build MUSL release binary
run: cross build --locked --release --target x86_64-unknown-linux-musl
- name: Verify static linkage
shell: bash
run: |
binary=target/x86_64-unknown-linux-musl/release/cc-switchy
file "$binary"
if readelf -d "$binary" | grep -q '(NEEDED)'; then
echo 'MUSL binary unexpectedly has dynamic NEEDED entries' >&2
exit 1
fi
- name: Execute MUSL binary
run: target/x86_64-unknown-linux-musl/release/cc-switchy --version