Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Run direct-minimal-versions tests on a weekly basis #174

Run direct-minimal-versions tests on a weekly basis

Run direct-minimal-versions tests on a weekly basis #174

Workflow file for this run

# This file is generated by .github/cue/ci_tool.cue; DO NOT EDIT!
name: rust
"on":
pull_request:
branches:
- main
merge_group:
types:
- checks_requested
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUSTFLAGS: -D warnings
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
changes:
name: detect file changes
permissions:
pull-requests: read
runs-on: ubuntu-latest
outputs:
github-actions: ${{ steps.filter.outputs.github-actions }}
github-actions_files: ${{ steps.filter.outputs.github-actions_files }}
markdown: ${{ steps.filter.outputs.markdown }}
markdown_files: ${{ steps.filter.outputs.markdown_files }}
rust: ${{ steps.filter.outputs.rust }}
rust_files: ${{ steps.filter.outputs.rust_files }}
steps:
- name: Checkout source code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
with:
fetch-depth: 20
- name: Filter changed repository files
uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50
id: filter
with:
list-files: shell
filters: |
github-actions:
- .github/**/*.yml
- .github/cue/**/*.cue
markdown:
- added|modified: '**/*.md'
rust:
- '**/*.rs'
- '**/Cargo.*'
- .github/workflows/rust.yml
check:
name: check
needs:
- changes
runs-on: ubuntu-latest
if: needs.changes.outputs.rust == 'true'
steps:
- name: Checkout source code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@b44cb146d03e8d870c57ab64b80f04586349ca5d
with:
toolchain: stable
- name: Cache dependencies
uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f
with:
shared-key: stable-ubuntu-latest
- name: Check packages and dependencies for errors
run: cargo check --locked
format:
name: format
needs:
- changes
runs-on: ubuntu-latest
if: needs.changes.outputs.rust == 'true' && github.event_name == 'pull_request'
steps:
- name: Checkout source code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@b44cb146d03e8d870c57ab64b80f04586349ca5d
with:
toolchain: stable
components: rustfmt
- name: Cache dependencies
uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f
with:
shared-key: stable-ubuntu-latest
- name: Check formatting
run: cargo fmt --check
lint:
name: lint
needs:
- changes
runs-on: ubuntu-latest
if: needs.changes.outputs.rust == 'true' && github.event_name == 'pull_request'
steps:
- name: Checkout source code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@b44cb146d03e8d870c57ab64b80f04586349ca5d
with:
toolchain: stable
components: clippy
- name: Cache dependencies
uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f
with:
shared-key: stable-ubuntu-latest
- name: Check lints
run: cargo clippy --no-deps -- -D warnings
test_stable:
name: test / stable
needs:
- check
- format
- lint
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
platform:
- macos-latest
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.platform }}
if: needs.changes.outputs.rust == 'true' && always()
steps:
- name: Checkout source code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@b44cb146d03e8d870c57ab64b80f04586349ca5d
with:
toolchain: stable
- name: Cache dependencies
uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f
with:
shared-key: stable-${{ matrix.platform }}
- name: Install cargo-nextest
uses: taiki-e/install-action@a775aaf2e8ed709f76ee019cb77e39fc50613631
with:
tool: cargo-nextest
- name: Compile tests
run: cargo test --locked --no-run
- name: Run tests
run: cargo nextest run --locked --all-targets --all-features
- name: Run doctests
run: cargo test --locked --doc
check_msrv:
name: check / msrv
needs:
- check
- format
- lint
runs-on: ubuntu-latest
if: needs.changes.outputs.rust == 'true' && always()
steps:
- name: Checkout source code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- name: Get MSRV from package metadata
id: msrv
run: awk -F '"' '/rust-version/{ print "version=" $2 }' Cargo.toml >> $GITHUB_OUTPUT
- name: Install ${{ steps.msrv.outputs.version }} Rust toolchain
uses: dtolnay/rust-toolchain@b44cb146d03e8d870c57ab64b80f04586349ca5d
with:
toolchain: ${{ steps.msrv.outputs.version }}
- name: Cache dependencies
uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f
with:
shared-key: msrv-ubuntu-latest
- name: Check packages and dependencies for errors
run: cargo check --locked
merge_queue:
name: rust workflow ready
needs:
- test_stable
- check_msrv
runs-on: ubuntu-latest
if: always()
steps:
- name: 'Check status of job_id: test_stable'
run: |-
RESULT="${{ needs.test_stable.result }}";
if [[ $RESULT == "success" || $RESULT == "skipped" ]]; then
exit 0
else
echo "***"
echo "Error: The required job did not pass."
exit 1
fi
- name: 'Check status of job_id: check_msrv'
run: |-
RESULT="${{ needs.check_msrv.result }}";
if [[ $RESULT == "success" || $RESULT == "skipped" ]]; then
exit 0
else
echo "***"
echo "Error: The required job did not pass."
exit 1
fi