Skip to content

Commit dd98c2f

Browse files
authored
chore: redo CI, add linting, etc (#11)
1 parent 244d33f commit dd98c2f

13 files changed

Lines changed: 155 additions & 35 deletions

File tree

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @svix/Maintainers
Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
name: CI
1+
name: Rust CI
22
on:
3-
push:
4-
branches:
5-
- main
6-
pull_request: {}
3+
workflow_call:
4+
workflow_dispatch:
75
jobs:
86
lint:
97
runs-on: ubuntu-latest
@@ -13,11 +11,17 @@ jobs:
1311
with:
1412
toolchain: nightly
1513
components: clippy, rustfmt
16-
- uses: Swatinem/rust-cache@v1
14+
- uses: taiki-e/install-action@cargo-sort
15+
- uses: taiki-e/install-action@cargo-machete
16+
- uses: Swatinem/rust-cache@v2
1717
- name: clippy
1818
run: cargo clippy --all --all-targets --all-features
1919
- name: rustfmt
2020
run: cargo fmt --all -- --check
21+
- name: cargo-sort
22+
run: cargo sort --check --no-format -o package,lib,bin,features,dependencies,dev-dependencies,lints,workspace
23+
- name: cargo-machete
24+
run: cargo machete
2125
test-versions:
2226
runs-on: ubuntu-latest
2327
strategy:
@@ -41,3 +45,18 @@ jobs:
4145
run: cargo test --all --no-default-features --features "chrono04" --all-targets
4246
- name: Run tests (time03)
4347
run: cargo test --all --no-default-features --features "time03" --all-targets
48+
prek:
49+
name: Validate prek
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/checkout@v6
53+
- uses: astral-sh/setup-uv@v7
54+
- uses: j178/prek-action@v1
55+
cargo-deny:
56+
name: cargo-deny check
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: actions/checkout@v6
60+
- uses: EmbarkStudios/cargo-deny-action@v2
61+
with:
62+
manifest-path: Cargo.toml

.github/workflows/on-pr.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: CI on PR
2+
on:
3+
pull_request:
4+
branches: ['*']
5+
jobs:
6+
ci:
7+
permissions:
8+
contents: read
9+
uses: ./.github/workflows/ci.yml
10+
secrets: inherit

.github/workflows/on-push.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: CI on Push to Main
2+
on:
3+
push:
4+
branches: [main]
5+
jobs:
6+
ci:
7+
permissions:
8+
contents: read
9+
uses: ./.github/workflows/ci.yml
10+
secrets: inherit

.github/workflows/on-tag.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: CI/CD on Push Tag
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
permissions:
7+
contents: read
8+
id-token: write
9+
jobs:
10+
ci:
11+
permissions:
12+
contents: read
13+
uses: ./.github/workflows/ci.yml
14+
secrets: inherit
15+
release:
16+
needs: [ci]
17+
permissions:
18+
contents: read
19+
id-token: write
20+
uses: ./.github/workflows/release.yml

.github/workflows/release.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ name: Release
22
env:
33
CARGO_TERM_COLOR: always
44
on:
5-
push:
6-
tags:
7-
- 'v*'
5+
workflow_call:
86
jobs:
97
build:
108
runs-on: ubuntu-latest

.github/workflows/security.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
repos:
2+
- repo: builtin
3+
hooks:
4+
- id: end-of-file-fixer
5+
- id: trailing-whitespace
6+
- id: check-case-conflict
7+
- id: check-merge-conflict
8+
- id: check-symlinks
9+
- id: check-toml
10+
- id: check-yaml
11+
args: ["--allow-multiple-documents"]
12+
- id: check-json
13+
- repo: https://github.com/google/yamlfmt
14+
rev: v0.20.0
15+
hooks:
16+
- id: yamlfmt
17+
exclude: "^infra/helm"
18+
- repo: https://github.com/rhysd/actionlint
19+
rev: v1.7.7
20+
hooks:
21+
- id: actionlint
22+
- repo: https://github.com/crate-ci/typos
23+
rev: v1.45.0
24+
hooks:
25+
- id: typos
26+
exclude: tests/test_kuids.txt
27+
- repo: https://github.com/scop/pre-commit-shfmt
28+
rev: v3.13.1-1
29+
hooks:
30+
- id: shfmt
31+
args: ["--write", "-i", "4", "-ci"]
32+
- repo: https://github.com/koalaman/shellcheck-precommit
33+
rev: v0.11.0
34+
hooks:
35+
- id: shellcheck

.typos.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[default.extend-identifiers]
2+
# example ksuids
3+
24CtFf3hyVZHdSkQy0nMBa1OjOA = "24CtFf3hyVZHdSkQy0nMBa1OjOA"
4+
02GY99XXwBHbeBundUPJoqYpvet = "02GY99XXwBHbeBundUPJoqYpvet"

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ license="MIT"
1212
keywords=["ksuid", "uuid", "svix", "segment"]
1313
categories = ["data-structures", "concurrency", "database", "encoding"]
1414

15-
[badges]
16-
maintenance = {status="actively-developed"}
17-
1815
[features]
1916
# Include `time` by default, to match old behavior
2017
default = ["time03"]
@@ -26,12 +23,15 @@ chrono04 = ["dep:chrono"]
2623
[dependencies]
2724
base-encode = "^0.3.1"
2825
byteorder = "^1.4.3"
29-
getrandom = "0.4.2"
30-
time = { version = "0.3.47", optional = true }
3126
chrono = { version = "0.4", optional = true }
27+
getrandom = "0.4.2"
3228
jiff = { version = "0.2", optional = true }
3329
serde = { version = "^1.0.145", optional = true, features = ["derive"] }
30+
time = { version = "0.3.47", optional = true }
3431

3532
[dev-dependencies]
3633
serde = { version = "^1.0.145", features = ["derive"] }
3734
serde_json = "^1.0.85"
35+
36+
[badges]
37+
maintenance = {status="actively-developed"}

0 commit comments

Comments
 (0)