diff --git a/.github/workflows/merge-queue.yml b/.github/workflows/merge-queue.yml new file mode 100644 index 000000000..186b4ec22 --- /dev/null +++ b/.github/workflows/merge-queue.yml @@ -0,0 +1,18 @@ +name: Merge Queue + +on: + # We use Trunk Merge Queues so we use this `push` event instead of the + # `merge_queue` event, as per + # https://docs.trunk.io/merge/set-up-trunk-merge#configure-merge-requirements + push: + branches: + - trunk-merge/** + +jobs: + test: + name: Run tests + uses: ./.github/workflows/reusable-test.yml + + examples: + name: Build examples + uses: ./.github/workflows/reusable-examples.yml diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 000000000..8436cf960 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,19 @@ +name: Pull Request + +on: + pull_request: + # Recommended by Graphite: https://graphite.dev/docs/github-configuration-guidelines#github-actions + types: [opened, synchronize, reopened] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Run tests + uses: ./.github/workflows/reusable-test.yml + + examples: + name: Build examples + uses: ./.github/workflows/reusable-examples.yml diff --git a/.github/workflows/release.yml b/.github/workflows/push.yml similarity index 50% rename from .github/workflows/release.yml rename to .github/workflows/push.yml index 99ca634bf..8e3085347 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/push.yml @@ -1,20 +1,32 @@ -name: "Create release" +name: Push on: push: + # Only ever run `push` events against protected branches, likely just `main` branches: - main -# Release Please creates a Pull Request with changes to files -permissions: - contents: write - pull-requests: write +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: + test: + name: Run tests + uses: ./.github/workflows/reusable-test.yml + + examples: + name: Build examples + uses: ./.github/workflows/reusable-examples.yml + release: runs-on: ubuntu-latest # Release Please is very fast, so we set a tiny timeout timeout-minutes: 1 + # Release Please creates a Pull Request with changes to files + permissions: + contents: write + pull-requests: write steps: - name: Release Please uses: google-github-actions/release-please-action@a2d8d683f209466ee8c695cd994ae2cf08b1642d diff --git a/.github/workflows/examples.yml b/.github/workflows/reusable-examples.yml similarity index 90% rename from .github/workflows/examples.yml rename to .github/workflows/reusable-examples.yml index 539bd2369..25db3a241 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/reusable-examples.yml @@ -1,14 +1,12 @@ -name: "Build examples" +# Our reusable workflow files only use the `workflow_call` event and don't +# specify a `concurrency` limit so those things can be managed by the caller. +name: Reusable examples workflow -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true +on: [workflow_call] jobs: nextjs-13-pages-wrap: - name: "Next.js 13 + Page Router + withArcjet" + name: Next.js 13 + Page Router + withArcjet runs-on: ubuntu-latest steps: # Environment security @@ -42,7 +40,7 @@ jobs: run: npm run build nextjs-14-app-dir-rl: - name: "Next.js 14 + App Router + Rate Limit" + name: Next.js 14 + App Router + Rate Limit runs-on: ubuntu-latest steps: # Environment security @@ -76,7 +74,7 @@ jobs: run: npm run build nextjs-14-app-dir-validate-email: - name: "Next.js 14 + App Router + Validate Email" + name: Next.js 14 + App Router + Validate Email runs-on: ubuntu-latest steps: # Environment security @@ -110,7 +108,7 @@ jobs: run: npm run build nextjs-14-openai: - name: "Next.js 14 + OpenAI" + name: Next.js 14 + OpenAI runs-on: ubuntu-latest steps: # Environment security @@ -144,7 +142,7 @@ jobs: run: npm run build nextjs-14-pages-wrap: - name: "Next.js 14 + Page Router + withArcjet" + name: Next.js 14 + Page Router + withArcjet runs-on: ubuntu-latest steps: # Environment security diff --git a/.github/workflows/test.yml b/.github/workflows/reusable-test.yml similarity index 81% rename from .github/workflows/test.yml rename to .github/workflows/reusable-test.yml index 903ecfbfc..c30c2d10a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/reusable-test.yml @@ -1,10 +1,8 @@ -name: "Run tests" +# Our reusable workflow files only use the `workflow_call` event and don't +# specify a `concurrency` limit so those things can be managed by the caller. +name: Reusable test workflow -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true +on: [workflow_call] jobs: test: diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index dafc61c04..714907e31 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -53,3 +53,7 @@ actions: - trunk-check-pre-push - trunk-announce - trunk-upgrade-available +merge: + required_statuses: + - Run tests + - Build examples