Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: change rust-toolchain file to toml format #2487

Merged
merged 10 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions .github/workflows/toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,20 @@ jobs:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3
- run: git config --global --add safe.directory "$PWD" # actions/runner#2033
- run: |
VERSION="$(cat rust-toolchain)"
if [ "$(cargo --version | cut -d' ' -f2)" != "$VERSION" ]; then
echo "::error file=rust-toolchain::rust-toolchain $VERSION does not match devcontainer $(cargo --version)"
VERSION_REGEX='channel = "([0-9]+\.[0-9]+\.[0-9]+)"'
TOOLCHAIN=$(cat rust-toolchain.toml)
if [[ $TOOLCHAIN =~ $VERSION_REGEX ]]; then
VERSION=${BASH_REMATCH[1]}
if [ "$(cargo --version | cut -d' ' -f2)" != "$VERSION" ]; then
echo "::error file=rust-toolchain.toml::rust-toolchain channel '$VERSION' does not match devcontainer '$(cargo --version)'"
exit 1
fi
else
echo "::error file=rust-toolchain.toml::failed to parse rust-toolchain.toml"
exit 1
fi
shell: bash


workflows:
runs-on: ubuntu-latest
Expand All @@ -32,15 +41,23 @@ jobs:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3
- shell: bash
run: |
VERSION="$(cat rust-toolchain)"
VERSION_REGEX='channel = "([0-9]+\.[0-9]+\.[0-9]+)"'
TOOLCHAIN=$(cat rust-toolchain.toml)
if [[ $TOOLCHAIN =~ $VERSION_REGEX ]]; then
VERSION=${BASH_REMATCH[1]}
else
echo "::error file=rust-toolchain.toml::failed to parse rust-toolchain.toml"
exit 1
fi

ex=0
while IFS= read -r file ; do
while IFS= read -r image ; do
if [[ "$image" =~ ^docker://(docker.io/library/)?rust: ]]; then
tag="${image##*rust:}"
v="${tag%%-*}"
if [[ "$v" != "$VERSION" ]]; then
echo "::warning file=$file::$file uses incorrect rust version: $v"
echo "::warning file=$file::$file uses incorrect rust version: '$v' (rust-toolchain.toml contains '$VERSION')"
ex=$((ex + 1))
fi
fi
Expand Down
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"rust-analyzer.cargo.features": [],
"files.insertFinalNewline": true
}
1 change: 0 additions & 1 deletion rust-toolchain

This file was deleted.

2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "1.69.0"