Skip to content

Commit

Permalink
more ci
Browse files Browse the repository at this point in the history
  • Loading branch information
TroyKomodo committed Dec 8, 2024
1 parent f7814e6 commit fa081a0
Show file tree
Hide file tree
Showing 50 changed files with 1,481 additions and 406 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
xtask = "run --package xtask --target-dir target/xtask -- "
9 changes: 9 additions & 0 deletions .config/hakari.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,12 @@ platforms = [

# Write out exact versions rather than a semver range. (Defaults to false.)
# exact-versions = true
[traversal-excludes]
workspace-members = [
"xtask",
]

[final-excludes]
workspace-members = [
"xtask",
]
3 changes: 3 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[profile.ci]
fail-fast = false

[profile.ci.junit]
path = "junit.xml"
20 changes: 20 additions & 0 deletions .github/workflows/audit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Security audit
on:
push:
paths:
- '.github/workflows/audit.yaml'
- '**/Cargo.toml'
- '**/Cargo.lock'
- 'deny.toml'
schedule:
- cron: '0 0 * * *'
jobs:
audit:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- uses: actions/checkout@v4

- uses: EmbarkStudios/cargo-deny-action@v1
47 changes: 19 additions & 28 deletions .github/workflows/cargo.yaml → .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: cargo
name: ci

on:
push:
branches:
- main
pull_request: {}

pull_request:
workflow_dispatch:
merge_group:

jobs:
pre-job:
Expand All @@ -30,8 +33,6 @@ jobs:
if: ${{ needs.pre-job.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- uses: awalsh128/cache-apt-pkgs-action@latest
with:
Expand All @@ -48,14 +49,8 @@ jobs:
prefix-key: "v0-rust-${{ steps.setup-rust.outputs.cachekey }}"
key: clippy

- uses: cargo-bins/cargo-binstall@main

- uses: taiki-e/install-action@v2
with:
tool: just

- name: Make sure code is linted
run: just ci clippy
run: cargo +nightly xtask powerset clippy

fmt:
name: Fmt
Expand All @@ -66,23 +61,15 @@ jobs:
checks: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- uses: dtolnay/rust-toolchain@stable
id: setup-rust
with:
toolchain: nightly
components: rustfmt

- uses: cargo-bins/cargo-binstall@main

- uses: taiki-e/install-action@v2
with:
tool: just

- name: Make sure code is formatted
run: just ci fmt
run: cargo +nightly fmt --check

hakari:
name: Hakari
Expand All @@ -91,8 +78,6 @@ jobs:
if: ${{ needs.pre-job.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- uses: dtolnay/rust-toolchain@stable
id: setup-rust
Expand All @@ -103,10 +88,15 @@ jobs:

- uses: taiki-e/install-action@v2
with:
tool: cargo-hakari,just
tool: cargo-hakari

- name: Make sure Hakari is up-to-date
run: just ci hakari
run: |
set -xeo pipefail
cargo hakari manage-deps --dry-run
cargo hakari generate --diff
cargo hakari verify
test:
name: Test
Expand All @@ -115,8 +105,6 @@ jobs:
if: ${{ needs.pre-job.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- uses: awalsh128/cache-apt-pkgs-action@latest
with:
Expand All @@ -137,9 +125,12 @@ jobs:

- uses: taiki-e/install-action@v2
with:
tool: cargo-nextest,cargo-llvm-cov,just
tool: cargo-nextest,cargo-llvm-cov

- run: just ci test
# Note; we don't run the powerset here because it's very slow on CI
# Perhaps we should consider it at some point.
- name: Run tests
run: cargo +nightly llvm-cov nextest --branch --no-fail-fast --all-features --lcov --output-path ./lcov.info --profile ci

- uses: codecov/codecov-action@v5
with:
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/gh-cache.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: gh-cache

on:
pull_request:
types:
- closed

jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Cleanup
run: |
echo "Fetching list of cache key"
cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id')
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh cache delete $cacheKey
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ node_modules/
lcov.info
local/
coverage/
benchmark.txt
.aliases
Loading

0 comments on commit fa081a0

Please sign in to comment.