This repository was archived by the owner on Apr 5, 2024. It is now read-only.
File tree 2 files changed +59
-1
lines changed
2 files changed +59
-1
lines changed Original file line number Diff line number Diff line change 21
21
- name : Shellcheck
22
22
run : |
23
23
shellcheck --version
24
- shellcheck ci/*.sh
24
+ shellcheck ci/*.sh scripts/toolchain-version
25
25
26
26
- name : Update nightly
27
27
run : |
38
38
if rustup component add clippy rustc-dev; then
39
39
cargo clippy --all
40
40
fi
41
+
42
+ version_consistency_check :
43
+ name : Toolchain version consistency check
44
+ runs-on : ubuntu-latest
45
+ steps :
46
+ - uses : actions/checkout@v3
47
+ - name : Toolchain version consistency check
48
+ run : scripts/toolchain-version -c
49
+
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -eu
4
+
5
+
6
+ NIGHTLY_RE=" nightly-[0-9]{4}-[0-9]{2}-[0-9]{2}"
7
+
8
+ nightly_mentions () {
9
+ grep -Eo " $NIGHTLY_RE " " $1 " | sort --unique
10
+ }
11
+
12
+ check_versions_match () {
13
+ readarray -t versions_readme < <( nightly_mentions README.md)
14
+ if [[ " ${# versions_readme[@]} " -gt 1 ]]; then
15
+ echo " Multiple different nightly versions mentioned in README.md: ${versions_readme[*]} "
16
+ exit 1
17
+ fi
18
+
19
+ version_toolchain=$( nightly_mentions rust-toolchain)
20
+ if [[ " ${versions_readme[0]} " != " ${version_toolchain} " ]]; then
21
+ echo " Toolchain nightly version does not match README.md: ${version_toolchain} vs. ${versions_readme[0]} "
22
+ exit 1
23
+ fi
24
+ }
25
+
26
+ update_version_everywhere () {
27
+ if ! echo " $1 " | grep -Eq " $NIGHTLY_RE " ; then
28
+ echo " That doesn't look like a nightly version to me: '$1 '"
29
+ exit 1
30
+ fi
31
+
32
+ sed -i -E -e " s#${NIGHTLY_RE} #$1 #g" README.md rust-toolchain
33
+ }
34
+
35
+
36
+ while getopts " cu:" opt; do
37
+ case $opt in
38
+ c)
39
+ check_versions_match
40
+ ;;
41
+ u)
42
+ update_version_everywhere " $OPTARG "
43
+ ;;
44
+ * )
45
+ echo " Usage: $0 [-c | -u <nightly version> ]"
46
+ exit 1
47
+ ;;
48
+ esac
49
+ done
You can’t perform that action at this time.
0 commit comments