Skip to content

Commit ff8edbe

Browse files
feat: add Dispatch Seren Cloud courier plugin
0 parents  commit ff8edbe

15 files changed

Lines changed: 2679 additions & 0 deletions

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
indent_style = space
9+
indent_size = 4
10+
11+
[*.{toml,yaml,yml,json,md}]
12+
indent_size = 2
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

.github/workflows/ci.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
contents: read
16+
17+
env:
18+
CARGO_TERM_COLOR: always
19+
RUSTFLAGS: -D warnings
20+
21+
jobs:
22+
pr-title:
23+
name: PR Title
24+
if: github.event_name == 'pull_request'
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Enforce conventional PR title
28+
env:
29+
PR_TITLE: ${{ github.event.pull_request.title }}
30+
run: |
31+
pattern='^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([^)]+\))?(!)?: .+$'
32+
if [[ ! "$PR_TITLE" =~ $pattern ]]; then
33+
echo "Pull request title must follow the conventional commit format." >&2
34+
echo "Expected: type(scope): summary" >&2
35+
echo "Allowed types: build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test" >&2
36+
echo "Got: $PR_TITLE" >&2
37+
exit 1
38+
fi
39+
40+
check:
41+
name: Check
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
45+
with:
46+
persist-credentials: false
47+
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
48+
with:
49+
toolchain: stable
50+
- uses: Swatinem/rust-cache@bc2d2e71bd35c5549942babaa51a89c586b981d1 # v2.8.1
51+
- run: cargo check --locked
52+
53+
clippy:
54+
name: Clippy
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
58+
with:
59+
persist-credentials: false
60+
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
61+
with:
62+
toolchain: stable
63+
components: clippy
64+
- uses: Swatinem/rust-cache@bc2d2e71bd35c5549942babaa51a89c586b981d1 # v2.8.1
65+
- run: cargo clippy --locked -- -D warnings
66+
67+
fmt:
68+
name: Format
69+
runs-on: ubuntu-latest
70+
steps:
71+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
72+
with:
73+
persist-credentials: false
74+
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
75+
with:
76+
toolchain: stable
77+
components: rustfmt
78+
- run: cargo fmt --all -- --check
79+
80+
test:
81+
name: Test (${{ matrix.os }})
82+
runs-on: ${{ matrix.os }}
83+
strategy:
84+
fail-fast: false
85+
matrix:
86+
os: [ubuntu-latest, macos-latest, windows-latest]
87+
steps:
88+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
89+
with:
90+
persist-credentials: false
91+
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
92+
with:
93+
toolchain: stable
94+
- uses: taiki-e/install-action@v2
95+
with:
96+
tool: cargo-nextest
97+
- uses: Swatinem/rust-cache@bc2d2e71bd35c5549942babaa51a89c586b981d1 # v2.8.1
98+
with:
99+
key: ${{ matrix.os }}
100+
- run: cargo nextest run --locked --no-fail-fast

.github/workflows/release.yml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ["v*.*.*"]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}
9+
cancel-in-progress: true
10+
11+
permissions:
12+
contents: read
13+
14+
env:
15+
CARGO_TERM_COLOR: always
16+
17+
jobs:
18+
tag-check:
19+
name: Tag Check
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23+
with:
24+
persist-credentials: false
25+
26+
- name: Validate tag matches package version
27+
env:
28+
TAG_NAME: ${{ github.ref_name }}
29+
run: |
30+
python3 - <<'PY'
31+
import os
32+
import pathlib
33+
import tomllib
34+
35+
tag_name = os.environ["TAG_NAME"]
36+
if not tag_name.startswith("v"):
37+
raise SystemExit(f"expected v-prefixed tag, got {tag_name}")
38+
tag_version = tag_name[1:]
39+
cargo = tomllib.loads(pathlib.Path("Cargo.toml").read_text())
40+
package_version = cargo["package"]["version"]
41+
if tag_version != package_version:
42+
raise SystemExit(
43+
f"tag version {tag_version} does not match package version {package_version}"
44+
)
45+
PY
46+
47+
build:
48+
needs: tag-check
49+
name: Build (${{ matrix.target }})
50+
runs-on: ${{ matrix.runner }}
51+
permissions:
52+
contents: read
53+
strategy:
54+
fail-fast: false
55+
matrix:
56+
include:
57+
- target: aarch64-apple-darwin
58+
runner: macos-14
59+
- target: x86_64-apple-darwin
60+
runner: macos-latest
61+
- target: aarch64-unknown-linux-gnu
62+
runner: ubuntu-24.04-arm
63+
- target: x86_64-unknown-linux-gnu
64+
runner: ubuntu-latest
65+
- target: x86_64-pc-windows-msvc
66+
runner: windows-latest
67+
68+
steps:
69+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
70+
with:
71+
persist-credentials: false
72+
73+
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
74+
with:
75+
toolchain: stable
76+
targets: ${{ matrix.target }}
77+
78+
- uses: Swatinem/rust-cache@bc2d2e71bd35c5549942babaa51a89c586b981d1 # v2.8.1
79+
with:
80+
key: release-${{ matrix.target }}
81+
82+
- name: Build
83+
run: cargo build --release --locked --target ${{ matrix.target }}
84+
85+
- name: Prepare asset (Unix)
86+
if: runner.os != 'Windows'
87+
shell: bash
88+
run: |
89+
ASSET="dispatch-courier-seren-cloud-${{ matrix.target }}"
90+
cp "target/${{ matrix.target }}/release/dispatch-courier-seren-cloud" "$ASSET"
91+
chmod +x "$ASSET"
92+
echo "ASSET=$ASSET" >> "$GITHUB_ENV"
93+
94+
- name: Prepare asset (Windows)
95+
if: runner.os == 'Windows'
96+
shell: pwsh
97+
run: |
98+
$ASSET = "dispatch-courier-seren-cloud-${{ matrix.target }}.exe"
99+
Copy-Item "target/${{ matrix.target }}/release/dispatch-courier-seren-cloud.exe" $ASSET
100+
echo "ASSET=$ASSET" | Out-File -FilePath $env:GITHUB_ENV -Append
101+
102+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
103+
with:
104+
name: dist-${{ matrix.target }}
105+
path: ${{ env.ASSET }}
106+
107+
release:
108+
name: Release
109+
needs: build
110+
runs-on: ubuntu-latest
111+
permissions:
112+
contents: write
113+
steps:
114+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
115+
with:
116+
persist-credentials: false
117+
118+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
119+
with:
120+
path: dist
121+
pattern: dist-*
122+
merge-multiple: true
123+
124+
- name: Generate checksums
125+
working-directory: dist
126+
run: sha256sum * > SHA256SUMS.txt
127+
128+
- name: Create release
129+
env:
130+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131+
TAG_NAME: ${{ github.ref_name }}
132+
run: |
133+
gh release create "$TAG_NAME" \
134+
--title "$TAG_NAME" \
135+
--generate-notes \
136+
dist/*

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

.pre-commit-config.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Pre-commit hooks
2+
# Install: prek install
3+
# Run manually: prek run --all-files
4+
5+
default_install_hook_types:
6+
- pre-commit
7+
- commit-msg
8+
9+
repos:
10+
- repo: https://github.com/pre-commit/pre-commit-hooks
11+
rev: v6.0.0
12+
hooks:
13+
- id: trailing-whitespace
14+
name: Remove trailing whitespace
15+
types: [text]
16+
exclude: "\\.md$"
17+
- id: end-of-file-fixer
18+
name: Ensure files end with newline
19+
types: [text]
20+
- id: mixed-line-ending
21+
name: Fix mixed line endings
22+
args: [--fix=lf]
23+
- id: check-yaml
24+
name: Check YAML syntax
25+
- id: check-toml
26+
name: Check TOML syntax
27+
- id: check-json
28+
name: Check JSON syntax
29+
- id: check-merge-conflict
30+
name: Check for merge conflicts
31+
- id: check-case-conflict
32+
name: Check for case conflicts
33+
34+
# Ensure files comply with .editorconfig (no formatting change, but fails fast)
35+
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
36+
rev: 3.4.1
37+
hooks:
38+
- id: editorconfig-checker
39+
alias: ec
40+
additional_dependencies: []
41+
42+
# Conventional commit messages
43+
- repo: https://github.com/compilerla/conventional-pre-commit
44+
rev: v4.3.0
45+
hooks:
46+
- id: conventional-pre-commit
47+
stages: [commit-msg]
48+
args: [--strict, .git/COMMIT_EDITMSG]
49+
pass_filenames: false
50+
51+
# Rust formatting (staged files only)
52+
- repo: local
53+
hooks:
54+
- id: rustfmt-staged
55+
name: rustfmt (staged files)
56+
entry: rustfmt
57+
language: system
58+
types: [rust]
59+
pass_filenames: true
60+
args: ["--edition", "2024"]
61+
62+
# Rust cargo check (warnings as errors)
63+
- repo: local
64+
hooks:
65+
- id: cargo-check
66+
name: cargo check (deny warnings)
67+
entry: sh -c 'set -eu; RUSTFLAGS="-D warnings" cargo check --workspace --locked'
68+
language: system
69+
types: [rust]
70+
pass_filenames: false
71+
72+
# Rust clippy (workspace)
73+
- repo: local
74+
hooks:
75+
- id: clippy
76+
name: clippy (deny warnings)
77+
entry: sh -c 'set -eu; cargo clippy --workspace --locked -- -D warnings'
78+
language: system
79+
types: [rust]
80+
pass_filenames: false

0 commit comments

Comments
 (0)