Skip to content

🩹 Fix git warnings in Github workflows #36

🩹 Fix git warnings in Github workflows

🩹 Fix git warnings in Github workflows #36

Workflow file for this run

name: Build
on:
push:
branches: [master, feature/*]
pull_request:
branches: [master]
workflow_call:
workflow_dispatch:
jobs:
format:
name: Check Format
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout 3rd-party
uses: ./.github/actions/checkout
- name: Install toolchain
uses: ./.github/actions/rust-toolchain
with:
components: rustfmt
- name: Check format
run: cargo fmt --all -- --check
check:
name: Check Manifest
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Prepare runner
uses: ./.github/actions/prepare-runner
- name: Install toolchain
uses: ./.github/actions/rust-toolchain
- name: Check manifest
run: cargo check --verbose --workspace
licenses:
name: Cargo licenses
runs-on: ubuntu-latest
continue-on-error: true
env:
OUTPUT_FILE: licenses.html
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Prepare runner
uses: ./.github/actions/prepare-runner
- name: Install toolchain
uses: ./.github/actions/rust-toolchain
- name: Install cargo-deny
uses: ./.github/actions/cargo-install
with:
target: cargo-deny
- name: Check cargo-deny
run: cargo deny check
- name: Generate license manifest
id: license-manifest
uses: ./.github/actions/cargo-about
with:
output-file: ${{env.OUTPUT_FILE}}
- name: Upload License Manifest Artifact
uses: actions/upload-artifact@v1
if: steps.license-manifest.outcome == 'success'
continue-on-error: true
with:
name: licenses
path: ${{env.OUTPUT_FILE}}
clippy:
name: Static Analysis
runs-on: ubuntu-latest
continue-on-error: true
permissions:
contents: read
security-events: write
actions: read
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout 3rd-party
uses: ./.github/actions/checkout
- name: Install toolchain
uses: ./.github/actions/rust-toolchain
with:
components: clippy
- name: Install clippy-sarif
uses: ./.github/actions/cargo-install
with:
target: clippy-sarif
- name: Install sarif-fmt
uses: ./.github/actions/cargo-install
with:
target: sarif-fmt
- name: Check clippy
continue-on-error: true
run: |
cargo clippy \
--no-deps \
--message-format=json \
-- --deny clippy::all \
| clippy-sarif \
| tee rust-clippy-results.sarif \
| sarif-fmt
- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: rust-clippy-results.sarif
wait-for-processing: true
doctest:
name: Doctest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Prepare runner
uses: ./.github/actions/prepare-runner
- name: Install toolchain
uses: ./.github/actions/rust-toolchain
- name: Doctest
run: cargo test --doc --verbose
build:
name: Build and Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
# - windows-latest
defaults:
run:
shell: bash
env:
OUTPUT_FILE: ${{ matrix.os }}-codecov.json
COVERAGE_MINIMUM: ${{ 0.0 }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Prepare runner
uses: ./.github/actions/prepare-runner
- name: Install toolchain
uses: ./.github/actions/rust-toolchain
with:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Build
id: build
uses: ./.github/actions/cargo-build
- name: Test
id: test
run: cargo test --verbose
- name: Generate Coverage Report
id: report
run: |
cargo llvm-cov --json --output-path ${{ env.OUTPUT_FILE }}
echo "coverage=$(cat ${{ env.OUTPUT_FILE }})" >> "${GITHUB_OUTPUT}"
- name: Check Coverage Requirement
if: env.COVERAGE_MINIMUM > 0.0
env:
COVERAGE: ${{fromJson(steps.report.outputs.coverage).data[0].totals.lines.percent}}
run: |
if [[ ${{env.COVERAGE_MINIMUM}} > ${{env.COVERAGE}} ]]; then
echo "Error: Project code coverage fell below minimum desired '${COVERAGE_MINIMUM}%'!" >&2
echo "The current coverage is '${COVERAGE}%.'" >&2
echo "Please either add more tests, or lower the requirements." >&2
exit 1
fi
- name: Upload Coverage Artifact
uses: actions/upload-artifact@v1
if: steps.report.outcome == 'success'
continue-on-error: true
with:
name: ${{matrix.os}}-codecov
path: ${{env.OUTPUT_FILE}}