Skip to content

Commit

Permalink
Attempt to speed up build.
Browse files Browse the repository at this point in the history
  • Loading branch information
samwho committed Jun 25, 2023
1 parent e180f7c commit e1b9080
Showing 1 changed file with 43 additions and 17 deletions.
60 changes: 43 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ on:
paths-ignore:
- "docs/**"
- "**.md"
pull_request:
paths-ignore:
- "docs/**"
- "**.md"
- "LICENSE"

jobs:
# Ensure that the project could be successfully compiled
Expand All @@ -22,6 +19,18 @@ jobs:
profile: minimal
toolchain: stable
override: true
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- uses: actions-rs/cargo@v1
with:
command: check
Expand Down Expand Up @@ -61,30 +70,35 @@ jobs:
toolchain: stable
components: clippy
override: true
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --all-features -- -D clippy::all

# Run a security audit on dependencies
cargo_audit:
name: Cargo Audit [Security]
needs: cargo_check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v1
- uses: actions-rs/audit-check@v1
with:
toolchain: stable
override: true
- run: cargo install --force cargo-audit
- run: cargo generate-lockfile
- uses: actions-rs/cargo@v1
with:
command: audit
token: ${{ secrets.GITHUB_TOKEN }}

test:
needs: [cargo_check]
needs: [cargo_check, rustfmt, clippy]
name: Tests
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -99,6 +113,18 @@ jobs:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- uses: actions-rs/cargo@v1
with:
command: test
Expand Down Expand Up @@ -168,7 +194,7 @@ jobs:
github_release:
if: startsWith(github.ref, 'refs/tags/v')
name: Create GitHub Release
needs: [test, github_build]
needs: [test, github_build, cargo_audit]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -213,7 +239,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

cargo_publish:
needs: test
needs: [test, cargo_audit]
if: startsWith(github.ref, 'refs/tags/v')
name: Publish Cargo Package
runs-on: ubuntu-latest
Expand Down

0 comments on commit e1b9080

Please sign in to comment.