From 8b161053067de96565195f992d1405fd4bcce89d Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Mon, 4 Apr 2022 08:51:09 +0200 Subject: [PATCH] Allow specifying Rust version --- README.md | 50 ++++++++++++++++++++++++++++++++++---------------- action.yml | 5 +++++ entrypoint.sh | 11 ++++++++++- 3 files changed, 49 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index ef1f7b1..d08945d 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,24 @@ jobs: arguments: --all-features ``` +### Use specific Rust version + +```yaml +name: CI +on: [push, pull_request] +jobs: + cargo-deny: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: EmbarkStudios/cargo-deny-action@v1 + with: + rust-version: "1.59.0" + log-level: warn + command: check + arguments: --all-features +``` + ### Recommended pipeline to avoid sudden breakages ```yaml @@ -77,20 +95,20 @@ jobs: Repositories using this action (PR to add your repo): -- [ash-molten](https://github.com/EmbarkStudios/ash-molten) -- [asn1rs](https://github.com/kellerkindt/asn1rs) -- [cargo-about](https://github.com/EmbarkStudios/cargo-about) -- [cargo-fetcher](https://github.com/EmbarkStudios/cargo-fetcher) -- [glam-rs](https://github.com/bitshifter/glam-rs) -- [linkerd2-proxy](https://github.com/linkerd/linkerd2-proxy) -- [PackSquash](https://github.com/ComunidadAylas/PackSquash) -- [physx-rs](https://github.com/EmbarkStudios/physx-rs) -- [smush](https://github.com/gwihlidal/smush-rs) -- [tame-gcs](https://github.com/EmbarkStudios/tame-gcs) -- [tame-oauth](https://github.com/EmbarkStudios/tame-oauth) -- [texture-synthesis](https://github.com/EmbarkStudios/texture-synthesis) -- [tonic](https://github.com/hyperium/tonic) -- ⚡️[dotenv-linter](https://github.com/dotenv-linter/dotenv-linter) +* [ash-molten](https://github.com/EmbarkStudios/ash-molten) +* [asn1rs](https://github.com/kellerkindt/asn1rs) +* [cargo-about](https://github.com/EmbarkStudios/cargo-about) +* [cargo-fetcher](https://github.com/EmbarkStudios/cargo-fetcher) +* [glam-rs](https://github.com/bitshifter/glam-rs) +* [linkerd2-proxy](https://github.com/linkerd/linkerd2-proxy) +* [PackSquash](https://github.com/ComunidadAylas/PackSquash) +* [physx-rs](https://github.com/EmbarkStudios/physx-rs) +* [smush](https://github.com/gwihlidal/smush-rs) +* [tame-gcs](https://github.com/EmbarkStudios/tame-gcs) +* [tame-oauth](https://github.com/EmbarkStudios/tame-oauth) +* [texture-synthesis](https://github.com/EmbarkStudios/texture-synthesis) +* [tonic](https://github.com/hyperium/tonic) +* ⚡️[dotenv-linter](https://github.com/dotenv-linter/dotenv-linter) ## Contributing @@ -102,8 +120,8 @@ Please read our [Contributor Guide](CONTRIBUTING.md) for more information on how Licensed under either of -* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) -* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) +* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or ) +* MIT license ([LICENSE-MIT](LICENSE-MIT) or ) at your option. diff --git a/action.yml b/action.yml index 2ab319f..5cec7a6 100644 --- a/action.yml +++ b/action.yml @@ -19,11 +19,16 @@ inputs: description: "The log level for cargo-deny" required: false default: "warn" + rust-version: + description: "The Rust version that is updated to before running cargo deny" + required: false + default: "" runs: using: "docker" image: "Dockerfile" args: + - ${{ inputs.rust-version }} - --log-level - ${{ inputs.log-level }} - ${{ inputs.arguments }} diff --git a/entrypoint.sh b/entrypoint.sh index 5db0113..f6251a4 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,14 @@ #!/bin/sh -l +set -e PATH=$PATH:/usr/local/cargo/bin -cargo-deny $* +if [ -n "$1" ] +then + rustup set profile minimal + rustup default "$1" +fi + +shift + +cargo-deny "$@"