From dc1c236f7cde2882c6a70a1d8bf967698ad91475 Mon Sep 17 00:00:00 2001 From: Xenira <1288524+Xenira@users.noreply.github.com> Date: Fri, 7 Nov 2025 10:35:17 +0100 Subject: [PATCH] ci: restructure master and pr workflows Master and PR workflows now use shared steps in order to separate the release workflow. --- .github/workflows/build.yml | 26 ++++++++------------------ .github/workflows/coverage.yml | 5 ++--- .github/workflows/docs.yml | 7 +------ .github/workflows/master.yml | 24 ++++++++++++++++++++++++ .github/workflows/merge_request.yml | 13 +++++++++++++ .github/workflows/release-plz.yml | 7 +++++++ 6 files changed, 55 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/master.yml create mode 100644 .github/workflows/merge_request.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ccdf92e6a..3acab2377 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,15 +1,15 @@ name: Build and Lint on: - schedule: - # runs every monday at midnight - - cron: "0 0 * * 1" - push: - branches: - - master - pull_request: + workflow_call: + inputs: + rust_cache_prefix: + description: "Cache busting prefix for Rust dependencies" + default: "v0-rust" + type: string + workflow_dispatch: env: # increment this manually to force cache eviction - RUST_CACHE_PREFIX: "v0-rust" + RUST_CACHE_PREFIX: ${{ inputs.rust_cache_prefix }} concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -226,13 +226,3 @@ jobs: - name: Test with embed feature run: cargo test --workspace --release --features closure,embed,anyhow --no-fail-fast - - release: - name: Create Release - if: github.ref == 'refs/heads/master' && github.event_name == 'push' - needs: [lint, build, test-embed] - permissions: - id-token: write - contents: write - pull-requests: write - uses: extphprs/ext-php-rs/.github/workflows/release-plz.yml@master diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 449ab665d..848961fec 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -3,9 +3,8 @@ on: push: branches-ignore: - "release-plz-*" - pull_request: - branches-ignore: - - "release-plz-*" + workflow_call: + workflow_dispatch: env: # increment this manually to force cache eviction RUST_CACHE_PREFIX: "v0-rust" diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6cb540b93..11fd63d5c 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,12 +1,7 @@ name: Deploy documentation on: + workflow_call: workflow_dispatch: - # runs every monday at midnight - schedule: - - cron: "0 0 * * 1" - push: - branches: - - master jobs: docs: diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml new file mode 100644 index 000000000..9b9d94d26 --- /dev/null +++ b/.github/workflows/master.yml @@ -0,0 +1,24 @@ +name: Master Branch Workflow +on: + push: + branches: + - master + workflow_dispatch: + +jobs: + build_and_lint: + name: Build and Lint + uses: ./.github/workflows/build.yml + release: + name: Create Release (MR) + needs: [build_and_lint] + uses: ./.github/workflows/release-plz.yml + docs: + name: Build and Deploy Documentation + needs: [release] + if: needs.release.outputs.release_created == 'true' + permissions: + id-token: write + contents: write + pull-requests: write + uses: ./.github/workflows/docs.yml diff --git a/.github/workflows/merge_request.yml b/.github/workflows/merge_request.yml new file mode 100644 index 000000000..193bfc625 --- /dev/null +++ b/.github/workflows/merge_request.yml @@ -0,0 +1,13 @@ +name: Merge Request Workflow +on: + pull_request: + workflow_dispatch: + +jobs: + build_and_lint: + name: Build and Lint + uses: ./.github/workflows/build.yml + coverage: + name: Code Coverage + if: ${{ ! startsWith(github.head_ref, 'release-plz-') }} + uses: ./.github/workflows/coverage.yml diff --git a/.github/workflows/release-plz.yml b/.github/workflows/release-plz.yml index a36e73d05..9776e1e7a 100644 --- a/.github/workflows/release-plz.yml +++ b/.github/workflows/release-plz.yml @@ -6,6 +6,10 @@ permissions: on: workflow_call: + outputs: + release_created: + description: "Indicates if a release was created" + value: ${{ jobs.release-plz-release.outputs.release_created }} workflow_dispatch: jobs: @@ -15,6 +19,8 @@ jobs: if: github.ref == 'refs/heads/master' permissions: id-token: write + outputs: + release_created: ${{ steps.release-plz.outputs.release_created }} env: clang: "17" php_version: "8.4" @@ -53,6 +59,7 @@ jobs: uses: rust-lang/crates-io-auth-action@v1 id: auth - name: Run release-plz + id: release-plz uses: release-plz/action@v0.5 with: command: release