diff options
author | David Peter <sharkdp@users.noreply.github.com> | 2022-11-14 07:12:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-14 07:12:19 +0100 |
commit | 45cb15d60f2d152249c12f5b2f07b500d8210103 (patch) | |
tree | 2637f3215941072f056bd509af47cfc4822f7e95 /.github | |
parent | ce4e8675ed12d96be74de8e8bd7f9ba28b61c0ab (diff) | |
parent | fdab5da795cd8414062821d7cc5b03189cfb5b89 (diff) |
Merge pull request #1158 from miles170/ci-update-actions
CI: update actions to run on Node 16
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/CICD.yml | 92 |
1 files changed, 45 insertions, 47 deletions
diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index e1989c5..15d4fc6 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -19,51 +19,40 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout source code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - default: true - profile: minimal # minimal component installation (ie, no documentation) - components: clippy, rustfmt + run: | + rm -f "${HOME}/.cargo/bin/"{rustfmt,cargo-fmt} + rustup set profile minimal + rustup toolchain install stable -c "clippy,rustfmt" + rustup default stable + - name: Rust cache + uses: Swatinem/rust-cache@v2 - name: Ensure `cargo fmt` has been run - uses: actions-rs/cargo@v1 - with: - command: fmt - args: -- --check + run: cargo fmt --check - name: Ensure MSRV is set in `clippy.toml` run: grep "^msrv = \"${{ env.MIN_SUPPORTED_RUST_VERSION }}\"\$" clippy.toml - name: Run clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --locked --all-targets --all-features + run: cargo clippy --locked --all-targets --all-features min_version: name: Minimum supported rust version runs-on: ubuntu-20.04 steps: - name: Checkout source code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install rust toolchain (v${{ env.MIN_SUPPORTED_RUST_VERSION }}) - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ env.MIN_SUPPORTED_RUST_VERSION }} - default: true - components: clippy - profile: minimal + run: | + rustup set profile minimal + rustup toolchain install ${{ env.MIN_SUPPORTED_RUST_VERSION }} -c clippy + rustup default ${{ env.MIN_SUPPORTED_RUST_VERSION }} + - name: Rust cache + uses: Swatinem/rust-cache@v2 - name: Run clippy (on minimum supported rust version to prevent warnings we can't fix) - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --locked --all-targets --all-features + run: cargo clippy --locked --all-targets --all-features - name: Run tests - uses: actions-rs/cargo@v1 - with: - command: test - args: --locked + run: cargo test --locked build: name: ${{ matrix.job.os }} (${{ matrix.job.target }}) @@ -86,7 +75,7 @@ jobs: - { os: windows-2019, target: x86_64-pc-windows-msvc } steps: - name: Checkout source code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install prerequisites shell: bash @@ -105,12 +94,11 @@ jobs: echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: ${{ matrix.job.target }} - override: true - profile: minimal # minimal component installation (ie, no documentation) + run: | + rustup set profile minimal + rustup toolchain install stable + rustup override set stable + rustup target add ${{ matrix.job.target }} - name: Show version information (Rust, cargo, GCC) shell: bash @@ -122,12 +110,26 @@ jobs: cargo -V rustc -V - - name: Build - uses: actions-rs/cargo@v1 + - name: Set cargo cmd + shell: bash + run: echo "CARGO_CMD=cargo" >> $GITHUB_ENV + + - name: Set cargo cmd to cross + shell: bash + if: ${{ matrix.job.use-cross == true }} + run: echo "CARGO_CMD=cross" >> $GITHUB_ENV + + - name: Rust cache + uses: Swatinem/rust-cache@v2 with: - use-cross: ${{ matrix.job.use-cross }} - command: build - args: --locked --release --target=${{ matrix.job.target }} + key: ${{ matrix.job.os }}-${{ matrix.job.target }} + + - name: Install cross + if: ${{ matrix.job.use-cross == true }} + run: cargo install cross + + - name: Build + run: ${{ env.CARGO_CMD }} build --locked --release --target=${{ matrix.job.target }} - name: Strip debug information from executable id: strip @@ -175,11 +177,7 @@ jobs: echo "CARGO_TEST_OPTIONS=${CARGO_TEST_OPTIONS}" >> $GITHUB_OUTPUT - name: Run tests - uses: actions-rs/cargo@v1 - with: - use-cross: ${{ matrix.job.use-cross }} - command: test - args: --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} + run: ${{ env.CARGO_CMD }} test --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} - name: Generate completions id: completions |