|
20 | 20 | # - Cargo.toml
|
21 | 21 | # - README.md
|
22 | 22 | rust_minver: 1.63.0
|
| 23 | + ci_targets: "['', 'x86_64-apple-ios', 'x86_64-unknown-freebsd', 'x86_64-unknown-illumos', 'aarch64-linux-android']" |
23 | 24 |
|
24 | 25 | defaults:
|
25 | 26 | run:
|
26 | 27 | shell: bash
|
27 | 28 |
|
28 | 29 | jobs:
|
| 30 | + matrix: |
| 31 | + strategy: |
| 32 | + fail-fast: false |
| 33 | + runs-on: ubuntu-latest |
| 34 | + outputs: |
| 35 | + ci_targets: ${{ steps.generate.outputs.ci_targets }} |
| 36 | + steps: |
| 37 | + - name: Generate matrix |
| 38 | + id: generate |
| 39 | + run: echo "ci_targets=${{ env.ci_targets }}" >> $GITHUB_OUTPUT |
| 40 | + |
29 | 41 | format:
|
30 | 42 | strategy:
|
31 | 43 | fail-fast: false
|
@@ -78,48 +90,56 @@ jobs:
|
78 | 90 | done
|
79 | 91 |
|
80 | 92 | clippy:
|
| 93 | + needs: [matrix] |
81 | 94 | strategy:
|
82 | 95 | fail-fast: false
|
83 | 96 | matrix:
|
84 | 97 | os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
|
| 98 | + target: ${{ fromJSON(needs.matrix.outputs.ci_targets) }} |
85 | 99 | runs-on: ${{ matrix.os }}
|
86 | 100 | steps:
|
87 | 101 | - name: Checkout repository
|
88 | 102 | uses: actions/checkout@v4
|
89 | 103 | - name: Install dependencies
|
90 | 104 | if: matrix.os == 'ubuntu-latest'
|
91 | 105 | run: sudo bash ./.github/workflows/install-deps.sh
|
| 106 | + - name: Install Rust target |
| 107 | + if: matrix.target != '' |
| 108 | + run: | |
| 109 | + rustup target add ${{ matrix.target }} |
| 110 | + echo 'cargo_target_arg="--target ${{ matrix.target }}' >> $GITHUB_ENV |
92 | 111 | - name: Install Rust nightly
|
93 | 112 | run: |
|
94 | 113 | rustup toolchain install nightly
|
95 | 114 | rustup component add clippy --toolchain nightly
|
96 | 115 | - name: Restore cargo caches
|
97 | 116 | uses: Swatinem/rust-cache@v2
|
98 | 117 | - name: Run clippy
|
99 |
| - run: cargo clippy --all-features --tests --examples -- -D warnings |
| 118 | + run: cargo clippy --all-features --tests --examples ${{ env.cargo_target_arg }} -- -D warnings |
100 | 119 | - name: Run clippy nightly
|
101 | 120 | run: |
|
102 |
| - cargo +nightly clippy --all-features --tests --examples |
| 121 | + cargo +nightly clippy --all-features --tests --examples ${{ env.cargo_target_arg }} |
103 | 122 |
|
104 |
| - WARNS=$(cargo +nightly clippy --all-features --tests --examples --message-format=json | jq -s '[.[] | select(.reason == "compiler-message")] | length') |
| 123 | + WARNS=$(cargo +nightly clippy --all-features --tests --examples --message-format=json ${{ env.cargo_target_arg }} | jq -s '[.[] | select(.reason == "compiler-message")] | length') |
105 | 124 | if [[ $WARNS -ne 0 ]]; then
|
106 | 125 | echo "::warning title=nightly clippy::Detected $WARNS warnings"
|
107 | 126 | fi
|
108 | 127 | - name: Run clippy nightly for benches
|
109 | 128 | run: |
|
110 |
| - cargo +nightly clippy --all-features --benches -- -A clippy::incompatible_msrv |
| 129 | + cargo +nightly clippy --all-features --benches ${{ env.cargo_target_arg }} -- -A clippy::incompatible_msrv |
111 | 130 |
|
112 |
| - WARNS=$(cargo +nightly clippy --all-features --benches --message-format=json -- -A clippy::incompatible_msrv | jq -s '[.[] | select(.reason == "compiler-message")] | length') |
| 131 | + WARNS=$(cargo +nightly clippy --all-features --benches --message-format=json ${{ env.cargo_target_arg }} -- -A clippy::incompatible_msrv | jq -s '[.[] | select(.reason == "compiler-message")] | length') |
113 | 132 | if [[ $WARNS -ne 0 ]]; then
|
114 | 133 | echo "::warning title=nightly clippy::Detected $WARNS warnings"
|
115 | 134 | fi
|
116 | 135 |
|
117 | 136 | check:
|
| 137 | + needs: [matrix] |
118 | 138 | strategy:
|
119 | 139 | fail-fast: false
|
120 | 140 | matrix:
|
121 | 141 | os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
|
122 |
| - target: ['', 'x86_64-apple-ios', 'x86_64-unknown-freebsd', 'x86_64-unknown-illumos', 'aarch64-linux-android'] |
| 142 | + target: ${{ fromJSON(needs.matrix.outputs.ci_targets) }} |
123 | 143 | runs-on: ${{ matrix.os }}
|
124 | 144 | steps:
|
125 | 145 | - name: Checkout repository
|
|
0 commit comments