Skip to content

Commit c29d284

Browse files
authored
Merge pull request #27 from Holzhaus/housekeeping
Housekeeping
2 parents 325cfcb + a5b991e commit c29d284

23 files changed

+367
-165
lines changed

.github/dependabot.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ updates:
66
directory: /
77
schedule:
88
interval: weekly
9+
# Check for updated Rust toolchain
10+
- package-ecosystem: rust-toolchain
11+
directory: /
12+
schedule:
13+
interval: weekly
914
# Check for updated GitHub Actions
1015
- package-ecosystem: github-actions
1116
directory: /

.github/workflows/build.yml

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,69 @@
11
---
22
name: Build
33
on: [push, pull_request]
4+
permissions: {}
45

56
jobs:
67
cargo-toml-features:
78
name: Generate Feature Combinations
89
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
912
outputs:
1013
feature-combinations: ${{ steps.cargo-toml-features.outputs.feature-combinations }}
1114
steps:
1215
- name: Check out repository
13-
uses: actions/checkout@v4
16+
uses: actions/checkout@v5
17+
with:
18+
persist-credentials: false
1419
- name: Determine Cargo Features
1520
id: cargo-toml-features
1621
uses: Holzhaus/cargo-toml-features-action@3afa751aae4071b2d1ca1c5fa42528a351c995f4
1722

1823
build:
1924
needs: cargo-toml-features
2025
runs-on: ubuntu-latest
26+
permissions:
27+
contents: read
2128
strategy:
2229
matrix:
2330
features: ${{ fromJson(needs.cargo-toml-features.outputs.feature-combinations) }}
31+
env:
32+
CRATE_FEATURES: ${{ join(matrix.features, ',') }}
2433
steps:
2534
- name: Check out repository
26-
uses: actions/checkout@v4
35+
uses: actions/checkout@v5
36+
with:
37+
persist-credentials: false
2738
- name: Print Rust version
2839
run: rustc -vV
2940
- name: Install SDL2
3041
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libsdl2-dev
31-
- name: Run tests
32-
run: cargo test --no-default-features --features "${{ join(matrix.features, ',') }}" --verbose
33-
- name: Run bench
34-
run: cargo bench --no-default-features --features "${{ join(matrix.features, ',') }}" --verbose
35-
- name: Run doc
36-
run: cargo doc --no-default-features --features "${{ join(matrix.features, ',') }}" --verbose
42+
- name: Build Package
43+
run: | # zizmor: ignore[use-trusted-publishing]
44+
cargo publish --dry-run --locked --no-default-features --features "${CRATE_FEATURES}"
45+
- name: Run Tests
46+
run: cargo test --locked --no-default-features --features "${CRATE_FEATURES}"
47+
- name: Run Benchmark
48+
run: cargo bench --locked --no-default-features --features "${CRATE_FEATURES}"
49+
- name: Generate Documentation
50+
run: cargo doc --no-deps --locked --no-default-features --features "${CRATE_FEATURES}"
51+
52+
publish:
53+
needs: build
54+
runs-on: ubuntu-latest
55+
permissions:
56+
id-token: write # Required for OIDC token exchange
57+
if: startsWith(github.ref, 'refs/tags/')
58+
steps:
59+
- name: Check out repository
60+
uses: actions/checkout@v5
61+
with:
62+
persist-credentials: false
63+
- name: Authenticate with registry
64+
id: auth
65+
uses: rust-lang/crates-io-auth-action@e919bc7605cde86df457cf5b93c5e103838bd879
66+
- name: Publish Package
67+
run: cargo publish --locked
68+
env:
69+
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

.github/workflows/docs.yml

Lines changed: 62 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,67 @@
1+
---
12
name: Generate Docs
23

34
on:
4-
push:
5-
branches:
6-
- main
5+
push:
6+
branches:
7+
- main
8+
9+
permissions: {}
710

811
jobs:
9-
docs:
10-
name: Update Docs
11-
runs-on: ubuntu-latest
12-
steps:
13-
- name: "Check out repository"
14-
uses: actions/checkout@v4
15-
16-
- name: Print Rust version
17-
run: rustc -vV
18-
19-
- name: Generate Documentation
20-
run: cargo doc --all-features --no-deps --document-private-items
21-
22-
- name: Generate index file
23-
shell: python3 {0}
24-
run: |
25-
import os
26-
27-
package = os.environ["PACKAGE_NAME"]
28-
assert package
29-
30-
owner, sep, repository = os.environ["GITHUB_REPOSITORY"].partition("/")
31-
assert owner
32-
assert repository
33-
34-
doc = f"""<!DOCTYPE html>
35-
<html>
36-
<head>
37-
<title>Redirecting to https://{owner}.github.io/{repository}/{package}/</title>
38-
<meta charset="utf-8">
39-
<meta http-equiv="refresh" content="0; URL=https://{owner}.github.io/{repository}/{package}/">
40-
<link rel="canonical" href="https://{owner}.github.io/{repository}/{package}/">
41-
</head>
42-
</html>"""
43-
44-
output_dir = os.environ["OUTPUT_DIR"]
45-
assert output_dir
46-
output_dir = os.path.join(output_dir, "index.html")
47-
48-
print(f"Writing to {output_dir}")
49-
with open(output_dir, mode="w") as f:
50-
f.write(doc)
51-
env:
52-
PACKAGE_NAME: vinylla
53-
OUTPUT_DIR: target/doc
54-
55-
- name: Deploy to GitHub Pages
56-
uses: peaceiris/actions-gh-pages@v4
57-
with:
58-
github_token: ${{ secrets.GITHUB_TOKEN }}
59-
publish_dir: target/doc
12+
docs:
13+
name: Update Docs
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write # needed because peaceiris/actions-gh-pages writes to the gh-pages branch
17+
pages: write
18+
steps:
19+
- name: Check out repository
20+
uses: actions/checkout@v5
21+
with:
22+
persist-credentials: false
23+
24+
- name: Print Rust version
25+
run: rustc -vV
26+
27+
- name: Generate Documentation
28+
run: cargo doc --all-features --no-deps --document-private-items
29+
30+
- name: Generate index file
31+
shell: python3 {0}
32+
run: |
33+
import os
34+
35+
package = os.environ["PACKAGE_NAME"]
36+
assert package
37+
38+
owner, sep, repository = os.environ["GITHUB_REPOSITORY"].partition("/")
39+
assert owner
40+
assert repository
41+
42+
doc = f"""<!DOCTYPE html>
43+
<html>
44+
<head>
45+
<title>Redirecting to https://{owner}.github.io/{repository}/{package}/</title>
46+
<meta charset="utf-8">
47+
<meta http-equiv="refresh" content="0; URL=https://{owner}.github.io/{repository}/{package}/">
48+
<link rel="canonical" href="https://{owner}.github.io/{repository}/{package}/">
49+
</head>
50+
</html>"""
51+
52+
output_dir = os.environ["OUTPUT_DIR"]
53+
assert output_dir
54+
output_dir = os.path.join(output_dir, "index.html")
55+
56+
print(f"Writing to {output_dir}")
57+
with open(output_dir, mode="w") as f:
58+
f.write(doc)
59+
env:
60+
PACKAGE_NAME: vinylla
61+
OUTPUT_DIR: target/doc
62+
63+
- name: Deploy to GitHub Pages
64+
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e
65+
with:
66+
github_token: ${{ secrets.GITHUB_TOKEN }}
67+
publish_dir: target/doc

.github/workflows/pre-commit.yml

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,45 @@
1+
---
12
name: pre-commit
23

34
on:
4-
push:
5-
pull_request:
5+
push:
6+
pull_request:
7+
8+
permissions: {}
69

710
jobs:
8-
pre-commit:
9-
runs-on: ubuntu-latest
10-
steps:
11-
- name: Check out repository
12-
uses: actions/checkout@v4
13-
with:
14-
fetch-depth: 2
15-
16-
- name: Set up Python
17-
uses: actions/setup-python@v5
18-
19-
- name: Detect code style issues
20-
uses: pre-commit/action@v3.0.1
21-
env:
22-
SKIP: no-commit-to-branch
23-
24-
- name: Generate patch file
25-
if: failure()
26-
run: |
27-
git diff-index -p HEAD > "${PATCH_FILE}"
28-
[ -s "${PATCH_FILE}" ] && echo "UPLOAD_PATCH_FILE=${PATCH_FILE}" >> "${GITHUB_ENV}"
29-
env:
30-
PATCH_FILE: pre-commit.patch
31-
32-
- name: Upload patch artifact
33-
if: failure() && env.UPLOAD_PATCH_FILE != null
34-
uses: actions/upload-artifact@v4
35-
with:
36-
name: ${{ env.UPLOAD_PATCH_FILE }}
37-
path: ${{ env.UPLOAD_PATCH_FILE }}
11+
pre-commit:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
steps:
16+
- name: Check out repository
17+
uses: actions/checkout@v5
18+
with:
19+
persist-credentials: false
20+
21+
- name: Install Rust toolchain
22+
run: rustup toolchain install
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v6
26+
27+
- name: Detect code style issues
28+
uses: pre-commit/action@1b06ec171f2f6faa71ed760c4042bd969e4f8b43
29+
env:
30+
SKIP: no-commit-to-branch
31+
32+
- name: Generate patch file
33+
if: failure()
34+
run: |
35+
git diff-index -p HEAD > "${PATCH_FILE}"
36+
[ -s "${PATCH_FILE}" ] && echo "UPLOAD_PATCH_FILE=${PATCH_FILE}" >> "${GITHUB_ENV}"
37+
env:
38+
PATCH_FILE: pre-commit.patch
39+
40+
- name: Upload patch artifact
41+
if: failure() && env.UPLOAD_PATCH_FILE != null
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: ${{ env.UPLOAD_PATCH_FILE }}
45+
path: ${{ env.UPLOAD_PATCH_FILE }}

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
/target
2-
Cargo.lock
32
Serato Control CD.wav

.pre-commit-config.yaml

Lines changed: 52 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,54 @@
1+
---
12
default_language_version:
2-
python: python3
3+
python: python3
34
repos:
4-
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v5.0.0
6-
hooks:
7-
- id: fix-byte-order-marker
8-
- id: check-case-conflict
9-
- id: check-json
10-
- id: check-merge-conflict
11-
- id: check-xml
12-
- id: check-yaml
13-
- id: end-of-file-fixer
14-
- id: mixed-line-ending
15-
- id: trailing-whitespace
16-
- repo: https://github.com/codespell-project/codespell
17-
rev: v2.3.0
18-
hooks:
19-
- id: codespell
20-
args: [ --ignore-words=.codespellignore ]
21-
- repo: https://github.com/doublify/pre-commit-rust
22-
rev: v1.0
23-
hooks:
24-
- id: fmt
25-
- id: cargo-check
26-
- id: clippy
27-
args: [--all-targets, --all-features, --, -D, warnings]
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
7+
hooks:
8+
- id: check-case-conflict
9+
- id: check-json
10+
- id: check-merge-conflict
11+
- id: check-symlinks
12+
- id: check-toml
13+
- id: check-xml
14+
- id: check-yaml
15+
- id: destroyed-symlinks
16+
- id: detect-private-key
17+
- id: end-of-file-fixer
18+
- id: fix-byte-order-marker
19+
- id: forbid-new-submodules
20+
- id: mixed-line-ending
21+
- id: trailing-whitespace
22+
exclude: .tsv$
23+
- repo: https://github.com/codespell-project/codespell
24+
rev: 63c8f8312b7559622c0d82815639671ae42132ac # frozen: v2.4.1
25+
hooks:
26+
- id: codespell
27+
args: [--ignore-words=.codespellignore]
28+
exclude_types: [tsv, json]
29+
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
30+
rev: 8d1b9cadaf854cb25bb0b0f5870e1cc66a083d6b # frozen: 0.2.3
31+
hooks:
32+
- id: yamlfmt
33+
- repo: https://github.com/gitleaks/gitleaks
34+
rev: 39fdb480a06768cc41a84ef86959c07ff33091c4 # frozen: v8.28.0
35+
hooks:
36+
- id: gitleaks
37+
- repo: https://github.com/woodruffw/zizmor-pre-commit
38+
rev: 122d24ec728f140b38330ae8b04e3c5fe8b774c5 # frozen: v1.15.2
39+
hooks:
40+
- id: zizmor
41+
- repo: https://github.com/doublify/pre-commit-rust
42+
rev: eeee35a89e69d5772bdee97db1a6a898467b686e # frozen: v1.0
43+
hooks:
44+
- id: fmt
45+
args: [--all, --]
46+
- id: clippy
47+
args: [--locked, --workspace, --all-features, --all-targets, --, -D, warnings]
48+
- repo: https://github.com/Holzhaus/sourceheaders
49+
rev: 37fab20a62cc63ebb9a8855a2ab90ec7dc56cadf # frozen: v0.0.4
50+
hooks:
51+
- id: sourceheaders
52+
53+
ci:
54+
skip: [fmt, clippy]

.sourceheaders.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[general]
2+
license = "MPL-2.0"
3+
copyright_holder = "Jan Holthuis <jan.holthuis@rub.de>"
4+
prefer_inline = true
5+
width = 99

0 commit comments

Comments
 (0)