check-nightly-version.sh 615 B

123456789101112131415161718
  1. #!/bin/bash
  2. set -euo pipefail
  3. IFS=$'\n\t'
  4. # Extract the nightly version from all the places we declared it in
  5. rust_toolchain="$(cat rust-toolchain)"
  6. travis_yml="$(cat .travis.yml | grep '^rust: ' | head -n 1 | sed -E 's/^rust: (nightly-[0-9]{4}-[0-9]{2}-[0-9]{2})$/\1/')"
  7. # Ensure all the configuration files points to the same nightly
  8. check() {
  9. if [[ "$2" != "${rust_toolchain}" ]]; then
  10. echo "error: the nightly version in $1 is different than the one in rust-toolchain!" 1>&2
  11. exit 1
  12. fi
  13. }
  14. check .travis.yml "${travis_yml}"
  15. echo "all the configuration files points to the same nightly!"