Toolchain Freshness #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Toolchain Freshness | |
| on: | |
| schedule: | |
| - cron: "0 9 * * 1" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| rust-stable-check: | |
| name: rust-toolchain.toml matches latest stable | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Compare pinned version with latest stable | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| tmp="$(mktemp)" | |
| curl -fsSL -o "$tmp" https://static.rust-lang.org/dist/channel-rust-stable.toml | |
| read -r pinned latest <<<"$(python3 - "$tmp" <<'PY' | |
| import sys, tomllib | |
| from pathlib import Path | |
| toolchain = tomllib.loads(Path("rust-toolchain.toml").read_text()) | |
| pinned = toolchain["toolchain"]["channel"] | |
| manifest = tomllib.loads(Path(sys.argv[1]).read_text()) | |
| latest = manifest["pkg"]["rust"]["version"].split()[0] | |
| print(pinned, latest) | |
| PY | |
| )" | |
| rm -f "$tmp" | |
| echo "Pinned rust-toolchain.toml channel: $pinned" | |
| echo "Latest stable Rust release: $latest" | |
| if [ "$pinned" != "$latest" ]; then | |
| echo "::error::rust-toolchain.toml is $pinned, latest stable is $latest" | |
| exit 1 | |
| fi |