Merge pull request #1158 from miles170/ci-update-actions

CI: update actions to run on Node 16
This commit is contained in:
David Peter 2022-11-14 07:12:19 +01:00 committed by GitHub
commit 45cb15d60f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 45 additions and 47 deletions

View File

@ -19,51 +19,40 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Checkout source code - name: Checkout source code
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Install rust toolchain - name: Install rust toolchain
uses: actions-rs/toolchain@v1 run: |
with: rm -f "${HOME}/.cargo/bin/"{rustfmt,cargo-fmt}
toolchain: stable rustup set profile minimal
default: true rustup toolchain install stable -c "clippy,rustfmt"
profile: minimal # minimal component installation (ie, no documentation) rustup default stable
components: clippy, rustfmt - name: Rust cache
uses: Swatinem/rust-cache@v2
- name: Ensure `cargo fmt` has been run - name: Ensure `cargo fmt` has been run
uses: actions-rs/cargo@v1 run: cargo fmt --check
with:
command: fmt
args: -- --check
- name: Ensure MSRV is set in `clippy.toml` - name: Ensure MSRV is set in `clippy.toml`
run: grep "^msrv = \"${{ env.MIN_SUPPORTED_RUST_VERSION }}\"\$" clippy.toml run: grep "^msrv = \"${{ env.MIN_SUPPORTED_RUST_VERSION }}\"\$" clippy.toml
- name: Run clippy - name: Run clippy
uses: actions-rs/cargo@v1 run: cargo clippy --locked --all-targets --all-features
with:
command: clippy
args: --locked --all-targets --all-features
min_version: min_version:
name: Minimum supported rust version name: Minimum supported rust version
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Checkout source code - name: Checkout source code
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Install rust toolchain (v${{ env.MIN_SUPPORTED_RUST_VERSION }}) - name: Install rust toolchain (v${{ env.MIN_SUPPORTED_RUST_VERSION }})
uses: actions-rs/toolchain@v1 run: |
with: rustup set profile minimal
toolchain: ${{ env.MIN_SUPPORTED_RUST_VERSION }} rustup toolchain install ${{ env.MIN_SUPPORTED_RUST_VERSION }} -c clippy
default: true rustup default ${{ env.MIN_SUPPORTED_RUST_VERSION }}
components: clippy - name: Rust cache
profile: minimal uses: Swatinem/rust-cache@v2
- name: Run clippy (on minimum supported rust version to prevent warnings we can't fix) - name: Run clippy (on minimum supported rust version to prevent warnings we can't fix)
uses: actions-rs/cargo@v1 run: cargo clippy --locked --all-targets --all-features
with:
command: clippy
args: --locked --all-targets --all-features
- name: Run tests - name: Run tests
uses: actions-rs/cargo@v1 run: cargo test --locked
with:
command: test
args: --locked
build: build:
name: ${{ matrix.job.os }} (${{ matrix.job.target }}) name: ${{ matrix.job.os }} (${{ matrix.job.target }})
@ -86,7 +75,7 @@ jobs:
- { os: windows-2019, target: x86_64-pc-windows-msvc } - { os: windows-2019, target: x86_64-pc-windows-msvc }
steps: steps:
- name: Checkout source code - name: Checkout source code
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Install prerequisites - name: Install prerequisites
shell: bash shell: bash
@ -105,12 +94,11 @@ jobs:
echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV
- name: Install Rust toolchain - name: Install Rust toolchain
uses: actions-rs/toolchain@v1 run: |
with: rustup set profile minimal
toolchain: stable rustup toolchain install stable
target: ${{ matrix.job.target }} rustup override set stable
override: true rustup target add ${{ matrix.job.target }}
profile: minimal # minimal component installation (ie, no documentation)
- name: Show version information (Rust, cargo, GCC) - name: Show version information (Rust, cargo, GCC)
shell: bash shell: bash
@ -122,12 +110,26 @@ jobs:
cargo -V cargo -V
rustc -V rustc -V
- name: Build - name: Set cargo cmd
uses: actions-rs/cargo@v1 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: with:
use-cross: ${{ matrix.job.use-cross }} key: ${{ matrix.job.os }}-${{ matrix.job.target }}
command: build
args: --locked --release --target=${{ 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 - name: Strip debug information from executable
id: strip id: strip
@ -175,11 +177,7 @@ jobs:
echo "CARGO_TEST_OPTIONS=${CARGO_TEST_OPTIONS}" >> $GITHUB_OUTPUT echo "CARGO_TEST_OPTIONS=${CARGO_TEST_OPTIONS}" >> $GITHUB_OUTPUT
- name: Run tests - name: Run tests
uses: actions-rs/cargo@v1 run: ${{ env.CARGO_CMD }} test --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}}
with:
use-cross: ${{ matrix.job.use-cross }}
command: test
args: --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}}
- name: Generate completions - name: Generate completions
id: completions id: completions