-
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
1 parent
269b181
commit 4e97709
Showing
3 changed files
with
44 additions
and
64 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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
name: CD | ||
|
||
on: {} | ||
on: | ||
release: | ||
types: [published] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
@@ -10,13 +12,9 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: install cargo-release | ||
uses: taiki-e/install-action@v2 | ||
with: | ||
tool: [email protected] | ||
- name: login | ||
run: cargo login "$CARGO_AUTH_KEY" | ||
- uses: taiki-e/install-action@cargo-release | ||
- uses: taiki-e/install-action@cargo-make | ||
- run: cargo login "$CARGO_AUTH_KEY" | ||
env: | ||
CARGO_AUTH_KEY: ${{ secrets.CARGO_AUTH_KEY }} | ||
- name: publish | ||
run: cargo release publish --no-confirm --allow-branch "*" --workspace --all-features --execute | ||
- run: cargo make release |
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,45 +1,37 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
on: [push, pull_request] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
lint: | ||
# Avoid duplicate jobs on PR from a branch on the same repo | ||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: Build | ||
run: cargo build --workspace --all-features | ||
- name: cargo fmt | ||
run: cargo fmt --all -- --check | ||
- name: Clippy | ||
run: cargo clippy --workspace --all-features -- -D warnings | ||
- name: Build docs | ||
run: cargo doc --document-private-items --workspace --all-features --no-deps | ||
env: | ||
RUSTDOCFLAGS: -Dwarnings | ||
|
||
- uses: taiki-e/install-action@cargo-make | ||
- run: cargo make fmt-check | ||
- run: cargo make clippy | ||
- run: cargo make docs | ||
test: | ||
# Avoid duplicate jobs on PR from a branch on the same repo | ||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: Run tests for no features | ||
run: cargo test --all | ||
- uses: taiki-e/install-action@cargo-make | ||
- run: cargo make test | ||
|
||
alls-green: | ||
if: always() | ||
if: always() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) | ||
runs-on: ubuntu-latest | ||
needs: | ||
- lint | ||
- test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: re-actors/alls-green@release/v1 | ||
with: | ||
jobs: ${{ toJSON(needs) }} | ||
- run: ${{ !contains(needs.*.result, 'failure') }} |
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,45 +1,35 @@ | ||
[tasks.build-ci] | ||
description = "Build prima_tracing.rs inside CI." | ||
[tasks.build] | ||
description = "Runs the rust compiler." | ||
category = "Build" | ||
install_crate = false | ||
command = "cargo" | ||
args = ["build", "-j", "2", "--all-features"] | ||
args = [ | ||
"build", | ||
"@@remove-empty(CARGO_MAKE_CARGO_VERBOSE_FLAGS)", | ||
"@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )", | ||
] | ||
|
||
[tasks.format-ci] | ||
description = "Runs the cargo rustfmt plugin during CI." | ||
[tasks.fmt-check] | ||
description = "Runs the cargo rustfmt plugin." | ||
command = "cargo" | ||
args = ["fmt", "--all", "--", "--check"] | ||
args = ["fmt", "--", "--check"] | ||
|
||
[tasks.test] | ||
description = "Run tests." | ||
command = "cargo" | ||
args = ["test", "${@}"] | ||
args = ["test", "${@}", "--all-features"] | ||
|
||
[tasks.clippy-ci] | ||
[tasks.clippy] | ||
command = "cargo" | ||
args = ["clippy", "--all-features", "--", "-D", "warnings"] | ||
args = ["clippy", "--all-features", "--all-targets", "--", "-D", "warnings"] | ||
|
||
[tasks.cargo-prune] | ||
description = "Run cargo prune" | ||
[tasks.docs] | ||
description = "Build docs as they are rendered on docs.rs" | ||
command = "cargo" | ||
args = ["prune"] | ||
|
||
[tasks.print-stats] | ||
description = "Print cache size" | ||
command = "du" | ||
args = ["-sh", "target", ".cargo"] | ||
|
||
[tasks.cache-cleanup] | ||
description = "Clean CI cache" | ||
dependencies = ["cargo-prune", "delete-artifacts", "print-stats"] | ||
args = ["doc", "--document-private-items", "--all-features", "--no-deps"] | ||
env = { "RUSTDOCFLAGS" = "-Dwarnings" } | ||
|
||
[tasks.delete-artifacts] | ||
description = "Remove non cachable artifacts" | ||
script = [ | ||
''' | ||
#!/bin/bash | ||
set -e | ||
set -x | ||
find ./target/debug -type f -maxdepth 1 -delete || true | ||
rm -rf ./target/{debug,release}/deps/{*prima-tracing*} | ||
rm -rf ./target/{debug,release}/.fingerprint/*prima-tracing* | ||
''', | ||
] | ||
[tasks.release] | ||
description = "Task to release the package to crates.io" | ||
command = "cargo" | ||
args = ["release", "publish", "--no-confirm", "--allow-branch \"*\"", "--all-features", "--execute"] |