CI: initial github actions

This commit is contained in:
Michael Oultram
2023-12-29 21:33:50 +00:00
parent 1eecca7d83
commit fadc0c05ea
7 changed files with 258 additions and 0 deletions

69
.config/nextest.toml Normal file
View File

@@ -0,0 +1,69 @@
# This is the default config used by nextest. It is embedded in the binary at
# build time. It may be used as a template for .config/nextest.toml.
[store]
# The directory under the workspace root at which nextest-related files are
# written. Profile-specific storage is currently written to dir/<profile-name>.
dir = "target/nextest"
# This section defines the default nextest profile. Custom profiles are layered
# on top of the default profile.
[profile.default]
# "retries" defines the number of times a test should be retried. If set to a
# non-zero value, tests that succeed on a subsequent attempt will be marked as
# non-flaky. Can be overridden through the `--retries` option.
retries = 0
# Show these test statuses in the output.
#
# The possible values this can take are:
# * none: no output
# * fail: show failed (including exec-failed) tests
# * retry: show flaky and retried tests
# * slow: show slow tests
# * pass: show passed tests
# * skip: show skipped tests (most useful for CI)
# * all: all of the above
#
# Each value includes all the values above it; for example, "slow" includes
# failed and retried tests.
#
# Can be overridden through the `--status-level` flag.
status-level = "pass"
# "failure-output" defines when test failures are output to standard output.
# Accepted values are
# * "immediate": output failures as soon as they happen
# * "final": output failures at the end of the test run
# * "immediate-final": output failures as soon as they happen and at the end of
# the test run
# * "never": don't output failures at all
#
# For large test suites and CI it is generally useful to use "immediate-final".
#
# Can be overridden through the `--failure-output` option.
failure-output = "immediate"
# "success-output" controls output on success. This should generally be set to
# "never".
success-output = "never"
# Cancel the test run on the first failure. For CI runs, consider setting this
# to false.
#fail-fast = true
fail-fast = false
# Treat a test that takes longer than this as slow, and print a message.
slow-timeout = "60s"
[profile.default.junit]
# Output a JUnit report into the given file inside 'store.dir/<profile-name>'.
# If unspecified, JUnit is not written out.
# path = "junit.xml"
path = "report.xml"
# The name of the top-level "report" element in JUnit report. If aggregating
# reports across different test runs, it may be useful to provide separate names
# for each report.
report-name = "nextest-run"

View File

@@ -1 +1,26 @@
name: Check
on:
workflow_call:
env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mozilla-actions/sccache-action@v0.0.3
- uses: dtolnay/rust-toolchain@stable
- run: cargo clippy --workspace --locked --tests
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mozilla-actions/sccache-action@v0.0.3
- uses: dtolnay/rust-toolchain@stable
- run: cargo fmt --all --check

16
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,16 @@
name: CI
on:
pull_request:
merge_group:
push:
branches:
- main
jobs:
check:
uses: ./.github/workflows/check.yml
dependencies:
uses: ./.github/workflows/dependencies.yml
test:
uses: ./.github/workflows/test.yml

46
.github/workflows/dependencies.yml vendored Normal file
View File

@@ -0,0 +1,46 @@
name: Dependencies
on:
workflow_call:
env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
advisories:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mozilla-actions/sccache-action@v0.0.3
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@cargo-deny
- run: cargo deny check advisories
bans:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mozilla-actions/sccache-action@v0.0.3
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@cargo-deny
- run: cargo deny check bans
licences:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mozilla-actions/sccache-action@v0.0.3
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@cargo-deny
- run: cargo deny check licenses
sources:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mozilla-actions/sccache-action@v0.0.3
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@cargo-deny
- run: cargo deny check sources

64
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,64 @@
name: Test
on:
workflow_call:
env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
nightly:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mozilla-actions/sccache-action@v0.0.3
- uses: dtolnay/rust-toolchain@nightly
with:
components: llvm-tools-preview
- uses: taiki-e/install-action@cargo-nextest
- uses: taiki-e/install-action@cargo-llvm-cov
- name: Run tests
run: cargo llvm-cov --workspace --locked nextest --html
- name: Upload test report
uses: actions/upload-artifact@v3
if: always()
with:
name: report
path: target/nextest/default/report.xml
retention-days: 30
- name: Upload coverage results
uses: actions/upload-artifact@v3
if: always()
with:
name: coverage
path: target/llvm-cov/
retention-days: 30
stable:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mozilla-actions/sccache-action@v0.0.3
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@cargo-nextest
- run: cargo build --workspace --locked --verbose
- run: cargo nextest run --workspace --locked
msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mozilla-actions/sccache-action@v0.0.3
- uses: SebRollen/toml-action@v1.0.2
id: msrv
with:
file: 'Cargo.toml'
field: 'package.rust-version'
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.msrv.outputs.value }}
- uses: taiki-e/install-action@cargo-nextest
- run: cargo build --workspace --locked --verbose
- run: cargo nextest run --workspace --locked

37
deny.toml Normal file
View File

@@ -0,0 +1,37 @@
[advisories]
db-path = "~/.cargo/advisory-db"
db-urls = ["https://github.com/rustsec/advisory-db"]
vulnerability = "deny"
unmaintained = "deny"
yanked = "deny"
notice = "deny"
ignore = []
[bans]
multiple-versions = "warn"
wildcards = "warn"
highlight = "all"
# Certain crates/versions that will be skipped when doing duplicate detection.
skip = [
]
# Crate dependency trees that will be skipped when doing duplicate detection.
skip-tree = [
]
[licenses]
# The lint level for crates which do not have a detectable license
unlicensed = "deny"
allow = [
"Apache-2.0",
"BSD-3-Clause",
"GPL-3.0",
"MIT",
"Unicode-DFS-2016",
]
default = "deny"
[sources]
unknown-registry = "deny"
unknown-git = "deny"
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
allow-git = []

View File

@@ -3,6 +3,7 @@ name = "utils"
version = "0.8.2-master"
authors = ["Leonardo Gibrowski Faé <leonardo.fae44@gmail.com>"]
edition = "2021"
license-file = "../LICENSE"
[dependencies]
lazy_static = "1.4"