diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..2b0faf5 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,23 @@ +name: Check + +on: + workflow_dispatch: + schedule: + - cron: '0 4 * * 3' + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + name: Check Rust Version + - run: make check + create_issue: + runs-on: ubuntu-latest + needs: check + if: always() && (needs.check.result == 'failure') + steps: + - run: gh issue create --title "Time to update to Rust" --body "Build update for next version of Rust" --label "enhancement" -R $GITHUB_REPOSITORY + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + \ No newline at end of file diff --git a/.gitignore b/.gitignore index 0c5b82d..cb01b5b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ tests/test-*/test-out.log target .DS_Store +.vscode diff --git a/Dockerfile b/Dockerfile index 1ba03c6..e4df896 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,7 @@ RUN yum install -y jq openssl-devel RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ | CARGO_HOME=/cargo RUSTUP_HOME=/rustup sh -s -- -y --profile minimal --default-toolchain $RUST_VERSION ADD build.sh /usr/local/bin/ +ADD latest.sh /usr/local/bin/ VOLUME ["/code"] WORKDIR /code ENTRYPOINT ["/usr/local/bin/build.sh"] diff --git a/Makefile b/Makefile index 3b101c4..23eccaf 100644 --- a/Makefile +++ b/Makefile @@ -25,3 +25,8 @@ debug: build -v ${HOME}/.cargo/git:/cargo/git \ --entrypoint=/bin/bash \ $(REPO):$(TAG) + +check: + $(DOCKER) run --rm \ + --entrypoint=/usr/local/bin/latest.sh \ + $(REPO) diff --git a/latest.sh b/latest.sh new file mode 100755 index 0000000..f39f922 --- /dev/null +++ b/latest.sh @@ -0,0 +1,15 @@ +#!/bin/bash -eux + +export CARGO_HOME="/cargo" +export RUSTUP_HOME="/rustup" + +# shellcheck disable=SC1091 +source /cargo/env + +rustup toolchain install stable --profile=minimal +STABLE=$(rustup check | grep stable | grep -E "[0-9]+\.[0-9]+\.[0-9]+" -o) +DEFAULT=$(rustup show | grep -m 1 default | grep -E "[0-9]+\.[0-9]+\.[0-9]+" -o) + +if [ "${STABLE}" == "${DEFAULT}" ]; then exit 0 + else exit 1 +fi