Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve GitHub Actions for faster checks and better readability #3377

Merged
merged 11 commits into from
Jan 25, 2022
102 changes: 8 additions & 94 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ name: CI
on:
workflow_dispatch:
pull_request:
push:
gustavovalverde marked this conversation as resolved.
Show resolved Hide resolved
branches:
- main
path:
- '**/*.rs'
- '**/*.txt'
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/deny.toml'
- 'Dockerfile'
gustavovalverde marked this conversation as resolved.
Show resolved Hide resolved
- '.github/workflows/ci.yml'

jobs:

test:
name: Test (+${{ matrix.rust }}) on ${{ matrix.os }}
# The large timeout is to accommodate:
Expand Down Expand Up @@ -264,95 +270,3 @@ jobs:
with:
command: build
args: --verbose --release

clippy-deps:
name: Clippy (stable)
timeout-minutes: 30
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full

steps:
- uses: actions/[email protected]
with:
persist-credentials: false

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
override: true

- uses: Swatinem/rust-cache@v1

- name: Show env vars
run: |
echo "Common env vars:"
echo "RUST_BACKTRACE=${{ env.RUST_BACKTRACE }}"
echo "Build env vars:"
echo "CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }}"
echo "CARGO_TARGET_DIR=${{ env.CARGO_TARGET_DIR }}"
gustavovalverde marked this conversation as resolved.
Show resolved Hide resolved

- name: Run clippy
uses: actions-rs/[email protected]
with:
# GitHub displays the clippy job and its results as separate entries
name: Clippy (stable) Results
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -D warnings

# This check makes sure the crate dependency check is accurate
- name: Check Cargo.lock is up to date
uses: actions-rs/[email protected]
with:
command: check
args: --locked --all-features --all-targets

# Edit zebra/deny.toml to allow duplicate dependencies
- name: Check for dependent crates with different versions
uses: EmbarkStudios/[email protected]
with:
command: check bans
args: --all-features --workspace

- name: Check crate sources
uses: EmbarkStudios/[email protected]
with:
command: check sources
args: --all-features --workspace
gustavovalverde marked this conversation as resolved.
Show resolved Hide resolved

fmt:
name: Rustfmt
timeout-minutes: 30
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full

steps:
- uses: actions/[email protected]
with:
persist-credentials: false

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
override: true

- uses: Swatinem/rust-cache@v1

- name: Show env vars
run: |
echo "Common env vars:"
echo "RUST_BACKTRACE=${{ env.RUST_BACKTRACE }}"
echo "Build env vars:"
echo "CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }}"
echo "CARGO_TARGET_DIR=${{ env.CARGO_TARGET_DIR }}"

- name: Check rustfmt
uses: actions-rs/[email protected]
with:
command: fmt
args: --all -- --check
11 changes: 7 additions & 4 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ on:
pull_request:
branches:
- main
push:
branches:
- main
teor2345 marked this conversation as resolved.
Show resolved Hide resolved
path:
- '**/*.rs'
- '**/*.txt'
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/deny.toml'
gustavovalverde marked this conversation as resolved.
Show resolved Hide resolved
- '.github/workflows/coverage.yml'
gustavovalverde marked this conversation as resolved.
Show resolved Hide resolved

jobs:

coverage:
name: Coverage (+nightly)
# The large timeout is to accommodate:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ on:
push:
branches:
- main
path:
- 'book/**'
- '**/firebase.json'
- '.github/workflows/docs.yml'
gustavovalverde marked this conversation as resolved.
Show resolved Hide resolved

jobs:

build:
name: Build and Deploy Docs (+beta)
timeout-minutes: 30
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Lint Rust files

on:
push:
branches:
- "**"
- "!main"
path:
- '**/*.rs'
- 'clippy.toml'
- '.github/workflows/lint.yml'
gustavovalverde marked this conversation as resolved.
Show resolved Hide resolved

env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full

jobs:
clippy:
name: Clippy
teor2345 marked this conversation as resolved.
Show resolved Hide resolved
timeout-minutes: 30
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
persist-credentials: false

- name: Run clippy
uses: actions-rs/[email protected]
with:
# GitHub displays the clippy job and its results as separate entries
name: Clippy (stable) Results
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -D warnings

fmt:
name: Rustfmt
timeout-minutes: 30
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
persist-credentials: false

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
override: true

- uses: Swatinem/rust-cache@v1 # TODO: No cache is being found
gustavovalverde marked this conversation as resolved.
Show resolved Hide resolved

- uses: actions-rs/[email protected]
with:
command: fmt
args: --all -- --check
9 changes: 9 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ on:
push:
branches:
- main
path:
- '**/*.rs'
- '**/*.txt'
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/deny.toml'
gustavovalverde marked this conversation as resolved.
Show resolved Hide resolved
- 'book/**'
gustavovalverde marked this conversation as resolved.
Show resolved Hide resolved
- 'Dockerfile'
teor2345 marked this conversation as resolved.
Show resolved Hide resolved
- '.github/workflows/test.yml'

env:
PROJECT_ID: zealous-zebra
Expand Down