Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
uklotzde committed May 28, 2023
0 parents commit 37e61bc
Show file tree
Hide file tree
Showing 20 changed files with 1,288 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-FileCopyrightText: The djio authors
# SPDX-License-Identifier: CC0-1.0

crate
33 changes: 33 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"rules": {
"subject-min-length": [
2,
"always",
8
],
"subject-max-length": [
2,
"always",
50
],
"subject-case": [
2,
"always",
"sentence-case"
],
"subject-full-stop": [
2,
"never",
"."
],
"body-max-line-length": [
2,
"always",
72
],
"footer-leading-blank": [
2,
"always"
]
}
}
2 changes: 2 additions & 0 deletions .commitlintrc.json.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SPDX-FileCopyrightText: The djio authors
SPDX-License-Identifier: CC0-1.0
10 changes: 10 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: The djio authors
# SPDX-License-Identifier: CC0-1.0

version: 2

updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
49 changes: 49 additions & 0 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# SPDX-FileCopyrightText: The djio authors
# SPDX-License-Identifier: CC0-1.0

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow

name: continuous-integration

permissions:
contents: read

on:
pull_request:
push:
branches:
- main

env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUST_BACKTRACE: short

jobs:
continuous-integration:
name: Building project and running tests
runs-on: ubuntu-latest

steps:
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable

- name: Check out repository
uses: actions/checkout@v3

- name: Generate Cargo.lock
run: cargo generate-lockfile

- name: Cache Rust toolchain and build artifacts
uses: Swatinem/rust-cache@v2
with:
# Distinguished by the action name to avoid sharing across different actions!
shared-key: "continuous-integration"

- name: Build tests
run: cargo test --locked --all-targets --no-run

- name: Run tests
run: cargo test --locked --all-targets -- --nocapture --quiet
56 changes: 56 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# SPDX-FileCopyrightText: The djio authors
# SPDX-License-Identifier: CC0-1.0

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow

name: pre-commit

permissions:
contents: read

on:
pull_request:
push:
branches:
- "*"

env:
CARGO_TERM_COLOR: always

jobs:
pre-commit:
name: Detecting code style issues
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy, rustfmt

- name: Check out repository
uses: actions/checkout@v3

- name: Generate Cargo.lock
run: cargo generate-lockfile

- name: Cache Rust toolchain and build artifacts
uses: Swatinem/rust-cache@v2
with:
# Distinguished by the action name to avoid sharing across different actions!
shared-key: "pre-commit"

- name: Detect code style issues (push)
uses: pre-commit/[email protected]
if: github.event_name == 'push'

- name: Detect code style issues (pull_request)
uses: pre-commit/[email protected]
if: github.event_name == 'pull_request'
env:
SKIP: no-commit-to-branch
42 changes: 42 additions & 0 deletions .github/workflows/security-audit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# SPDX-FileCopyrightText: The djio authors
# SPDX-License-Identifier: CC0-1.0

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow

name: security-audit

permissions:
contents: read

on:
push:
paths:
- "**/Cargo.toml"
#schedule:
# - cron: '0 0 * * *'
workflow_dispatch:

jobs:
security-audit:
runs-on: ubuntu-latest
steps:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable

- name: Install cargo-audit
run: cargo install cargo-audit

- uses: actions/checkout@v3

- name: Generate Cargo.lock
run: cargo generate-lockfile

- name: Cache Rust toolchain and build artifacts
uses: Swatinem/rust-cache@v2
with:
# Distinguished by the action name to avoid sharing across different actions!
shared-key: "security-audit"

- name: Run security audit
run: cargo audit --deny unsound --deny yanked
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: The djio authors
# SPDX-License-Identifier: CC0-1.0

# Don't add any custom patterns for platform-specific files like .DS_Store
# or generated by custom development tools like .vscode or .idea that don't
# affect other developers. Instead add those custom patterns to your global
# .gitignore file that can be configured by setting core.excludesFile.
# See also: https://git-scm.com/docs/gitignore

# Cargo artifacts
Cargo.lock

# Build directories (or a symbolic link, i.e. without a trailing slash)
/target
38 changes: 38 additions & 0 deletions .justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# SPDX-FileCopyrightText: The djio authors
# SPDX-License-Identifier: CC0-1.0

# just manual: https://github.com/casey/just/#readme

_default:
@just --list

# Format source code
fmt:
cargo fmt --all

# Run clippy
check:
cargo clippy --locked --workspace --no-deps --all-targets -- -D warnings --cap-lints warn

# Run unit tests
test:
RUST_BACKTRACE=1 cargo test --locked --workspace -- --nocapture

# Set up (and update) tooling
setup:
# Ignore rustup failures, because not everyone might use it
rustup self update || true
# cargo-edit is needed for `cargo upgrade`
cargo install cargo-edit just
pip install -U pre-commit
pre-commit install --hook-type commit-msg --hook-type pre-commit

# Upgrade (and update) dependencies
upgrade: setup
pre-commit autoupdate
cargo upgrade
cargo update

# Run pre-commit hooks
pre-commit:
pre-commit run --all-files
41 changes: 41 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# SPDX-FileCopyrightText: The djio authors
# SPDX-License-Identifier: CC0-1.0

# Disable some built-in rules
config:
default: true

# The same headline in different nested sections is okay (and necessary for
# CHANGELOG.md).
no-duplicate-header:
allow_different_nesting: true

# We use ordered lists to make stuff easier to read in a text editor.
ol-prefix:
style: ordered

# Not wrapping long lines makes diffs easier to read, especially for prose.
# Instead, we should follow the "one sentence per line" pattern.
line-length: false

# Dollar signs are useful to indicate shell commands/type and help
# distinguishing wrapped lines from new commands.
commands-show-output: false

# Indented code blocks are easier to read in a text editor, but don't allow
# specifying a language for syntax highlighting. Therefore both indented and
# fenced code block should be allowed depending on the use case.
code-block-style: false

# MD026/no-trailing-punctuation: Trailing punctuation in heading
# Used in README.md
no-trailing-punctuation: false

# Fix any fixable errors
fix: true

# Disable inline config comments
noInlineConfig: true

# Disable progress on stdout (only valid at root)
noProgress: true
87 changes: 87 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# SPDX-FileCopyrightText: The djio authors
# SPDX-License-Identifier: CC0-1.0

default_stages:
# Prevent that hooks run twice, triggered by both
# the Git commit-msg and the pre-commit hook.
- commit

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-xml
- id: check-yaml
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: forbid-new-submodules
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.5.0
hooks:
- id: commitlint
stages:
- commit-msg
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.7.1
hooks:
- id: markdownlint-cli2
exclude: ^LICENSE\.md$
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.2
hooks:
- id: shellcheck
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
args: [--ignore-words=.codespellignore]
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.23.0
hooks:
- id: check-github-actions
- id: check-github-workflows
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
args: [--all, --]
- id: clippy
args:
[
--locked,
--workspace,
--all-features,
--all-targets,
--,
-D,
warnings,
]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.9-for-vscode
hooks:
- id: prettier
types_or:
- markdown
- yaml
# https://reuse.software
- repo: https://github.com/fsfe/reuse-tool
rev: v1.1.2
hooks:
- id: reuse
- repo: local
hooks:
- id: cargo-doc
name: cargo-doc
entry: env RUSTDOCFLAGS=-Dwarnings cargo
language: system
pass_filenames: false
args: [doc, --locked, --workspace, --no-deps]
10 changes: 10 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: The djio authors
# SPDX-License-Identifier: CC0-1.0

overrides:
- files:
- "**/*.yaml"
options:
tabWidth: 2
# in double quotes you can use escapes
singleQuote: false
Loading

0 comments on commit 37e61bc

Please sign in to comment.