Skip to content

Commit

Permalink
feat(ci): make rust version in ci configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
nimrod-starkware committed Aug 4, 2024
1 parent 455268c commit c90febf
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
34 changes: 28 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,16 @@ on:
- synchronize
- auto_merge_enabled
- edited

jobs:
set_rust_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: version
run: echo "rust_version=$(cat .github/workflows/rust_version.txt)" >> $GITHUB_OUTPUT
outputs:
rust_version: ${{ steps.version.outputs.rust_version }}

commitlint:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -54,12 +62,14 @@ jobs:
- run: scripts/rust_fmt.sh --check

clippy:
needs: set_rust_version
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: Noelware/[email protected]
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
components: clippy
- uses: Swatinem/rust-cache@v2
with:
Expand All @@ -78,26 +88,32 @@ jobs:
- run: scripts/clippy.sh

doc:
needs: set_rust_version
runs-on: ubuntu-latest
# env:
# RUSTDOCFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Swatinem/rust-cache@v2
- uses: Noelware/[email protected]
with:
version: ${{env.PROTOC_VERSION}}
- run: cargo doc --workspace -r --document-private-items --no-deps

run-tests:
needs: set_rust_version
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
# Fetch the entire history.
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Noelware/[email protected]
- uses: Swatinem/rust-cache@v2
with:
Expand Down Expand Up @@ -134,10 +150,13 @@ jobs:
SEED: 0

taplo:
needs: set_rust_version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Swatinem/rust-cache@v2
- uses: baptiste0928/cargo-install@v3
with:
Expand All @@ -154,12 +173,15 @@ jobs:
uses: bnjbvr/cargo-machete@main

check:
needs: set_rust_version
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Swatinem/rust-cache@v2
- uses: Noelware/[email protected]
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/rust_version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.78.0

0 comments on commit c90febf

Please sign in to comment.