Skip to content

Commit fdf1752

Browse files
committed
chore: move git-metadata
Content is copied directly from [`git-metadata`]. [`git-metadata`]: https://github.com/git-ents/git-metadata
1 parent fdd95d0 commit fdf1752

27 files changed

Lines changed: 3717 additions & 0 deletions

.config/committed.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
subject_length = 90
2+
subject_capitalized = false
3+
subject_not_punctuated = true
4+
imperative_subject = true
5+
hard_line_length = 0
6+
line_length = 250
7+
style = "conventional"
8+
allowed_types = [
9+
"fix",
10+
"feat",
11+
"chore",
12+
"docs",
13+
"style",
14+
"refactor",
15+
"revert",
16+
"perf",
17+
"test",
18+
"release",
19+
]
20+
allowed_scopes = [
21+
"checks",
22+
"release",
23+
]
24+
merge_commit = false

.config/deny.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[licenses]
2+
3+
allow = [
4+
"MIT",
5+
"Apache-2.0",
6+
"Unicode-3.0",
7+
]

.config/pre-commit.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
exclude: ^(.*/)?(CHANGELOG\.md)$
2+
default_install_hook_types: [pre-commit, commit-msg]
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v6.0.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-json
11+
- id: check-added-large-files
12+
- repo: https://github.com/rvben/rumdl-pre-commit
13+
rev: v0.1.25
14+
hooks:
15+
- id: rumdl
16+
args: [--config, .config/rumdl.toml, --fix]
17+
- repo: https://github.com/crate-ci/typos
18+
rev: v1.43.5
19+
hooks:
20+
- id: typos
21+
args: [--write-changes, --force-exclude, --config, .config/typos.toml]
22+
- repo: https://github.com/crate-ci/committed
23+
rev: v1.1.10
24+
hooks:
25+
- id: committed
26+
args: [--config, .config/committed.toml, --commit-file]

.config/release-please-config.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"pull-request-header": "Release Notes",
3+
"changelog-path": "CHANGELOG.md",
4+
"draft": false,
5+
"include-component-in-tag": true,
6+
"include-v-in-tag": true,
7+
"release-type": "rust",
8+
"initial-version": "0.0.1",
9+
"draft-pull-request": true,
10+
"pull-request-title-pattern": "release: `${component}` v${version}",
11+
"pull-request-footer": "This release was generated with [Release Please](https://github.com/googleapis/release-please).",
12+
"packages": {
13+
"git-metadata": {}
14+
},
15+
"plugins": [{ "type": "sentence-case" }],
16+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
17+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"crates/git-metadata": "0.1.0"
3+
}

.config/rumdl.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[global]
2+
line-length = -1
3+
force-exclude = true
4+
5+
exclude = [
6+
".git",
7+
"dist",
8+
"build",
9+
"CHANGELOG.md",
10+
]
11+
12+
respect-gitignore = true
13+
14+
[MD013]
15+
reflow = true
16+
reflow-mode = "sentence-per-line"

.config/typos.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[files]
2+
3+
extend-exclude = [
4+
"CHANGELOG.md"
5+
]
6+
7+
# Enable checking of hidden files, dot files, and respect no ignore files
8+
# to catch maximum errors
9+
ignore-hidden = false
10+
ignore-files = false
11+
ignore-dot = false
12+
ignore-vcs = false
13+
ignore-global = false
14+
ignore-parent = false
15+
16+
[default]
17+
18+
# Check binary files as text to catch errors everywhere
19+
binary = true
20+
21+
# Enable all checks
22+
check-filename = true
23+
check-file = true
24+
25+
# Enable unicode support for comprehensive identifier checking
26+
unicode = true
27+
28+
# Keep hex checking disabled to avoid false positives in code
29+
ignore-hex = true
30+
31+
# Disable leading digits to catch more identifier errors
32+
identifier-leading-digits = false
33+
34+
# Use specific locale for stricter checking (en-us for consistency)
35+
locale = "en-us"
36+
37+
# Keep these empty to not ignore anything by default
38+
extend-ignore-identifiers-re = []
39+
extend-ignore-words-re = []
40+
extend-ignore-re = []

.github/workflows/CD.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: CD
2+
3+
on:
4+
release:
5+
types: [released, prereleased]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
check-tag:
13+
name: Check release tag
14+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
15+
runs-on: ubuntu-latest
16+
outputs:
17+
should-publish: ${{ github.event_name == 'workflow_dispatch' || steps.check.outputs.match == 'true' }}
18+
steps:
19+
- name: Match semver tag
20+
id: check
21+
if: github.event_name == 'release'
22+
run: |
23+
TAG="${{ github.event.release.tag_name }}"
24+
if [[ "$TAG" =~ ^git-metadata-v[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then
25+
echo "match=true" >> "$GITHUB_OUTPUT"
26+
else
27+
echo "match=false" >> "$GITHUB_OUTPUT"
28+
fi
29+
30+
release:
31+
name: Release
32+
needs: check-tag
33+
if: needs.check-tag.outputs.should-publish == 'true'
34+
runs-on: ubuntu-latest
35+
permissions:
36+
# Used to sign the release artifacts
37+
id-token: write
38+
# Used to upload release artifacts
39+
contents: write
40+
# Used to generate artifact attestation
41+
attestations: write
42+
steps:
43+
- uses: actions/checkout@v4
44+
- uses: actions-rust-lang/setup-rust-toolchain@v1
45+
with:
46+
cache: true
47+
toolchain: stable
48+
- name: Package crates
49+
run: cargo package --workspace
50+
- name: Generate artifact attestation
51+
uses: actions/attest-build-provenance@v2
52+
with:
53+
subject-path: "target/package/*.crate"
54+
- name: Publish to crates.io
55+
env:
56+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
57+
IS_PRERELEASE: ${{ github.event.release.prerelease }}
58+
run: |
59+
if [ "$IS_PRERELEASE" = "true" ]; then
60+
cargo publish --workspace --dry-run
61+
else
62+
cargo publish --workspace --token "$CARGO_REGISTRY_TOKEN"
63+
fi

.github/workflows/CI.yml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types:
9+
- opened
10+
- reopened
11+
- review_requested
12+
- ready_for_review
13+
- synchronize
14+
workflow_dispatch:
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
linux:
21+
runs-on: ${{ matrix.platform.runner }}
22+
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) }}
23+
strategy:
24+
matrix:
25+
platform:
26+
- runner: ubuntu-24.04
27+
target: x86_64
28+
- runner: ubuntu-24.04
29+
target: aarch64
30+
- runner: ubuntu-24.04
31+
target: armv7
32+
- runner: ubuntu-24.04
33+
target: s390x
34+
- runner: ubuntu-24.04
35+
target: ppc64le
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: actions-rust-lang/setup-rust-toolchain@v1
39+
with:
40+
cache: true
41+
- name: Build and compile project
42+
run: cargo test --workspace --all-features --no-run
43+
- name: Run tests
44+
run: cargo test --workspace --all-features
45+
46+
musllinux:
47+
runs-on: ${{ matrix.platform.runner }}
48+
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) }}
49+
strategy:
50+
matrix:
51+
platform:
52+
- runner: ubuntu-24.04
53+
target: x86_64
54+
- runner: ubuntu-24.04
55+
target: aarch64
56+
- runner: ubuntu-24.04
57+
target: armv7
58+
steps:
59+
- uses: actions/checkout@v4
60+
- uses: actions-rust-lang/setup-rust-toolchain@v1
61+
with:
62+
cache: true
63+
- name: Build and compile project
64+
run: cargo test --workspace --all-features --no-run
65+
- name: Run tests
66+
run: cargo test --workspace --all-features
67+
68+
windows:
69+
runs-on: ${{ matrix.platform.runner }}
70+
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) }}
71+
strategy:
72+
matrix:
73+
platform:
74+
- runner: windows-latest
75+
target: x64
76+
steps:
77+
- uses: actions/checkout@v4
78+
- uses: actions-rust-lang/setup-rust-toolchain@v1
79+
with:
80+
cache: true
81+
- name: Build and compile project
82+
run: cargo test --workspace --all-features --no-run
83+
- name: Run tests
84+
run: cargo test --workspace --all-features
85+
86+
macos:
87+
runs-on: ${{ matrix.platform.runner }}
88+
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) }}
89+
strategy:
90+
matrix:
91+
platform:
92+
- runner: macos-14
93+
target: aarch64
94+
steps:
95+
- uses: actions/checkout@v4
96+
- uses: actions-rust-lang/setup-rust-toolchain@v1
97+
with:
98+
cache: true
99+
- name: Build and compile project
100+
run: cargo test --workspace --all-features --no-run
101+
- name: Run tests
102+
run: cargo test --workspace --all-features
103+
104+
man:
105+
name: man-generation
106+
runs-on: ubuntu-24.04
107+
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) }}
108+
steps:
109+
- uses: actions/checkout@v6
110+
- uses: actions-rust-lang/setup-rust-toolchain@v1
111+
with:
112+
cache: true
113+
- name: Cache Cargo registry
114+
uses: actions/cache@v4
115+
with:
116+
path: |
117+
~/.cargo/registry/index/
118+
~/.cargo/registry/cache/
119+
~/.cargo/git/db/
120+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
121+
restore-keys: |
122+
${{ runner.os }}-cargo-registry-
123+
- name: Cache Cargo build
124+
uses: actions/cache@v4
125+
with:
126+
path: target
127+
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
128+
restore-keys: |
129+
${{ runner.os }}-cargo-build-
130+
- name: Generate man pages
131+
run: |
132+
cargo run --package git-metadata -- --generate-man target/debug/man
133+
134+
ci:
135+
name: CI
136+
if: ${{ always() && (github.event_name == 'workflow_dispatch' || github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false)) }}
137+
needs: [linux, musllinux, windows, macos, man]
138+
runs-on: ubuntu-latest
139+
steps:
140+
- run: |
141+
result="${{ (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) && 'failure' || 'success' }}"
142+
echo "result: $result"
143+
[[ "$result" == "success" ]] || exit 1

0 commit comments

Comments
 (0)