-
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
Showing
5 changed files
with
256 additions
and
4 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,131 @@ | ||
name: Pipeline | ||
on: | ||
push: | ||
branches: | ||
- '*' | ||
pull_request: | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
run-tests: | ||
uses: ./.github/workflows/run-tests.yml | ||
|
||
bump-cargo-version: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- run-tests | ||
if: github.ref == 'refs/heads/main' && needs.run-tests.outputs.will-bump == 'true' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
name: Checkout the repository | ||
- uses: actions/[email protected] | ||
name: Cache cargo dependencies | ||
with: | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
path: | | ||
.cache | ||
~/.cargo/registry | ||
~/.cargo/git | ||
~/.cargo/bin | ||
target | ||
- uses: actions-rs/[email protected] | ||
name: Install rust toolchain | ||
with: | ||
default: true | ||
profile: minimal | ||
toolchain: stable | ||
- uses: actions-rs/[email protected] | ||
name: Build release version | ||
with: | ||
args: --release --locked | ||
command: build | ||
- name: Install cargo-edit | ||
run: cargo install cargo-edit | ||
- name: Set Cargo version | ||
run: cargo set-version "${NEW_VERSION#v}" | ||
env: | ||
NEW_VERSION: ${{ needs.run-tests.outputs.bump-version }} | ||
- name: Store updated Cargo files | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: bumped-files | ||
path: Cargo.* | ||
|
||
build-binaries: | ||
if: github.ref == 'refs/heads/main' | ||
runs-on: ${{ matrix.os }} | ||
needs: | ||
- run-tests | ||
steps: | ||
- run: ${{ matrix.install }} | ||
env: | ||
DEBIAN_FRONTEND: noninteractive | ||
name: Install additional dependencies | ||
- uses: actions/checkout@v4 | ||
name: Checkout the repository | ||
- uses: actions/[email protected] | ||
name: Cache cargo dependencies | ||
with: | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
path: | | ||
.cache | ||
~/.cargo/registry | ||
~/.cargo/git | ||
~/.cargo/bin | ||
target | ||
- uses: actions-rs/[email protected] | ||
name: Install rust toolchain | ||
with: | ||
default: true | ||
profile: minimal | ||
toolchain: stable | ||
- uses: actions-rs/[email protected] | ||
name: Build release version | ||
with: | ||
args: --release --locked | ||
command: build | ||
- id: get_repository_name | ||
name: Calculate repository name | ||
run: echo "REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk | ||
-F / '{print $2}' | sed -e "s/:refs//")" >> "$GITHUB_OUTPUT" | ||
shell: bash | ||
- name: Move binary to upload location | ||
env: | ||
TARGET: ${{ matrix.target }} | ||
EXTENSION: ${{ matrix.suffix }} | ||
REPOSITORY_NAME: ${{ steps.get_repository_name.outputs.REPOSITORY_NAME }} | ||
run: mv "./target/release/$REPOSITORY_NAME$EXTENSION" "./$REPOSITORY_NAME-$TARGET$EXTENSION" | ||
shell: bash | ||
- uses: actions/upload-artifact@v3 | ||
name: Store built binary version | ||
with: | ||
name: bins | ||
path: ${{ steps.get_repository_name.outputs.REPOSITORY_NAME }}-${{ matrix.target }}${{ matrix.suffix }} | ||
strategy: | ||
matrix: | ||
include: | ||
- os: macos-latest | ||
suffix: '' | ||
target: x86_64-apple-darwin | ||
install: '' | ||
- os: ubuntu-latest | ||
suffix: '' | ||
target: x86_64-unknown-linux-gnu | ||
install: '' | ||
- os: windows-latest | ||
suffix: .exe | ||
target: x86_64-pc-windows-msvc | ||
install: '' | ||
|
||
tag-and-release: | ||
needs: | ||
- build-binaries | ||
- bump-cargo-version | ||
uses: armakuni/github-actions/.github/workflows/[email protected] | ||
with: | ||
download-artifacts: true | ||
release-artifacts: ./bins/* | ||
|
||
|
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,74 @@ | ||
on: | ||
workflow_call: | ||
outputs: | ||
will-bump: | ||
value: ${{ jobs.check-conventional-commits.outputs.will-bump }} | ||
bump-version: | ||
value: ${{ jobs.check-conventional-commits.outputs.bump-version }} | ||
|
||
jobs: | ||
check-conventional-commits: | ||
uses: armakuni/github-actions/.github/workflows/[email protected] | ||
|
||
cargo-audit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: tomphp/github-actions/[email protected] | ||
- uses: actions-rs/[email protected] | ||
name: Audit check cargo packages | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
cargo-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: tomphp/github-actions/[email protected] | ||
- uses: actions-rs/[email protected] | ||
with: | ||
command: check | ||
|
||
cargo-test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
include: | ||
- os: macos-latest | ||
- os: ubuntu-latest | ||
- os: windows-latest | ||
steps: | ||
- uses: tomphp/github-actions/[email protected] | ||
- uses: specdown/[email protected] | ||
- name: Rename wsl bash | ||
if: runner.os == 'Windows' | ||
run: | | ||
takeown /F 'C:\Windows\System32\bash.exe' | ||
icacls 'C:\Windows\System32\bash.exe' /grant administrators:F | ||
ren 'C:\Windows\System32\bash.exe' wsl-bash.exe | ||
- run: cargo build --release | ||
- run: echo "$PWD/target/debug" >> "$GITHUB_PATH" | ||
shell: bash | ||
- run: cargo test --locked | ||
shell: bash | ||
|
||
lint: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
- os: windows-latest | ||
steps: | ||
- uses: tomphp/github-actions/[email protected] | ||
with: | ||
rust-components: rustfmt, clippy | ||
- uses: actions-rs/[email protected] | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
- uses: actions-rs/[email protected] | ||
with: | ||
command: clippy | ||
args: --all-targets --all-features -- -D warnings -Dclippy::all -D clippy::pedantic | ||
-D clippy::cargo -A clippy::multiple-crate-versions | ||
- uses: gaurav-nelson/[email protected] | ||
if: matrix.os == '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
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
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 @@ | ||
tag_prefix = "v" | ||
from_latest_tag = false | ||
ignore_merge_commits = true | ||
branch_whitelist = ["main"] | ||
pre_bump_hooks = [] | ||
post_bump_hooks = [ | ||
"git push", | ||
"git push origin v{{version}}", | ||
] | ||
pre_package_bump_hooks = [] | ||
post_package_bump_hooks = [] | ||
|
||
[git_hooks] | ||
|
||
[commit_types] | ||
|
||
[changelog] | ||
path = "CHANGELOG.md" | ||
template = "remote" | ||
remote = "github.com" | ||
repository = "versioned-files" | ||
owner = "tomphp" | ||
|
||
authors = [] |