diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f78b2895..6ca216f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,13 @@ -on: [push] +name: ci +on: + pull_request: + push: + branches: + - "main" -name: Continuous Integration +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true env: CARGO_TERM_COLOR: always @@ -10,25 +17,22 @@ env: GH_TOKEN: ${{ secrets.GH_PRIVATE_TOKEN }} jobs: - check: + check_and_test: + name: "check and test" runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/cache@v2 + - name: Setup Rust toolchain + uses: dtolnay/rust-toolchain@stable with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: check-cargo-${{ hashFiles('**/Cargo.lock') }} - - - uses: actions-rs/toolchain@v1 - with: - profile: minimal toolchain: stable components: rustfmt, clippy - - name: Prepare + - name: Cache Cargo build files + uses: Leafwing-Studios/cargo-cache@v1 + + - name: Prepare build env run: | git config --global credential.helper store git config --global --replace-all url.https://github.com/.insteadOf ssh://git@github.com/ @@ -38,6 +42,11 @@ jobs: sudo apt-get install -y lld librdkafka-dev libsasl2-dev - run: cargo check - - run: cargo test -- --nocapture - run: cargo fmt --all -- --check - run: cargo clippy -- -D warnings + + - name: Unit tests + run: cargo test --lib -- --nocapture + + - name: Integration tests + run: cargo test --test '*'