-
Notifications
You must be signed in to change notification settings - Fork 2
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
9 changed files
with
311 additions
and
49 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,17 @@ | ||
name: Audit | ||
|
||
on: | ||
push: | ||
paths: | ||
- '**/Cargo.toml' | ||
- '**/Cargo.lock' | ||
|
||
jobs: | ||
security_audit: | ||
runs-on: ubuntu-latest | ||
permissions: write-all | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rs/audit-check@v1 | ||
with: | ||
token: ${{ secrets.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 |
---|---|---|
@@ -1,89 +1,78 @@ | ||
name: ci | ||
name: CI | ||
|
||
on: [push] | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
RUSTFLAGS: -Dwarnings | ||
|
||
jobs: | ||
cargo-tests: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
profile: minimal | ||
override: true | ||
- uses: Swatinem/rust-cache@v1 | ||
with: | ||
cache-on-failure: true | ||
- name: cargo test | ||
run: cargo test --all | ||
- name: cargo test all features | ||
run: cargo test --all --all-features | ||
- run: cargo test --all | ||
- run: cargo test --all --all-features | ||
|
||
cargo-lint: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
profile: minimal | ||
components: rustfmt, clippy | ||
override: true | ||
- uses: Swatinem/rust-cache@v1 | ||
with: | ||
cache-on-failure: true | ||
- name: cargo fmt | ||
run: cargo +nightly fmt --all -- --check | ||
- name: cargo clippy | ||
run: cargo +nightly clippy --all --all-features -- -D warnings | ||
- run: cargo +nightly fmt --all -- --check | ||
- run: cargo +nightly clippy --all --all-features -- -D warnings | ||
|
||
cargo-build: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
continue-on-error: true | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
profile: minimal | ||
override: true | ||
- uses: Swatinem/rust-cache@v1 | ||
with: | ||
cache-on-failure: true | ||
- name: build | ||
id: build | ||
continue-on-error: true | ||
- continue-on-error: true | ||
run: cargo build --all | ||
id: build | ||
|
||
cargo-doc: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
continue-on-error: true | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
profile: minimal | ||
override: true | ||
- uses: Swatinem/rust-cache@v1 | ||
with: | ||
cache-on-failure: true | ||
- name: doclint | ||
id: build | ||
- name: doclints | ||
continue-on-error: true | ||
run: RUSTDOCFLAGS="-D warnings" cargo doc --all --no-deps --all-features --document-private-items | ||
- name: doctest | ||
run: cargo test --doc --all --all-features | ||
id: build | ||
- run: cargo test --doc --all --all-features |
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,88 @@ | ||
name: Cross Release | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
extract-version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Export Crate Package Version | ||
run: echo "VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')" >> $GITHUB_OUTPUT | ||
id: export | ||
outputs: | ||
VERSION: ${{ steps.export.outputs.VERSION }} | ||
|
||
build: | ||
name: build release | ||
strategy: | ||
matrix: | ||
arch: | ||
[ | ||
aarch64-unknown-linux-gnu, | ||
x86_64-unknown-linux-gnu, | ||
x86_64-apple-darwin, | ||
aarch64-apple-darwin, | ||
x86_64-pc-windows-gnu, | ||
] | ||
include: | ||
- arch: aarch64-unknown-linux-gnu | ||
platform: ubuntu-20.04 | ||
profile: maxperf | ||
- arch: x86_64-unknown-linux-gnu | ||
platform: ubuntu-20.04 | ||
profile: maxperf | ||
- arch: x86_64-apple-darwin | ||
platform: macos-latest | ||
profile: maxperf | ||
- arch: aarch64-apple-darwin | ||
platform: macos-latest | ||
profile: maxperf | ||
- arch: x86_64-pc-windows-gnu | ||
platform: ubuntu-20.04 | ||
profile: maxperf | ||
|
||
runs-on: ${{ matrix.platform }} | ||
needs: extract-version | ||
env: | ||
VERSION: ${{ needs.extract-version.outputs.VERSION }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: rustup update stable | ||
- run: rustup target add ${{ matrix.arch }} | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
cache-on-failure: true | ||
- name: Apple M1 setup | ||
if: ${{ matrix.job.target == 'aarch64-apple-darwin' }} | ||
run: | | ||
echo "SDKROOT=$(xcrun -sdk macosx --show-sdk-path)" >> $GITHUB_ENV | ||
echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version)" >> $GITHUB_ENV | ||
- name: Build for ${{ matrix.arch }} | ||
run: | | ||
cargo install cross | ||
env PROFILE=${{ matrix.profile }} make build-${{ matrix.arch }} | ||
- name: Move cross-compiled binary | ||
if: matrix.arch != 'x86_64-pc-windows-gnu' | ||
run: | | ||
mkdir artifacts | ||
mv target/${{ matrix.arch }}/${{ matrix.profile }}/* ./artifacts | ||
- name: Create artifacts | ||
run: tar --directory=artifacts -czf release-${{ env.VERSION }}-${{ matrix.arch }}.tar.gz $(ls -U artifacts/ | head -1) | ||
shell: bash | ||
|
||
release: | ||
name: Release on Github | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
needs: [build, extract-version] | ||
env: | ||
VERSION: ${{ needs.extract-version.outputs.VERSION }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: "artifacts/*" | ||
tag: v${{ env.VERSION }} |
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,38 @@ | ||
name: Github Release | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_run: | ||
workflows: ["CI"] | ||
branches: [main] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
extract-crate-version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Export Crate Package Version | ||
run: echo "VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')" >> $GITHUB_OUTPUT | ||
id: export_crate_version | ||
outputs: | ||
VERSION: ${{ steps.export_crate_version.outputs.VERSION }} | ||
|
||
release: | ||
name: Release on Github | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
needs: [extract-crate-version] | ||
env: | ||
VERSION: ${{ needs.extract-crate-version.outputs.VERSION }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: cargo build --release | ||
- name: Generate the Release Tarball | ||
run: tar --directory=target/release -cf release.tar.gz $(ls -U target/release/ | head -1) | ||
- uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: "release.tar.gz" | ||
tag: v${{ env.VERSION }} |
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 @@ | ||
name: Manual Tag | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "The version to release. Should match the version in `Cargo.toml`. For example, 0.1.20" | ||
required: true | ||
|
||
jobs: | ||
tag: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: anothrNick/github-tag-action@master | ||
env: | ||
CUSTOM_TAG: v${{ inputs.version }} | ||
GITHUB_TOKEN: ${{ secrets.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,27 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_run: | ||
workflows: ["CI"] | ||
branches: [main] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
publish: | ||
name: Publish Crate to Crates.io | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- uses: baptiste0928/cargo-install@v2 | ||
with: | ||
crate: cargo-release | ||
- run: CARGO_REGISTRY_TOKEN=${CRATES_TOKEN} cargo release --execute --no-confirm --no-push --no-tag | ||
env: | ||
CRATES_TOKEN: ${{ secrets.CRATES_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,35 @@ | ||
name: Tag | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["CI"] | ||
branches: [main] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
extract-crate-version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Export Crate Package Version | ||
run: echo "VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')" >> $GITHUB_OUTPUT | ||
id: export_crate_version | ||
outputs: | ||
VERSION: ${{ steps.export_crate_version.outputs.VERSION }} | ||
|
||
tag: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
timeout-minutes: 20 | ||
needs: [extract-crate-version] | ||
env: | ||
VERSION: ${{ needs.extract-crate-version.outputs.VERSION }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Bump version and push tag | ||
uses: anothrNick/github-tag-action@master | ||
env: | ||
CUSTOM_TAG: v${{ env.VERSION }} | ||
GITHUB_TOKEN: ${{ secrets.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,43 @@ | ||
name: Validate Release Version | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
extract-github-tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-ecosystem/action-get-latest-tag@v1 | ||
id: get-latest-tag | ||
- name: Extract the git tag version | ||
run: echo "VERSION=$(echo ${{ steps.get-latest-tag.outputs.tag }} | sed 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')" >> $GITHUB_OUTPUT | ||
id: export-git-tag | ||
outputs: | ||
VERSION: ${{ steps.export-git-tag.outputs.VERSION }} | ||
|
||
extract-crate-version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Export Crate Package Version | ||
run: echo "VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')" >> $GITHUB_OUTPUT | ||
id: export_crate_version | ||
outputs: | ||
VERSION: ${{ steps.export_crate_version.outputs.VERSION }} | ||
|
||
validate-crate-version: | ||
runs-on: ubuntu-latest | ||
needs: [extract-github-tag, extract-crate-version] | ||
env: | ||
GIT_TAG: ${{ needs.extract-github-tag.outputs.VERSION }} | ||
CRATE_VERSION: ${{ needs.extract-crate-version.outputs.VERSION }} | ||
steps: | ||
- uses: baptiste0928/cargo-install@v2 | ||
with: | ||
crate: semver-util | ||
- name: Validate Semvers | ||
run: semver cmp ${{ env.CRATE_VERSION }} gt ${{ env.GIT_TAG }} || exit 1 |
Oops, something went wrong.