Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit e244d63

Browse files
authored
Initial commit
0 parents  commit e244d63

14 files changed

Lines changed: 1069 additions & 0 deletions

.editorconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
root = true
2+
3+
[*]
4+
charset=utf-8
5+
end_of_line=lf
6+
indent_size=tab
7+
indent_style=tab
8+
insert_final_newline=true
9+
max_line_length=100
10+
tab_width=4
11+
trim_trailing_whitespace=true
12+
13+
[*.py]
14+
charset=utf-8
15+
indent_size=4
16+
indent_style=space
17+
18+
[*.{sh,yml,yaml}]
19+
indent_size=2
20+
indent_style=space
21+
tab_width=8

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "cargo"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
labels:
8+
- "Bot"
9+
- "Deps"
10+
11+
- package-ecosystem: "github-actions"
12+
directory: "/"
13+
schedule:
14+
interval: "daily"
15+
labels:
16+
- "Bot"
17+
- "GA"

.github/workflows/checks.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Checks
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
10+
env:
11+
CARGO_INCREMENTAL: 1
12+
CARGO_TERM_COLOR: always
13+
14+
GITHUB_CACHE_VERSION: 1
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
17+
RUST_BACKTRACE: full
18+
19+
jobs:
20+
cargo-checks:
21+
name: Task cargo ${{ matrix.action }}
22+
runs-on: ubuntu-latest
23+
strategy:
24+
matrix:
25+
action: [clippy, fmt, nextest]
26+
steps:
27+
- name: Fetch latest code
28+
uses: actions/checkout@v3
29+
- name: Cache cargo
30+
uses: actions/cache@v3
31+
with:
32+
path: |
33+
~/.cargo/registry
34+
~/.cargo/git
35+
target
36+
key: cargo-${{ env.GITHUB_CACHE_VERSION }}-${{ matrix.action }}-${{ hashFiles('**/Cargo.lock') }}
37+
restore-keys: cargo-${{ env.GITHUB_CACHE_VERSION }}-${{ matrix.action }}-
38+
- name: Cargo ${{ matrix.action }}
39+
if: matrix.action == 'clippy'
40+
uses: actions-rs/clippy-check@v1
41+
with:
42+
token: ${{ secrets.GITHUB_TOKEN }}
43+
args: --workspace --all-features --all-targets --locked
44+
- name: Cargo ${{ matrix.action }}
45+
if: matrix.action == 'fmt'
46+
run: cargo ${{ matrix.action }} --all -- --check
47+
- name: Install cargo-nextest
48+
if: matrix.action == 'nextest'
49+
uses: taiki-e/install-action@nextest
50+
- name: Cargo ${{ matrix.action }}
51+
if: matrix.action == 'nextest'
52+
run: cargo ${{ matrix.action }} run --release --workspace --all-features --all-targets --locked
53+
- name: Fast fail
54+
uses: vishnudxb/cancel-workflow@v1.2
55+
if: failure()
56+
with:
57+
repo: hack-ink/<NAME>
58+
workflow_id: ${{ github.run_id }}
59+
access_token: ${{ github.token }}

.github/workflows/pages.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
deploy:
16+
name: Deploy pages
17+
runs-on: ubuntu-latest
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
steps:
21+
- name: Fetch latest code
22+
uses: actions/checkout@v3
23+
- name: Setup mdBook
24+
uses: peaceiris/actions-mdbook@v1
25+
with:
26+
mdbook-version: "latest"
27+
- name: Build pages
28+
run: mdbook build doc
29+
- name: Deploy
30+
uses: peaceiris/actions-gh-pages@v3
31+
if: ${{ github.ref == 'refs/heads/main' }}
32+
with:
33+
github_token: ${{ secrets.GITHUB_TOKEN }}
34+
publish_dir: doc/book

.github/workflows/release.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- "v[0-9]+.[0-9]+.[0-9]+"
6+
7+
env:
8+
CARGO_TERM_COLOR: always
9+
10+
jobs:
11+
build:
12+
name: Build ${{ matrix.target.name }} package
13+
runs-on: ${{ matrix.target.os }}
14+
strategy:
15+
matrix:
16+
target:
17+
[
18+
{ name: x86_64-unknown-linux-gnu, os: ubuntu-latest },
19+
{ name: aarch64-apple-darwin, os: macos-latest },
20+
{ name: x86_64-apple-darwin, os: macos-latest },
21+
{
22+
name: x86_64-pc-windows-msvc,
23+
os: windows-latest,
24+
extension: .exe,
25+
},
26+
]
27+
steps:
28+
- name: Fetch latest code
29+
uses: actions/checkout@v3
30+
- name: Setup Rust toolchain
31+
run: rustup target add ${{ matrix.target.name }}
32+
- name: Build
33+
run: cargo build --release --locked --target ${{ matrix.target.name }}
34+
- name: Compress
35+
run: |
36+
mv target/${{ matrix.target.name }}/release/<NAME>${{ matrix.target.extension }} .
37+
zstd --ultra -22 -o <NAME>-${{ matrix.target.name }}.zst <NAME>${{ matrix.target.extension }}
38+
- name: Collect artifact
39+
run: |
40+
mkdir -p artifacts
41+
mv <NAME>-${{ matrix.target.name }}.zst artifacts
42+
- name: Upload artifact
43+
uses: actions/upload-artifact@v3.1.2
44+
with:
45+
name: artifacts
46+
path: artifacts
47+
48+
release:
49+
name: Release
50+
runs-on: ubuntu-latest
51+
needs: [build]
52+
steps:
53+
- name: Download artifacts
54+
uses: actions/download-artifact@v3
55+
with:
56+
name: artifacts
57+
path: artifacts
58+
- name: Hash
59+
run: |
60+
cd artifacts
61+
sha256sum * | tee ../SHA256
62+
md5sum * | tee ../MD5
63+
mv ../SHA256 .
64+
mv ../MD5 .
65+
- name: Publish
66+
uses: softprops/action-gh-release@v1
67+
with:
68+
discussion_category_name: Announcements
69+
generate_release_notes: true
70+
files: artifacts/*
71+
72+
# publish-on-crates-io:
73+
# name: Publish on crates.io
74+
# runs-on: ubuntu-latest
75+
# steps:
76+
# - name: Fetch latest code
77+
# uses: actions/checkout@v3
78+
# - name: Login
79+
# run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }}
80+
# - name: Publish
81+
# run: .maintain/release.sh
82+
83+
clean-artifacts:
84+
name: Clean artifacts
85+
if: always()
86+
needs: [release]
87+
steps:
88+
- name: Clean artifacts
89+
uses: geekyeggo/delete-artifact@v2
90+
with:
91+
name: artifacts
92+
runs-on: ubuntu-latest

.github/workflows/staging.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Staging
2+
on:
3+
workflow_dispatch:
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
8+
jobs:
9+
build:
10+
name: Build ${{ matrix.target.name }} package
11+
runs-on: ${{ matrix.target.os }}
12+
strategy:
13+
matrix:
14+
target:
15+
[
16+
{ name: x86_64-unknown-linux-gnu, os: ubuntu-latest },
17+
{ name: aarch64-apple-darwin, os: macos-latest },
18+
{ name: x86_64-apple-darwin, os: macos-latest },
19+
{
20+
name: x86_64-pc-windows-msvc,
21+
os: windows-latest,
22+
extension: .exe,
23+
},
24+
]
25+
steps:
26+
- name: Fetch latest code
27+
uses: actions/checkout@v3
28+
- name: Setup Rust toolchain
29+
run: rustup target add ${{ matrix.target.name }}
30+
- name: Build
31+
run: cargo build --release --locked --target ${{ matrix.target.name }}
32+
- name: Compress
33+
run: |
34+
mv target/${{ matrix.target.name }}/release/<NAME>${{ matrix.target.extension }} .
35+
zstd --ultra -22 -o <NAME>-${{ matrix.target.name }}.zst <NAME>${{ matrix.target.extension }}
36+
- name: Collect artifact
37+
run: |
38+
mkdir -p artifacts
39+
mv <NAME>-${{ matrix.target.name }}.zst artifacts
40+
- name: Upload artifact
41+
uses: actions/upload-artifact@v3.1.2
42+
with:
43+
name: artifacts
44+
path: artifacts
45+
46+
staging:
47+
name: Staging
48+
runs-on: ubuntu-latest
49+
needs: [build]
50+
steps:
51+
- name: Download artifacts
52+
uses: actions/download-artifact@v3
53+
with:
54+
name: artifacts
55+
path: artifacts
56+
- name: Hash
57+
run: |
58+
cd artifacts
59+
sha256sum * | tee ../SHA256
60+
md5sum * | tee ../MD5
61+
mv ../SHA256 .
62+
mv ../MD5 .
63+
64+
# publish-on-crates-io:
65+
# name: Publish on crates.io
66+
# runs-on: ubuntu-latest
67+
# steps:
68+
# - name: Fetch latest code
69+
# uses: actions/checkout@v3
70+
# - name: Login
71+
# run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }}
72+
# - name: Publish
73+
# run: .maintain/release.sh
74+
75+
clean-artifacts:
76+
name: Clean artifacts
77+
if: always()
78+
needs: [staging]
79+
steps:
80+
- name: Clean artifacts
81+
uses: geekyeggo/delete-artifact@v2
82+
with:
83+
name: artifacts
84+
runs-on: ubuntu-latest

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# System
2+
.DS_Store
3+
4+
# Integrated development environment
5+
.idea
6+
.fleet
7+
.vscode
8+
9+
# Package manager
10+
## Cargo
11+
target
12+
## mdBook
13+
book
14+
index.html
15+
16+
# Test data
17+
test-data

.rustfmt.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Basic
2+
edition = "2021"
3+
hard_tabs = true
4+
max_width = 100
5+
tab_spaces = 4
6+
7+
# Imports
8+
imports_granularity = "Crate"
9+
reorder_imports = true
10+
11+
# Format comments
12+
comment_width = 100
13+
wrap_comments = true
14+
15+
# Misc
16+
format_code_in_doc_comments = true
17+
inline_attribute_width = 100
18+
match_arm_blocks = false
19+
match_block_trailing_comma = true
20+
newline_style = "Unix"
21+
reorder_impl_items = true
22+
reorder_modules = true
23+
use_field_init_shorthand = true
24+
use_small_heuristics = "Max"

Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
authors = ["Xavier Lau <xavier@inv.cafe>"]
3+
build = "build.rs"
4+
description = "<DESCRIPTION>"
5+
edition = "2021"
6+
homepage = "https://<NAME>.hack.ink"
7+
license = "GPL-3.0"
8+
name = "<NAME>"
9+
readme = "README.md"
10+
repository = "https://github.com/hack-ink/<NAME>"
11+
version = "0.1.0"

0 commit comments

Comments
 (0)