Skip to content

Commit

Permalink
Merge branch 'improve-ci'
Browse files Browse the repository at this point in the history
  • Loading branch information
faern committed May 8, 2024
2 parents 5c55b9f + bc281d2 commit dc9e119
Show file tree
Hide file tree
Showing 15 changed files with 1,618 additions and 65 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Audit Rust dependencies
on:
pull_request:
paths:
- .github/workflows/*.yml
- Cargo.toml
- Cargo.lock
schedule:
# At 06:20 UTC every day. Will create an issue if a CVE is found.
- cron: '20 6 * * *'

workflow_dispatch:
jobs:
audit:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/checkout@v4

- uses: actions-rust-lang/audit@v1.1.11
name: Audit Rust Dependencies
with:
denyWarnings: true
# RUSTSEC-2021-0127 - serde_cbor is unmaintained. Can be removed once we upgrade criterion
# RUSTSEC-2021-0145 - atty is unsound. Can be removed once we upgrade criterion
ignore: RUSTSEC-2021-0127,RUSTSEC-2021-0145
23 changes: 17 additions & 6 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
---
name: Cargo build and test
on: [pull_request, workflow_dispatch]
on:
pull_request:
paths:
- .github/workflows/*.yml
- '**/*.rs'
- Cargo.toml
- Cargo.lock
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "--deny warnings "
Expand All @@ -14,15 +23,15 @@ jobs:
rust: nightly
- os: ubuntu-latest
rust: 1.65.0
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Rust
uses: ATiltedTree/setup-rust@v1.0.4
- uses: actions-rs/toolchain@v1.0.6
with:
rust-version: ${{ matrix.rust }}
toolchain: ${{ matrix.rust }}
default: true

- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
Expand All @@ -34,7 +43,9 @@ jobs:
run: cargo hack --feature-powerset test

- name: Test with artificial delay
shell: bash
run: RUSTFLAGS+="--cfg oneshot_test_delay" cargo hack --feature-powerset test

- name: Test with loom
shell: bash
run: RUSTFLAGS+="--cfg loom" LOOM_MAX_BRANCHES=100000 cargo hack --feature-powerset test --test sync --test loom
24 changes: 24 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Rust formatting
on:
pull_request:
paths:
- .github/workflows/*.yml
- '**/*.rs'
workflow_dispatch:
jobs:
check-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Check formatting
run: |
rustfmt --version
cargo fmt -- --check
32 changes: 32 additions & 0 deletions .github/workflows/git-commit-message-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Git - Check commit message style
on:
push:
workflow_dispatch:

jobs:
check-commit-message-style:
name: Check commit message style
runs-on: ubuntu-latest
steps:
# Make sure there are no whitespaces other than space, tab and newline in a commit message.
- name: Check for unicode whitespaces
uses: gsactions/commit-message-checker@v2
with:
# Pattern matches strings not containing weird unicode whitespace/separator characters
# \P{Z} = All non-whitespace characters (the u-flag is needed to enable \P{Z})
# [ \t\n] = Allowed whitespace characters
pattern: '^(\P{Z}|[ \t\n])+$'
flags: 'u'
error: 'Detected unicode whitespace character in commit message.'
checkAllCommitMessages: 'true' # optional: this checks all commits associated with a pull request
accessToken: ${{ secrets.GITHUB_TOKEN }} # only required if checkAllCommitMessages is true

# Git commit messages should follow these guidelines: https://cbea.ms/git-commit/
- name: Check against guidelines
uses: mristin/opinionated-commit-message@f3b9cec249cabffbae7cd564542fd302cc576827 #v3.1.1
with:
# Commit messages are allowed to be subject only, no body
allow-one-liners: 'true'
# This action defaults to 50 char subjects, but 72 is fine.
max-subject-line-length: '72'
27 changes: 27 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Rust linting
on:
pull_request:
paths:
- .github/workflows/*.yml
- '**/*.rs'

workflow_dispatch:
jobs:
clippy-linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Clippy check
env:
RUSTFLAGS: --deny warnings
run: |
time cargo clippy --locked --all-targets --no-default-features
time cargo clippy --locked --all-targets --all-features
55 changes: 0 additions & 55 deletions .github/workflows/style-sanity.yml

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/target
Cargo.lock
Loading

0 comments on commit dc9e119

Please sign in to comment.