Skip to content

Commit ea151bd

Browse files
committed
ci: fixe o toolchain do Rust e rode só os checks que cada workflow afeta
O CI instalava o Rust stable do dia, então cada release nova do Rust podia quebrar PRs que não mexem em código: o 1.100 trouxe lints novos do clippy e derrubou até atualizações só de Actions. O toolchain agora fica fixo no rust-toolchain.toml (1.100.0), todos os workflows instalam essa versão, e o Dependabot abre um PR próprio quando sair outra. O filtro de caminhos também rodava tudo a qualquer mudança em .github/workflows/. Agora só o ci.yml roda tudo; cada workflow reutilizável liga só o próprio check, e qualquer workflow liga o CodeQL, que analisa os Actions. Signed-off-by: NullSablex <244216261+NullSablex@users.noreply.github.com>
1 parent d94132b commit ea151bd

5 files changed

Lines changed: 35 additions & 28 deletions

File tree

‎.github/dependabot.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,10 @@ updates:
4242
open-pull-requests-limit: 5
4343
commit-message:
4444
prefix: docs(deps)
45+
46+
- package-ecosystem: rust-toolchain
47+
directory: /
48+
schedule:
49+
interval: weekly
50+
commit-message:
51+
prefix: build(toolchain)

‎.github/workflows/ci.yml‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,20 @@ jobs:
5656
files=''
5757
fi
5858
printf 'Changed files:\n%s\n' "${files:-(full run)}"
59-
# CI definitions affect every check, so they run everything.
60-
if grep -qE '^\.github/workflows/' <<< "$files"; then all=true; fi
59+
# ci.yml decides what runs, so a change to it runs everything. Each
60+
# reusable workflow only triggers its own check (see the patterns
61+
# below), and any workflow triggers CodeQL, which analyzes Actions.
62+
if grep -qE '^\.github/workflows/ci\.yml$' <<< "$files"; then all=true; fi
6163
match() {
6264
if [ "$all" = true ] || grep -qE "$1" <<< "$files"; then echo true; else echo false; fi
6365
}
64-
rust=$(match '^(src/|tests/|include/|build\.rs$|Cargo\.(toml|lock)$|\.cargo/|rust-toolchain\.toml$)')
66+
rust=$(match '(^(src/|tests/|include/|build\.rs$|Cargo\.(toml|lock)$|\.cargo/|rust-toolchain\.toml$)|^\.github/workflows/rust\.yml$)')
67+
workflows=$(match '^\.github/(workflows/|codeql/)')
6568
{
6669
echo "rust=$rust"
67-
echo "docs=$(match '^(docs/|zensical\.toml$|requirements-docs\.txt$)')"
68-
echo "audit=$(match '^Cargo\.lock$')"
69-
if [ "$rust" = true ] || [ "$all" = true ]; then echo codeql=true; else echo codeql=false; fi
70+
echo "docs=$(match '(^(docs/|zensical\.toml$|requirements-docs\.txt$)|^\.github/workflows/docs\.yml$)')"
71+
echo "audit=$(match '(^Cargo\.lock$|^\.github/workflows/audit\.yml$)')"
72+
if [ "$rust" = true ] || [ "$workflows" = true ] || [ "$all" = true ]; then echo codeql=true; else echo codeql=false; fi
7073
} | tee -a "$GITHUB_OUTPUT"
7174
7275
rust:

‎.github/workflows/release.yml‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ jobs:
3434
exit 1
3535
fi
3636
37-
- name: Install Rust
38-
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
39-
with:
40-
toolchain: stable
41-
targets: i686-unknown-linux-gnu,i686-pc-windows-msvc
37+
- name: Install pinned Rust toolchain
38+
run: |
39+
rustup toolchain install
40+
rustup target add i686-unknown-linux-gnu i686-pc-windows-msvc
4241
4342
- name: Install cross-compilation tools
4443
run: |

‎.github/workflows/rust.yml‎

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v7
2323

24-
- name: Install Rust (stable + clippy)
25-
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
26-
with:
27-
toolchain: stable
28-
targets: i686-unknown-linux-gnu
29-
components: clippy
24+
- name: Install pinned Rust toolchain
25+
run: |
26+
rustup toolchain install
27+
rustup target add i686-unknown-linux-gnu
3028
3129
- name: Install cross-compilation tools
3230
run: |
@@ -51,11 +49,8 @@ jobs:
5149
contents: read
5250
steps:
5351
- uses: actions/checkout@v7
54-
- name: Install Rust (stable + rustfmt)
55-
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
56-
with:
57-
toolchain: stable
58-
components: rustfmt
52+
- name: Install pinned Rust toolchain
53+
run: rustup toolchain install
5954
- run: cargo fmt --all -- --check
6055

6156
coverage:
@@ -66,12 +61,11 @@ jobs:
6661
steps:
6762
- uses: actions/checkout@v7
6863

69-
- name: Install Rust (stable + llvm-tools)
70-
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
71-
with:
72-
toolchain: stable
73-
targets: i686-unknown-linux-gnu
74-
components: llvm-tools-preview
64+
- name: Install pinned Rust toolchain
65+
run: |
66+
rustup toolchain install
67+
rustup target add i686-unknown-linux-gnu
68+
rustup component add llvm-tools-preview
7569
7670
- name: Install cross-compilation tools
7771
run: |

‎rust-toolchain.toml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[toolchain]
2+
channel = "1.100.0"
3+
profile = "minimal"
4+
components = ["clippy", "rustfmt"]

0 commit comments

Comments
 (0)