β¬οΈ Update Rust crate axum π #856
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
# This file contains the CI workflow for the Mochi project. | |
# For simplicity we are compiling and testing everything on the Ubuntu environment only. | |
name: Mochi CI | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: 1 | |
CARGO_REGISTRY_DIR: ~/.cargo/registry | |
on: | |
workflow_dispatch: # Allows manual execution | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- '**.md' | |
- 'docs/**' | |
pull_request: | |
branches: [ main ] | |
types: [opened, synchronize, reopened] | |
paths-ignore: | |
- '**.md' | |
- 'docs/**' | |
# Avoid concurrent executions | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check: | |
name: π Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: π₯ Checkout sources | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: π¦ Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: π Run cargo check | |
run: | | |
echo "π Running cargo check..." | |
cargo check | |
echo "β Cargo check completed successfully!" | |
test: | |
name: π§ͺ Test Suite | |
needs: check | |
runs-on: ubuntu-latest | |
if: ${{ !contains(github.event.head_commit.message, '[skip-tests]') }} | |
steps: | |
- name: π₯ Checkout sources | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: π¦ Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: π§ͺ Run cargo test | |
run: | | |
echo "π§ͺ Starting test suite execution..." | |
cargo test | |
echo "β All tests passed successfully!" | |
clippy: | |
name: π¬ Clippy | |
needs: check | |
runs-on: ubuntu-latest | |
if: ${{ !contains(github.event.head_commit.message, '[skip-clippy]') }} | |
steps: | |
- name: π₯ Checkout sources | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: π¦ Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- name: π¬ Run cargo clippy | |
run: | | |
echo "π¬ Running Clippy analysis..." | |
cargo clippy | |
echo "β Clippy checks passed!" | |
fmt: | |
name: π Format | |
needs: check | |
runs-on: ubuntu-latest | |
if: ${{ !contains(github.event.head_commit.message, '[skip-fmt]') }} | |
steps: | |
- name: π₯ Checkout sources | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: π¦ Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- name: π Run cargo fmt | |
run: | | |
echo "π Checking code formatting..." | |
cargo fmt --all -- --check | |
echo "β Code formatting check passed!" | |
# Summary job that runs even if some jobs are skipped | |
pipeline-summary: | |
name: π Pipeline Summary | |
needs: [check, test, clippy, fmt] | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- name: π Generate Pipeline Summary | |
run: | | |
echo "## π‘ Mochi CI Pipeline Summary" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
# List skipped steps | |
if [[ "${{ contains(github.event.head_commit.message, '[skip-fmt]') }}" == "true" ]]; then | |
echo "βοΈ Format check was skipped via [skip-fmt]" >> $GITHUB_STEP_SUMMARY | |
fi | |
if [[ "${{ contains(github.event.head_commit.message, '[skip-clippy]') }}" == "true" ]]; then | |
echo "βοΈ Clippy analysis was skipped via [skip-clippy]" >> $GITHUB_STEP_SUMMARY | |
fi | |
if [[ "${{ contains(github.event.head_commit.message, '[skip-tests]') }}" == "true" ]]; then | |
echo "βοΈ Tests were skipped via [skip-tests]" >> $GITHUB_STEP_SUMMARY | |
fi | |
# Add job status summary | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "### π Job Status" >> $GITHUB_STEP_SUMMARY | |
echo "* π Check: ${{ needs.check.result }}" >> $GITHUB_STEP_SUMMARY | |
echo "* π§ͺ Tests: ${{ needs.test.result || 'Skipped' }}" >> $GITHUB_STEP_SUMMARY | |
echo "* π¬ Clippy: ${{ needs.clippy.result || 'Skipped' }}" >> $GITHUB_STEP_SUMMARY | |
echo "* π Format: ${{ needs.fmt.result || 'Skipped' }}" >> $GITHUB_STEP_SUMMARY |