Merge pull request #987 from jvanz/main #1662
Workflow file for this run
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
on: | |
- push | |
- pull_request | |
- workflow_call | |
name: Continuous integration | |
# Declare default permissions as read only. | |
permissions: read-all | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
check: | |
name: Cargo check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 | |
with: | |
command: check | |
version-check: | |
name: Check Cargo.toml version | |
if: github.ref_type == 'tag' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download source code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Check cargo file version | |
run: | | |
CARGO_VERSION=$(sed -n 's,^version = \"\(.*\)\",\1,p' Cargo.toml) | |
TAG_VERSION=$(echo ${{ github.ref_name }} | sed 's/v//') | |
if [ "$CARGO_VERSION" != "$TAG_VERSION" ];then | |
echo "::error title=Invalid Cargo.toml version::Cargo.toml version does not match the tag version" | |
exit 1 | |
fi | |
test: | |
name: Unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 | |
with: | |
command: test | |
args: --workspace --bins | |
e2e-tests: | |
name: E2E tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0 | |
- name: run e2e tests | |
run: make e2e-tests | |
coverage: | |
name: coverage | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@6da51af62171044932d435033daa70a0eb3383ba # v2.45.6 | |
with: | |
tool: cargo-llvm-cov | |
- name: Install cosign # this is needed by some of the e2e tests | |
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0 | |
- name: Generate tests coverage | |
run: cargo llvm-cov --lcov --output-path lcov.info | |
- name: Upload unit-tests coverage to Codecov | |
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7 | |
with: | |
files: lcov.info | |
fail_ci_if_error: true | |
name: unit-tests and e2e-tests | |
verbose: true | |
token: ${{ secrets.CODECOV_ORG_TOKEN }} | |
fmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- run: rustup component add rustfmt | |
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 | |
with: | |
command: fmt | |
args: --all -- --check | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- run: rustup component add clippy | |
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 | |
with: | |
command: clippy | |
args: -- -D warnings | |
shellcheck: | |
name: Shellcheck | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- run: shellcheck $(find scripts/ -name '*.sh') |