Skip to content

Checks Rust code on push #50

Checks Rust code on push

Checks Rust code on push #50

Workflow file for this run

name: CI - Code Checks & Tests
run-name: Checks Rust code on ${{ github.event_name }}
on:
push:
paths:
- ".github/workflows/build.yml"
- "Cargo.*"
- "src/**"
pull_request:
paths:
- ".github/workflows/build.yml"
- "Cargo.*"
- "src/**"
env:
CARGO_TERM_COLOR: always
jobs:
ci_code_checks_and_tests:
runs-on: ubuntu-stable
strategy:
fail-fast: false
matrix:
features: [default, profile-with-puffin]
name: Code Checks for ${{ matrix.features }} feature(s)
steps:
- name: "Install dependencies Ubuntu"
run: |
sudo apt-get update && sudo apt-get install -y --no-install-recommends build-essential pkg-config
sudo apt-get install -y libleptonica-dev libtesseract-dev
- name: "Install rust-toolchain stable"
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: "Show environment"
run: |
rustc -vV
cargo -vV
- name: "Checkout"
uses: actions/checkout@v4
- name: "Cargo clippy"
id: cargo_clippy
if: $${{ always() }}
run: |
cargo clippy --profile=test --features ${{ matrix.features }}
- name: "Cargo test"
id: cargo_test
if: $${{ always() }}
run: |
cargo test --features ${{ matrix.features }}
- name: "Cargo formatting"
id: cargo_fmt
if: $${{ always() }}
run: |
cargo fmt --all -- --check
- name: "Cargo doc"
id: cargo_doc
env:
RUSTDOCFLAGS: "-D warnings"
if: $${{ always() }}
run: |
cargo doc
- name: "Some checks failed"
if: ${{ failure() }}
run: |
echo "### :x: Checks Failed!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "|Job|Status|" >> $GITHUB_STEP_SUMMARY
echo "|---|------|" >> $GITHUB_STEP_SUMMARY
echo "|Cargo clippy|${{ steps.cargo_clippy.outcome }}|" >> $GITHUB_STEP_SUMMARY
echo "|Cargo test|${{ steps.cargo_test.outcome }}|" >> $GITHUB_STEP_SUMMARY
echo "|Cargo fmt|${{ steps.cargo_fmt.outcome }}|" >> $GITHUB_STEP_SUMMARY
echo "|Cargo doc|${{ steps.cargo_doc.outcome }}|" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Please check the failed jobs and fix where needed." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
exit 1
- name: "All checks passed"
if: ${{ success() }}
run: |
echo "### :white_check_mark: Checks Passed!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY