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

more ci #219

Merged
merged 8 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
22 changes: 22 additions & 0 deletions .github/workflows/audit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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
with:
rust-version: "stable"
51 changes: 23 additions & 28 deletions .github/workflows/cargo.yaml → .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
name: cargo
name: ci

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

pull_request:
workflow_dispatch:
merge_group:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
pre-job:
Expand All @@ -30,8 +37,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 +53,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 +65,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 +82,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 +92,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 +109,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 +129,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
Loading