| name: Build, unit test and lint branch |
|
|
| on: |
| pull_request: |
| merge_group: |
|
|
| concurrency: |
| group: ci-${{ github.event.pull_request.number || github.event.merge_group.head_sha || github.ref }} |
| cancel-in-progress: true |
|
|
| env: |
| COVERAGE_ENABLED: 'true' |
|
|
| jobs: |
| install-and-build: |
| name: Install & Build |
| runs-on: blacksmith-2vcpu-ubuntu-2204 |
| env: |
| NODE_OPTIONS: '--max-old-space-size=6144' |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| outputs: |
| non_python_changed: ${{ steps.paths-filter.outputs.non-python == 'true' }} |
| workflows_changed: ${{ steps.paths-filter.outputs.workflows == 'true' }} |
| commit_sha: ${{ steps.commit-sha.outputs.sha }} |
| steps: |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| with: |
| |
| ref: ${{ github.event_name == 'merge_group' && github.event.merge_group.head_sha || format('refs/pull/{0}/merge', github.event.pull_request.number) }} |
|
|
| - name: Capture commit SHA for cache consistency |
| id: commit-sha |
| run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" |
|
|
| - name: Check for relevant changes |
| uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 |
| id: paths-filter |
| with: |
| filters: | |
| non-python: |
| - '**' |
| - '!packages/@n8n/task-runner-python/**' |
| workflows: |
| - .github/** |
| - name: Setup and Build |
| if: steps.paths-filter.outputs.non-python == 'true' |
| uses: ./.github/actions/setup-nodejs |
|
|
| - name: Run format check |
| if: steps.paths-filter.outputs.non-python == 'true' |
| run: pnpm format:check |
|
|
| unit-test: |
| name: Unit tests |
| if: needs.install-and-build.outputs.non_python_changed == 'true' |
| uses: ./.github/workflows/units-tests-reusable.yml |
| needs: install-and-build |
| with: |
| ref: ${{ needs.install-and-build.outputs.commit_sha }} |
| collectCoverage: true |
| secrets: |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
|
|
| typecheck: |
| name: Typecheck |
| if: needs.install-and-build.outputs.non_python_changed == 'true' |
| runs-on: blacksmith-4vcpu-ubuntu-2204 |
| needs: install-and-build |
| steps: |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| with: |
| ref: ${{ needs.install-and-build.outputs.commit_sha }} |
|
|
| - name: Setup Node.js |
| uses: ./.github/actions/setup-nodejs |
| with: |
| build-command: pnpm typecheck |
|
|
| lint: |
| name: Lint |
| if: needs.install-and-build.outputs.non_python_changed == 'true' |
| uses: ./.github/workflows/linting-reusable.yml |
| needs: install-and-build |
| with: |
| ref: ${{ needs.install-and-build.outputs.commit_sha }} |
|
|
| e2e-tests: |
| name: E2E Tests |
| needs: install-and-build |
| if: needs.install-and-build.outputs.non_python_changed == 'true' |
| uses: ./.github/workflows/playwright-test-ci.yml |
| with: |
| branch: ${{ needs.install-and-build.outputs.commit_sha }} |
| secrets: inherit |
|
|
| security-checks: |
| name: Security Checks |
| needs: install-and-build |
| if: needs.install-and-build.outputs.workflows_changed == 'true' |
| uses: ./.github/workflows/ci-security.yml |
| with: |
| ref: ${{ needs.install-and-build.outputs.commit_sha }} |
| secrets: inherit |
|
|
| |
| |
| |
| |
| required-checks: |
| name: Required Checks |
| needs: [install-and-build, unit-test, typecheck, lint, e2e-tests, security-checks] |
| if: always() |
| runs-on: ubuntu-slim |
| steps: |
| - name: Fail if any required job failed or was skipped unexpectedly |
| |
| |
| |
| if: | |
| contains(needs.*.result, 'failure') || |
| (needs.install-and-build.outputs.non_python_changed == 'true' && ( |
| needs.unit-test.result == 'skipped' || |
| needs.typecheck.result == 'skipped' || |
| needs.lint.result == 'skipped' || |
| needs.e2e-tests.result == 'skipped' |
| )) || |
| (needs.install-and-build.outputs.workflows_changed == 'true' && |
| needs.security-checks.result == 'skipped') |
| run: exit 1 |
|
|