From 270888cbf30cf0799c3a4fa36d0cac64c06fe883 Mon Sep 17 00:00:00 2001 From: Sebastian Goeb Date: Tue, 3 Oct 2023 14:49:55 +0200 Subject: [PATCH] ci: split CI and PR workflows (#55) --- .github/workflows/cd.yml | 11 ++++++++--- .github/workflows/ci.yml | 4 ++-- .github/workflows/pr.yml | 42 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/pr.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 9754159..0dbf462 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,10 +1,15 @@ name: CD on: workflow_run: - workflows: [CI] - types: [completed] - branches: [main] # semantic-release supports distribution channels via other branches + workflows: + - CI + types: + - completed + branches: + - main # semantic-release supports distribution channels via other branches + concurrency: cd # don't run multiple releases in parallel and mess up the versions + jobs: build: if: ${{ github.event.workflow_run.conclusion == 'success' }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34fe6b7..52a31c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,8 @@ name: CI on: - pull_request: push: - branches: [main] + branches: + - main jobs: test: runs-on: ubuntu-latest diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..702ddf5 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,42 @@ +name: PR +on: + pull_request: +jobs: + test: + runs-on: ubuntu-latest + steps: + # setup + - name: Checkout Repo + uses: actions/checkout@v3 + + - name: Setup Rust + uses: ./.github/actions/setup + + - name: Install more cargo tools + uses: taiki-e/install-action@v2 + with: + tool: cargo-llvm-cov,cargo-nextest + + # test + - name: Run tests and generate coverage + run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info nextest --profile ci + + - uses: mikepenz/action-junit-report@v3 + if: always() + with: + check_name: test + report_paths: "**/junit.xml" + + # lint + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-features -- -D warnings + name: lint + if: always() + + # coverage + - name: Upload coverage to Coveralls + uses: coverallsapp/github-action@v2.0.0 + if: always() +