Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
AurevoirXavier authored Dec 29, 2023
0 parents commit 7aefeb7
Show file tree
Hide file tree
Showing 14 changed files with 1,124 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
root = true

[*]
charset=utf-8
end_of_line=lf
indent_size=tab
indent_style=tab
insert_final_newline=true
max_line_length=100
tab_width=4
trim_trailing_whitespace=true

[*.py]
charset=utf-8
indent_size=4
indent_style=space

[*.{sh,yml,yaml}]
indent_size=2
indent_style=space
tab_width=8
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "daily"
time: "00:00"
labels:
- "Bot"
- "Dep"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
time: "00:00"
labels:
- "Bot"
- "GA"
59 changes: 59 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Checks
on:
push:
branches:
- main
pull_request:
branches:
- main

env:
CACHE_VERSION: 0

CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
CARGO_TERM_COLOR: always

GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

RUST_BACKTRACE: full

jobs:
cargo-checks:
name: Task cargo ${{ matrix.action }}
runs-on: ubuntu-latest
strategy:
matrix:
action: [clippy, fmt, nextest]
steps:
- name: Fetch latest code
uses: actions/checkout@v4
- name: Setup build environment
if: matrix.action != 'fmt'
run: rustup show
- uses: Swatinem/rust-cache@v2
if: matrix.action != 'fmt'
with:
prefix-key: ${{ env.CACHE_VERSION }}
key: ${{ matrix.action }}
- name: Cargo clippy
if: matrix.action == 'clippy'
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --workspace --all-features --all-targets --locked
- name: Cargo fmt
if: matrix.action == 'fmt'
run: cargo fmt --all -- --check
- name: Install cargo-nextest
if: matrix.action == 'nextest'
uses: taiki-e/install-action@nextest
- name: Cargo nextest
if: matrix.action == 'nextest'
run: cargo nextest run --cargo-profile ci-dev --workspace --all-features --all-targets --locked
- name: Fast fail
uses: vishnudxb/[email protected]
if: failure()
with:
repo: hack-ink/<NAME>
workflow_id: ${{ github.run_id }}
access_token: ${{ github.token }}
34 changes: 34 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Pages

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
CARGO_TERM_COLOR: always

jobs:
deploy:
name: Deploy pages
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- name: Fetch latest code
uses: actions/checkout@v4
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: "latest"
- name: Build pages
run: mdbook build doc
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: doc/book
102 changes: 102 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

env:
CARGO_TERM_COLOR: always

jobs:
build:
name: Build ${{ matrix.target.name }} package
runs-on: ${{ matrix.target.os }}
strategy:
matrix:
target:
[
{ name: x86_64-unknown-linux-gnu, os: ubuntu-latest },
{ name: aarch64-apple-darwin, os: macos-latest },
{
name: x86_64-pc-windows-msvc,
os: windows-latest,
extension: .exe,
},
]
steps:
- name: Fetch latest code
uses: actions/checkout@v4
- name: Setup Rust toolchain
run: rustup target add ${{ matrix.target.name }}
- name: Build
run: cargo build --profile ci-release --locked --target ${{ matrix.target.name }}
- name: Compress
run: |
mv target/${{ matrix.target.name }}/ci-release/<NAME>${{ matrix.target.extension }} .
zstd --ultra -22 -o <NAME>-${{ matrix.target.name }}.zst <NAME>${{ matrix.target.extension }}
- name: Collect artifacts
run: |
mkdir -p artifacts
mv <NAME>-${{ matrix.target.name }}.zst artifacts
- name: Upload artifacts
uses: actions/[email protected]
with:
name: artifacts
path: artifacts
retention-days: 1

release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Publish
uses: softprops/action-gh-release@v1
with:
discussion_category_name: Announcements
generate_release_notes: true

release:
name: Release
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: artifacts
path: artifacts
- name: Hash
run: |
cd artifacts
sha256sum * | tee ../SHA256
md5sum * | tee ../MD5
mv ../SHA256 .
mv ../MD5 .
- name: Publish
uses: softprops/action-gh-release@v1
with:
discussion_category_name: Announcements
generate_release_notes: true
files: artifacts/*

publish-on-crates-io:
name: Publish on crates.io
runs-on: ubuntu-latest
steps:
- name: Fetch latest code
uses: actions/checkout@v4
- name: Login
run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish
run: cargo publish --locked

publish-on-crates-io:
name: Publish on crates.io
runs-on: ubuntu-latest
steps:
- name: Fetch latest code
uses: actions/checkout@v4
- name: Login
run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish
run: .maintain/release.sh
100 changes: 100 additions & 0 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Staging
on:
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
build:
name: Build ${{ matrix.target.name }} package
runs-on: ${{ matrix.target.os }}
strategy:
matrix:
target:
[
{ name: x86_64-unknown-linux-gnu, os: ubuntu-latest },
{ name: aarch64-apple-darwin, os: macos-latest },
{
name: x86_64-pc-windows-msvc,
os: windows-latest,
extension: .exe,
},
]
steps:
- name: Fetch latest code
uses: actions/checkout@v4
- name: Setup Rust toolchain
run: rustup target add ${{ matrix.target.name }}
- name: Build
run: cargo build --profile ci-release --locked --target ${{ matrix.target.name }}
- name: Compress
run: |
mv target/${{ matrix.target.name }}/ci-release/<NAME>${{ matrix.target.extension }} .
zstd --ultra -22 -o <NAME>-${{ matrix.target.name }}.zst <NAME>${{ matrix.target.extension }}
- name: Collect artifacts
run: |
mkdir -p artifacts
mv <NAME>-${{ matrix.target.name }}.zst artifacts
- name: Upload artifacts
uses: actions/[email protected]
with:
name: artifacts
path: artifacts
retention-days: 1

staging:
name: Staging
runs-on: ubuntu-latest
steps:
- name: Publish
uses: softprops/action-gh-release@v1
with:
discussion_category_name: Announcements
generate_release_notes: true

staging:
name: Staging
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: artifacts
path: artifacts
- name: Hash
run: |
cd artifacts
sha256sum * | tee ../SHA256
md5sum * | tee ../MD5
mv ../SHA256 .
mv ../MD5 .
# - name: Publish
# uses: softprops/action-gh-release@v1
# with:
# discussion_category_name: Announcements
# generate_release_notes: true
# files: artifacts/*

# publish-on-crates-io:
# name: Publish on crates.io
# runs-on: ubuntu-latest
# steps:
# - name: Fetch latest code
# uses: actions/checkout@v4
# - name: Login
# run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }}
# - name: Publish
# run: cargo publish --locked

# publish-on-crates-io:
# name: Publish on crates.io
# runs-on: ubuntu-latest
# steps:
# - name: Fetch latest code
# uses: actions/checkout@v4
# - name: Login
# run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }}
# - name: Publish
# run: .maintain/release.sh
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# System
.DS_Store

# Integrated development environment
.idea
.fleet
.vscode

# Package manager
## Cargo
target
## mdBook
book
index.html

# Test data
nohup.out
24 changes: 24 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Basic
edition = "2021"
hard_tabs = true
max_width = 100
tab_spaces = 4

# Imports
imports_granularity = "Crate"
reorder_imports = true

# Format comments
comment_width = 100
wrap_comments = true

# Misc
format_code_in_doc_comments = true
inline_attribute_width = 100
match_arm_blocks = false
match_block_trailing_comma = true
newline_style = "Unix"
reorder_impl_items = true
reorder_modules = true
use_field_init_shorthand = true
use_small_heuristics = "Max"
Loading

0 comments on commit 7aefeb7

Please sign in to comment.