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 e6fb60f
Showing
14 changed files
with
1,269 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,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" |
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,60 @@ | ||
name: Checks | ||
|
||
env: | ||
CACHE_VERSION: 0 | ||
|
||
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | ||
CARGO_TERM_COLOR: always | ||
|
||
RUST_BACKTRACE: full | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
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: giraffate/clippy-action@v1 | ||
with: | ||
clippy_flags: --workspace --all-features --all-targets --locked | ||
- name: Cargo fmt | ||
if: matrix.action == 'fmt' | ||
run: | | ||
rustup toolchain install nightly | ||
rustup component add rustfmt --toolchain nightly | ||
cargo +nightly 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 }} |
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,97 @@ | ||
name: Release | ||
|
||
env: | ||
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | ||
CARGO_TERM_COLOR: always | ||
|
||
RUST_BACKTRACE: full | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" | ||
|
||
jobs: | ||
build: | ||
name: Build ${{ matrix.target.name }} package | ||
runs-on: ${{ matrix.target.os }} | ||
strategy: | ||
matrix: | ||
target: | ||
[ | ||
{ name: aarch64-apple-darwin, os: macos-latest }, | ||
{ name: x86_64-unknown-linux-gnu, os: ubuntu-latest }, | ||
{ name: x86_64-pc-windows-msvc, os: windows-latest }, | ||
] | ||
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: Pack (macOS) | ||
if: matrix.target.os == 'macos-latest' | ||
run: | | ||
mv target/${{ matrix.target.name }}/ci-release/<NAME> . | ||
zip <NAME>-${{ matrix.target.name }}.zip <NAME> | ||
- name: Pack (Windows) | ||
if: matrix.target.os == 'windows-latest' | ||
run: | | ||
mv target/${{ matrix.target.name }}/ci-release/<NAME>.exe . | ||
Compress-Archive -Path <NAME>.exe -DestinationPath <NAME>-${{ matrix.target.name }}.zip | ||
- name: Pack (Linux) | ||
if: matrix.target.os == 'ubuntu-latest' | ||
run: | | ||
mv target/${{ matrix.target.name }}/ci-release/<NAME> . | ||
tar -czvf <NAME>-${{ matrix.target.name }}.tar.gz <NAME> | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: <NAME>-${{ matrix.target.name }} | ||
path: <NAME>-${{ matrix.target.name }}.* | ||
retention-days: 1 | ||
|
||
# release: | ||
# name: Release | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Publish | ||
# uses: softprops/action-gh-release@v2 | ||
# 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 | ||
- name: Hash | ||
run: | | ||
mkdir -p artifacts | ||
mv <NAME>-*/* artifacts/ | ||
cd artifacts | ||
sha256sum * | tee ../SHA256 | ||
md5sum * | tee ../MD5 | ||
mv ../SHA256 . | ||
mv ../MD5 . | ||
- name: Publish | ||
uses: softprops/action-gh-release@v2 | ||
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 |
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,99 @@ | ||
name: Staging | ||
|
||
env: | ||
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | ||
CARGO_TERM_COLOR: always | ||
|
||
RUST_BACKTRACE: full | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: Build ${{ matrix.target.name }} package | ||
runs-on: ${{ matrix.target.os }} | ||
strategy: | ||
matrix: | ||
target: | ||
[ | ||
{ name: aarch64-apple-darwin, os: macos-latest }, | ||
{ name: x86_64-unknown-linux-gnu, os: ubuntu-latest }, | ||
{ name: x86_64-pc-windows-msvc, os: windows-latest }, | ||
] | ||
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: Pack (macOS) | ||
if: matrix.target.os == 'macos-latest' | ||
run: | | ||
mv target/${{ matrix.target.name }}/ci-release/<NAME> . | ||
zip <NAME>-${{ matrix.target.name }}.zip <NAME> | ||
- name: Pack (Windows) | ||
if: matrix.target.os == 'windows-latest' | ||
run: | | ||
mv target/${{ matrix.target.name }}/ci-release/<NAME>.exe . | ||
Compress-Archive -Path <NAME>.exe -DestinationPath <NAME>-${{ matrix.target.name }}.zip | ||
- name: Pack (Linux) | ||
if: matrix.target.os == 'ubuntu-latest' | ||
run: | | ||
mv target/${{ matrix.target.name }}/ci-release/<NAME> . | ||
tar -czvf <NAME>-${{ matrix.target.name }}.tar.gz <NAME> | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: <NAME>-${{ matrix.target.name }} | ||
path: <NAME>-${{ matrix.target.name }}.* | ||
retention-days: 1 | ||
|
||
# staging: | ||
# name: Staging | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Publish | ||
# uses: softprops/action-gh-release@v2 | ||
# 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: | | ||
mkdir -p artifacts | ||
mv <NAME>-*/* artifacts/ | ||
cd artifacts | ||
sha256sum * | tee ../SHA256 | ||
md5sum * | tee ../MD5 | ||
mv ../SHA256 . | ||
mv ../MD5 . | ||
ls -al | ||
# - name: Publish | ||
# uses: softprops/action-gh-release@v2 | ||
# 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 |
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,14 @@ | ||
# System | ||
.DS_Store | ||
|
||
# Integrated development environment | ||
.vscode | ||
|
||
# Package manager | ||
## Cargo | ||
target | ||
## NPM | ||
node_modules | ||
|
||
# Test data | ||
tmp |
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,33 @@ | ||
[package] | ||
authors = ["Xavier Lau <[email protected]>"] | ||
build = "build.rs" | ||
description = "<DESCRIPTION>" | ||
edition = "2021" | ||
homepage = "https://hack.ink/<NAME>" | ||
license = "GPL-3.0" | ||
name = "<NAME>" | ||
readme = "README.md" | ||
repository = "https://github.com/hack-ink/<NAME>" | ||
version = "0.1.0" | ||
|
||
[profile.ci-dev] | ||
incremental = false | ||
inherits = "dev" | ||
|
||
[profile.ci-release] | ||
inherits = "release" | ||
lto = true | ||
|
||
[build-dependencies] | ||
# crates.io | ||
vergen-gitcl = { version = "1.0", features = ["cargo"] } | ||
|
||
[dependencies] | ||
# crates.io | ||
anyhow = { version = "1.0" } | ||
app_dirs2 = { version = "2.5" } | ||
clap = { version = "4.5", features = ["derive"] } | ||
color-eyre = { version = "0.6" } | ||
tracing = { version = "0.1" } | ||
tracing-appender = { version = "0.2" } | ||
tracing-subscriber = { version = "0.3", features = ["env-filter"] } |
Oops, something went wrong.