Skip to content

Commit

Permalink
chore: skip version if it's stable version in rust.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ludndev committed Jul 18, 2024
1 parent dddb996 commit a506fa6
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,33 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

rust-stable:
needs: pre-job

runs-on: ubuntu-22.04

outputs:
status: ${{ steps.check_skip.skip }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get stable Rust version
id: get_rust_version
run: |
STABLE_VERSION=$(rustc -Vv | grep "release:" | cut -d' ' -f2)
echo "stable_version=$STABLE_VERSION" >> $GITHUB_OUTPUT
- name: Check if job should be skipped
id: check_skip
run: |
if [ "${{ matrix.rust_version }}" != "stable" ] && [ "${{ matrix.rust_version }}" == "${{ steps.get_rust_version.outputs.stable_version }}" ]; then
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "skip=false" >> $GITHUB_OUTPUT
fi
rustfmt:
needs: pre-job

Expand All @@ -59,9 +86,9 @@ jobs:
run: cargo fmt --all -- --check

clippy:
needs: [ pre-job, rustfmt ]
needs: [ pre-job, rust-stable, rustfmt ]

if: needs.pre-job.outputs.skip_tests != 'true'
if: needs.pre-job.outputs.skip_tests != 'true' && needs.rust-stable.outputs.skip != 'true'

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -94,9 +121,9 @@ jobs:
run: cargo clippy --verbose --all-features -- -D warnings -D clippy::dbg_macro

test:
needs: [ pre-job, rustfmt ]
needs: [ pre-job, rust-stable, rustfmt ]

if: needs.pre-job.outputs.skip_tests != 'true'
if: needs.pre-job.outputs.skip_tests != 'true' && needs.rust-stable.outputs.skip != 'true'

runs-on: ${{ matrix.os }}

Expand Down

0 comments on commit a506fa6

Please sign in to comment.