-
-
Notifications
You must be signed in to change notification settings - Fork 1
112 lines (92 loc) · 3.22 KB
/
ci.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
name: CI
on:
- push
- pull_request
jobs:
lint:
name: Run linters
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt, clippy
- name: Set up caching
uses: Swatinem/rust-cache@v2
- name: Run clippy linter
run: cargo clippy
- name: Run rustfmt check
run: cargo fmt -- --check
test-targets:
name: Test on ${{ matrix.target }} with Rust ${{ matrix.rust || 'stable' }}
strategy:
matrix:
include:
- { target: x86_64-unknown-linux-musl }
- { target: x86_64-unknown-linux-musl, rust: nightly }
- { target: x86_64-unknown-linux-musl, rust: '1.64' } # MSRV
- { target: x86_64-unknown-linux-gnu }
- { target: x86_64-apple-darwin, os: macos-latest }
- { target: aarch64-unknown-linux-musl }
- { target: aarch64-unknown-linux-gnu }
- { target: armv7-unknown-linux-musleabihf }
- { target: powerpc64le-unknown-linux-gnu }
- { target: riscv64gc-unknown-linux-gnu }
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
env:
CARGO: ${{ startsWith(matrix.target, 'x86_64') && 'cargo' || 'cross' }}
steps:
- uses: actions/checkout@v3
- name: Install Rust ${{ matrix.rust || 'stable' }} for ${{ matrix.target }}
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust || 'stable' }}
targets: ${{ matrix.target }}
- name: Set up caching
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}-${{ matrix.rust || 'stable' }}
- name: Install cross tool
if: ${{ !startsWith(matrix.target, 'x86_64') }}
run: cargo install cross
- name: Build
run: $CARGO build --target ${{ matrix.target }}
- name: Run tests
run: $CARGO test --target ${{ matrix.target }} --verbose
test-x86_64-alpine-musl:
name: Test on x86_64-alpine-linux-musl (dynamically linked)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Alpine Linux
uses: jirutka/setup-alpine@v1
with:
packages: build-base cargo zlib-ng-dev
- name: Build
run: cargo build --no-default-features --features flate2-zlib-ng,shell-timeout
shell: alpine.sh {0}
- name: Run tests
run: cargo test --no-default-features --features flate2-zlib-ng,shell-timeout --verbose
shell: alpine.sh {0}
test-features:
name: Test with --features ${{ matrix.features }}
runs-on: ubuntu-latest
strategy:
matrix:
features:
- shell-timeout
- flate2-zlib --no-default-features
- flate2-zlib-ng --no-default-features
steps:
- uses: actions/checkout@v3
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Set up caching
uses: Swatinem/rust-cache@v2
- run: cargo build --features ${{ matrix.features }}
- run: cargo test --features ${{ matrix.features }} --verbose