-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
76b8c26
commit 6bda510
Showing
9 changed files
with
389 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,8 @@ | ||
# See https://help.github.com/articles/about-codeowners/ | ||
# for more info about CODEOWNERS file | ||
|
||
# It uses the same pattern rule for gitignore file | ||
# https://git-scm.com/docs/gitignore#_pattern_format | ||
|
||
# Core | ||
* @nsyzrantsev |
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,22 @@ | ||
version: 2 | ||
updates: | ||
# Maintain dependencies for Cargo | ||
- package-ecosystem: cargo | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
|
||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: github-actions | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
groups: | ||
minor: | ||
update-types: | ||
- "minor" | ||
patch: | ||
update-types: | ||
- "patch" |
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,7 @@ | ||
pull_request_rules: | ||
- name: Automatic merge for Dependabot pull requests | ||
conditions: | ||
- author=dependabot[bot] | ||
actions: | ||
merge: | ||
method: squash |
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,50 @@ | ||
name: Continuous Deployment | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
jobs: | ||
generate-changelog: | ||
name: Generate changelog | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
release_body: ${{ steps.git-cliff.outputs.content }} | ||
steps: | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install git-cliff | ||
uses: actions-rs/cargo@v1 | ||
id: git-cliff | ||
with: | ||
command: install | ||
args: git-cliff | ||
- name: Run git-cliff to generate changelog | ||
run: git-cliff -vv --latest --no-exec --github-repo ${{ github.repository }} --config cliff.toml | ||
id: changelog | ||
|
||
publish-crates-io: | ||
name: Publish on crates.io | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set the release version | ||
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> "$GITHUB_ENV" | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
# - name: Publish the zefiro-core library | ||
# run: | | ||
# cargo publish --manifest-path zefiro-core/Cargo.toml \ | ||
# --locked --token ${{ secrets.CARGO_REGISTRY_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,128 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: "0 0 * * 0" | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
jobs: | ||
check: | ||
name: Check | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Install toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Check | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
args: --offline --verbose | ||
- name: Check without default features | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
args: --offline --no-default-features --verbose | ||
|
||
typos: | ||
name: Typos | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Check typos | ||
uses: crate-ci/typos@master | ||
|
||
test: | ||
name: Test suite | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Install toolchain | ||
uses: dtolnay/rust-toolchain@nightly | ||
- name: Checkout | ||
if: github.event_name != 'pull_request' | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Checkout | ||
if: github.event_name == 'pull_request' | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
fetch-depth: 0 | ||
- name: Setup cargo-tarpaulin | ||
uses: taiki-e/install-action@cargo-tarpaulin | ||
- name: Run tests | ||
run: | | ||
cargo test --all --no-default-features \ | ||
-- --skip "repo::test::git_upstream_remote" | ||
- name: Run tests | ||
run: | | ||
cargo tarpaulin --out xml --verbose --all-features \ | ||
-- --skip "repo::test::git_upstream_remote" | ||
- name: Upload reports to codecov | ||
uses: codecov/codecov-action@v5 | ||
with: | ||
name: code-coverage-report | ||
file: cobertura.xml | ||
flags: unit-tests | ||
fail_ci_if_error: true | ||
verbose: true | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
clippy: | ||
name: Lints | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Install toolchain | ||
uses: dtolnay/rust-toolchain@nightly | ||
with: | ||
components: clippy | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Check the lints | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: clippy | ||
args: --tests --verbose -- -D warnings | ||
|
||
rustfmt: | ||
name: Formatting | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Install toolchain | ||
uses: dtolnay/rust-toolchain@nightly | ||
with: | ||
components: rustfmt | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Check the formatting | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all -- --check --verbose | ||
|
||
msrv: | ||
name: Check Rust version | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install cargo-binstall | ||
uses: taiki-e/install-action@cargo-binstall | ||
- name: Install cargo-msrv | ||
run: cargo binstall -y cargo-msrv | ||
- name: Run cargo-msrv | ||
shell: bash | ||
run: | | ||
for package in zefiro-cli zefiro-core zefiro-ui; do | ||
printf "Checking MSRV for %s..." "$package" | ||
cargo msrv --output-format json --path "$package" verify | tail -n 1 | jq --exit-status '.success' | ||
done |
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,108 @@ | ||
# git-cliff ~ default configuration file | ||
# https://git-cliff.org/docs/configuration | ||
# | ||
# Lines starting with "#" are comments. | ||
# Configuration options are organized into tables and keys. | ||
# See documentation for more information on available options. | ||
|
||
|
||
[remote.github] | ||
owner = "zefiroproj" | ||
repo = "zefiro" | ||
|
||
[changelog] | ||
# template for the changelog header | ||
header = """ | ||
# Changelog\n | ||
All notable changes to this project will be documented in this file.\n | ||
""" | ||
# template for the changelog body | ||
# https://keats.github.io/tera/docs/#introduction | ||
body = """ | ||
{%- macro remote_url() -%} | ||
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }} | ||
{%- endmacro -%} | ||
{% macro print_commit(commit) -%} | ||
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\ | ||
{% if commit.breaking %}[**breaking**] {% endif %}\ | ||
{{ commit.message | upper_first }} - \ | ||
([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\ | ||
{% endmacro -%} | ||
{% if version %}\ | ||
{% if previous.version %}\ | ||
## [{{ version | trim_start_matches(pat="v") }}]\ | ||
({{ self::remote_url() }}/compare/{{ previous.version }}..{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }} | ||
{% else %}\ | ||
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} | ||
{% endif %}\ | ||
{% else %}\ | ||
## [unreleased] | ||
{% endif %}\ | ||
{% for group, commits in commits | group_by(attribute="group") %} | ||
### {{ group | striptags | trim | upper_first }} | ||
{% for commit in commits | ||
| filter(attribute="scope") | ||
| sort(attribute="scope") %} | ||
{{ self::print_commit(commit=commit) }} | ||
{%- endfor -%} | ||
{% raw %}\n{% endraw %}\ | ||
{%- for commit in commits %} | ||
{%- if not commit.scope -%} | ||
{{ self::print_commit(commit=commit) }} | ||
{% endif -%} | ||
{% endfor -%} | ||
{% endfor -%} | ||
{% raw %}\n{% endraw -%} | ||
""" | ||
# template for the changelog footer | ||
footer = """ | ||
<!-- generated by git-cliff --> | ||
""" | ||
# remove the leading and trailing s | ||
trim = true | ||
# postprocessors | ||
postprocessors = [ | ||
{ pattern = '<REPO>', replace = "https://github.com/zefiroproj/zefiro" }, # replace repository URL | ||
] | ||
|
||
[git] | ||
# parse the commits based on https://www.conventionalcommits.org | ||
conventional_commits = true | ||
# filter out the commits that are not conventional | ||
filter_unconventional = true | ||
# process each line of a commit as an individual commit | ||
split_commits = false | ||
# regex for preprocessing the commit messages | ||
commit_preprocessors = [ | ||
# Replace issue numbers | ||
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"}, | ||
# Check spelling of the commit with https://github.com/crate-ci/typos | ||
# If the spelling is incorrect, it will be automatically fixed. | ||
{ pattern = '.*', replace_command = 'typos --write-changes -' }, | ||
] | ||
# regex for parsing and grouping commits | ||
commit_parsers = [ | ||
{ message = "^feat", group = "<!-- 0 -->🚀 Features" }, | ||
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" }, | ||
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" }, | ||
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" }, | ||
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" }, | ||
{ message = "^style", group = "<!-- 5 -->🎨 Styling" }, | ||
{ message = "^test", group = "<!-- 6 -->🧪 Testing" }, | ||
{ message = "^chore\\(release\\): prepare for", skip = true }, | ||
{ message = "^chore\\(deps.*\\)", skip = true }, | ||
{ message = "^chore\\(pr\\)", skip = true }, | ||
{ message = "^chore\\(pull\\)", skip = true }, | ||
{ message = "^chore|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" }, | ||
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" }, | ||
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" }, | ||
] | ||
# filter out the commits that are not matched by commit parsers | ||
filter_commits = false | ||
# sort the tags topologically | ||
topo_order = false | ||
# sort the commits inside sections by oldest/newest order | ||
sort_commits = "newest" |
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,46 @@ | ||
#!/usr/bin/env bash | ||
|
||
if ! command -v typos &>/dev/null; then | ||
echo "typos is not installed. Run 'cargo install typos-cli' to install it, otherwise the typos won't be fixed" | ||
fi | ||
|
||
if ! command -v git-cliff &>/dev/null; then | ||
echo "git-cliff is not installed. Run 'cargo install git-cliff' to install it, otherwise the CHANGELOG.md won't be updated" | ||
fi | ||
|
||
if [ -z "$1" ]; then | ||
echo "Please provide a tag." | ||
echo "Usage: ./release.sh v[X.Y.Z]" | ||
exit | ||
fi | ||
|
||
echo "Preparing $1..." | ||
|
||
# update the version | ||
msg="# managed by release.sh" | ||
sed -E -i "s/^version = .* $msg$/version = \"${1#v}\" $msg/" zefiro*/Cargo.toml | ||
sed -E -i "s/^version = .* $msg$/version = \"${1#v}\" $msg/" Cargo.toml | ||
|
||
# update the changelog | ||
git cliff --config cliff.toml --tag "$1" >CHANGELOG.md | ||
git add -A && git commit -m "chore(release): prepare for $1" | ||
git show | ||
|
||
# generate a changelog for the tag message | ||
export GIT_CLIFF_TEMPLATE="\ | ||
{% for group, commits in commits | group_by(attribute=\"group\") %} | ||
{{ group | upper_first }}\ | ||
{% for commit in commits %} | ||
- {% if commit.breaking %}(breaking) {% endif %}{{ commit.message | upper_first }} ({{ commit.id | truncate(length=7, end=\"\") }})\ | ||
{% endfor %} | ||
{% endfor %}" | ||
changelog=$(git cliff --config examples/detailed.toml --unreleased --strip all) | ||
|
||
# create a signed tag | ||
git -c user.name="zefiro" \ | ||
-c user.email="[email protected]" \ | ||
-c user.signingkey="3ECB750FA11480F8DEF1E1B37614FD08EF9DB246" \ | ||
tag -s -a "$1" -m "Release $1" -m "$changelog" | ||
git tag -v "$1" | ||
echo "Done!" | ||
echo "Now push the commit (git push) and the tag (git push --tags)." |
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,15 @@ | ||
edition = "2018" | ||
max_width = 85 | ||
newline_style = "Unix" | ||
hard_tabs = true | ||
tab_spaces = 4 | ||
use_field_init_shorthand = true | ||
reorder_imports = true | ||
binop_separator = "Back" | ||
format_code_in_doc_comments = true | ||
format_strings = true | ||
imports_layout = "Vertical" | ||
normalize_doc_attributes = true | ||
overflow_delimited_expr = true | ||
struct_field_align_threshold = 20 | ||
wrap_comments = true |
Oops, something went wrong.