This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
generated from hack-ink/rust-initializer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0bc9e46
Showing
14 changed files
with
1,082 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "cargo" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
labels: | ||
- "Bot" | ||
- "Deps" | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
labels: | ||
- "Bot" | ||
- "GA" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Checks | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
GITHUB_CACHE_VERSION: 1 | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
RUST_BACKTRACE: full | ||
RUSTC_WRAPPER: sccache | ||
|
||
SCCACHE_LINK: https://github.com/mozilla/sccache/releases/download | ||
SCCACHE_VERSION: v0.3.0 | ||
SCCACHE_DIR: /home/runner/.cache/sccache | ||
|
||
jobs: | ||
cargo_checks: | ||
name: Task cargo ${{ matrix.action }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
action: [clippy, nextest] | ||
steps: | ||
- name: Fetch latest code | ||
uses: actions/checkout@v3 | ||
- name: Install Sccache | ||
run: | | ||
export SCCACHE_FILE=sccache-${{ env.SCCACHE_VERSION }}-x86_64-unknown-linux-musl | ||
curl -L ${{ env.SCCACHE_LINK }}/${{ env.SCCACHE_VERSION }}/$SCCACHE_FILE.tar.gz | tar xz | ||
sudo mv $SCCACHE_FILE/sccache /usr/bin | ||
sudo chmod u+x /usr/bin/sccache | ||
- name: Cache cargo | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
target | ||
key: cargo-${{ env.GITHUB_CACHE_VERSION }}-${{ matrix.action }}-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: cargo-${{ env.GITHUB_CACHE_VERSION }}-${{ matrix.action }}- | ||
- name: Cache sccache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.SCCACHE_DIR}} | ||
key: sccache-${{ env.GITHUB_CACHE_VERSION }}-${{ matrix.action }}--${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: sccache-${{ env.GITHUB_CACHE_VERSION }}-${{ matrix.action }}- | ||
- name: Cargo ${{ matrix.action }} | ||
if: matrix.action == 'clippy' | ||
uses: actions-rs/clippy-check@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
args: --workspace --all-features --all-targets --locked | ||
- name: Install cargo-nextest | ||
if: matrix.action == 'nextest' | ||
uses: taiki-e/install-action@nextest | ||
- name: Cargo nextest | ||
if: matrix.action == 'nextest' | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: nextest | ||
args: run --workspace --all-features --all-targets --locked |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | ||
- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
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-apple-darwin, os: macos-latest }, | ||
{ | ||
name: x86_64-pc-windows-msvc, | ||
os: windows-latest, | ||
extension: .exe, | ||
}, | ||
] | ||
steps: | ||
- name: Fetch latest code | ||
uses: actions/checkout@v3 | ||
- name: Setup Rust toolchain | ||
run: rustup target add ${{ matrix.target.name }} | ||
- name: Build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --release --locked --target ${{ matrix.target.name }} | ||
- name: Compress | ||
run: | | ||
mv target/${{ matrix.target.name }}/release/<NAME>${{ matrix.target.extension }} . | ||
zstd --ultra -22 -o <NAME>-${{ matrix.target.name }}.zst <NAME>${{ matrix.target.extension }} | ||
- name: Collect artifact | ||
run: | | ||
mkdir -p artifacts | ||
mv <NAME>-${{ matrix.target.name }}.zst artifacts | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3.1.2 | ||
with: | ||
name: artifacts | ||
path: artifacts | ||
|
||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v3 | ||
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@v3 | ||
# - name: Login | ||
# run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
# - name: Publish | ||
# run: .maintain/release.sh | ||
|
||
clean-artifacts: | ||
name: Clean artifacts | ||
if: always() | ||
needs: [release] | ||
steps: | ||
- name: Clean artifacts | ||
uses: geekyeggo/delete-artifact@v2 | ||
with: | ||
name: artifacts | ||
runs-on: ubuntu-latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
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-apple-darwin, os: macos-latest }, | ||
{ | ||
name: x86_64-pc-windows-msvc, | ||
os: windows-latest, | ||
extension: .exe, | ||
}, | ||
] | ||
steps: | ||
- name: Fetch latest code | ||
uses: actions/checkout@v3 | ||
- name: Setup Rust toolchain | ||
run: rustup target add ${{ matrix.target.name }} | ||
- name: Build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --release --locked --target ${{ matrix.target.name }} | ||
- name: Compress | ||
run: | | ||
mv target/${{ matrix.target.name }}/release/<NAME>${{ matrix.target.extension }} . | ||
zstd --ultra -22 -o <NAME>-${{ matrix.target.name }}.zst <NAME>${{ matrix.target.extension }} | ||
- name: Collect artifact | ||
run: | | ||
mkdir -p artifacts | ||
mv <NAME>-${{ matrix.target.name }}.zst artifacts | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3.1.2 | ||
with: | ||
name: artifacts | ||
path: artifacts | ||
|
||
staging: | ||
name: Staging | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: artifacts | ||
path: artifacts | ||
- name: Hash | ||
run: | | ||
cd artifacts | ||
sha256sum * | tee ../SHA256 | ||
md5sum * | tee ../MD5 | ||
mv ../SHA256 . | ||
mv ../MD5 . | ||
# publish-on-crates-io: | ||
# name: Publish on crates.io | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Fetch latest code | ||
# uses: actions/checkout@v3 | ||
# - name: Login | ||
# run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
# - name: Publish | ||
# run: .maintain/release.sh | ||
|
||
clean-artifacts: | ||
name: Clean artifacts | ||
if: always() | ||
needs: [staging] | ||
steps: | ||
- name: Clean artifacts | ||
uses: geekyeggo/delete-artifact@v2 | ||
with: | ||
name: artifacts | ||
runs-on: ubuntu-latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
test-data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
authors = ["Xavier Lau <xavier@inv.cafe>"] | ||
build = "build.rs" | ||
description = "<DESCRIPTION>" | ||
edition = "2021" | ||
homepage = "https://<NAME>.hack.ink" | ||
license = "GPL-3.0" | ||
name = "<NAME>" | ||
readme = "README.md" | ||
repository = "https://github.com/hack-ink/<NAME>" | ||
version = "0.1.0" |
Oops, something went wrong.