Skip to content

Commit 940fbc1

Browse files
author
007
committed
revise github workflow (ft Claude)
1 parent 0d3fdf8 commit 940fbc1

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

.github/workflows/rust.yml

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
uses: fkirc/[email protected]
3838
with:
3939
skip_after_successful_duplicate: "true"
40-
paths: '[".cargo/**", ".github/workflows/ci.yml", "sample_configs/**", "src/**", "tests/**", "build.rs", "Cargo.lock", "Cargo.toml", "clippy.toml", "rustfmt.toml", "Cross.toml"]'
40+
paths: '[".cargo/**", ".github/workflows/rust.yml", "sample_configs/**", "src/**", "tests/**", "build.rs", "Cargo.lock", "Cargo.toml", "clippy.toml", "rustfmt.toml", "Cross.toml"]'
4141
do_not_skip: '["workflow_dispatch", "push"]'
4242

4343
# Runs rustfmt + tests on the main supported platforms.
@@ -63,38 +63,43 @@ jobs:
6363
os: "ubuntu-latest",
6464
target: "i686-unknown-linux-gnu",
6565
cross: true,
66-
rust: stable,
6766
}
6867
- {
6968
os: "windows-2019",
7069
target: "x86_64-pc-windows-msvc",
7170
cross: false,
7271
}
72+
- {
73+
os: "macos-latest",
74+
target: "x86_64-apple-darwin",
75+
cross: false,
76+
}
77+
- {
78+
os: "macos-latest",
79+
target: "aarch64-apple-darwin",
80+
cross: false,
81+
}
7382
- {
7483
os: "ubuntu-latest",
7584
target: "x86_64-unknown-linux-musl",
7685
cross: true,
77-
rust: stable,
7886
}
7987
- {
8088
os: "ubuntu-latest",
8189
target: "i686-unknown-linux-musl",
8290
cross: true,
83-
rust: stable,
8491
}
8592
# armv6
8693
- {
8794
os: "ubuntu-latest",
8895
target: "arm-unknown-linux-musleabi",
8996
cross: true,
90-
rust: stable,
9197
}
9298
# arm5
9399
- {
94100
os: "ubuntu-latest",
95101
target: "armv5te-unknown-linux-musleabi",
96102
cross: true,
97-
rust: stable,
98103
}
99104
features: ["--all-features", "--no-default-features"]
100105
steps:
@@ -105,7 +110,7 @@ jobs:
105110
uses: dtolnay/rust-toolchain@stable
106111
with:
107112
toolchain: stable
108-
components: rustfmt
113+
components: rustfmt, clippy
109114
target: ${{ matrix.info.target }}
110115

111116
- name: Enable Rust cache
@@ -114,24 +119,26 @@ jobs:
114119
with:
115120
shared-key: build-cache-${{ matrix.info.target }}
116121

122+
- name: Install cross
123+
if: ${{ matrix.info.cross }}
124+
uses: taiki-e/install-action@v2
125+
with:
126+
tool: cross
127+
117128
- name: Check cargo fmt
118129
run: cargo fmt --all -- --check
119130

131+
- name: Run clippy
132+
if: ${{ !matrix.info.cross }}
133+
run: cargo clippy --all-features --target=${{ matrix.info.target }} -- -D warnings
134+
120135
- name: Build tests
121-
uses: actions-rs/[email protected]
122-
with:
123-
command: test
124-
args: --no-run --locked ${{ matrix.features }} --target=${{ matrix.info.target }}
125-
use-cross: ${{ matrix.info.cross }}
136+
run: ${{ matrix.info.cross && 'cross' || 'cargo' }} test --no-run --locked ${{ matrix.features }} --target=${{ matrix.info.target }}
126137
env:
127138
RUST_BACKTRACE: full
128139

129140
- name: Run tests
130-
uses: actions-rs/[email protected]
131-
with:
132-
command: test
133-
args: --no-fail-fast ${{ matrix.features }} --target=${{ matrix.info.target }} -- --nocapture --quiet
134-
use-cross: ${{ matrix.info.cross }}
141+
run: ${{ matrix.info.cross && 'cross' || 'cargo' }} test --no-fail-fast ${{ matrix.features }} --target=${{ matrix.info.target }} -- --nocapture --quiet
135142
env:
136143
RUST_BACKTRACE: full
137144

0 commit comments

Comments
 (0)