Skip to content

Commit

Permalink
Add specific CI flow for PR
Browse files Browse the repository at this point in the history
  • Loading branch information
felipet authored Oct 12, 2024
1 parent 1b8e0bb commit bc73708
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Rust CI Flow for Pull Requests

on:
pull_request:
branches: [ "main", "devel" ]
env:
CARGO_TERM_COLOR: always

jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Enforce formatting
run: cargo fmt --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Linting
run: cargo clippy --no-deps -- -D warnings

test:
name: Test
runs-on: ubuntu-latest
needs: [clippy, fmt]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install tarpaulin
run: cargo install cargo-tarpaulin
- name: Tests
run: cargo test -- --include-ignored
env:
MAILJET_API_KEY: ${{ secrets.MAILJET_API_KEY }}
MAILJET_API_USER: ${{ secrets.MAILJET_API_USER }}
MAILJET_FROM_EMAIL: ${{ vars.MAILJET_FROM_EMAIL }}
- name: Generate code coverage
run: cargo tarpaulin --verbose --all-features --timeout 120 --out xml
env:
MAILJET_API_KEY: ${{ secrets.MAILJET_API_KEY }}
MAILJET_API_USER: ${{ secrets.MAILJET_API_USER }}
MAILJET_FROM_EMAIL: ${{ vars.MAILJET_FROM_EMAIL }}
- name: Upload coverage to codecov.io
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true

0 comments on commit bc73708

Please sign in to comment.