-
Notifications
You must be signed in to change notification settings - Fork 14
Optimize CI: separate fast tests from live infrastructure tests #315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,8 +16,8 @@ permissions: | |
| deployments: write # Netlify action needs it | ||
|
|
||
| jobs: | ||
| # ─────────────────────────────────────── 1. BUILD & TEST ────────────────────────────────────── | ||
| build-and-test: | ||
| # ─────────────────────────────────────── 1. DB VERIFICATION ────────────────────────────────────── | ||
| db-verification: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | ||
|
|
@@ -27,35 +27,50 @@ jobs: | |
| fetch-depth: 0 | ||
|
|
||
| - uses: ./.github/actions/setup | ||
|
|
||
| - name: Setup Deno | ||
| uses: denoland/setup-deno@v2 | ||
| with: | ||
| deno-version: '1.45.2' | ||
| atlas-cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }} | ||
|
|
||
| - name: Set Nx SHAs for affected commands | ||
| uses: nrwl/nx-set-shas@v4 | ||
|
|
||
| - name: Verify NX_BASE and NX_HEAD are set | ||
| run: echo "BASE=$NX_BASE HEAD=$NX_HEAD" | ||
|
|
||
| - name: Run database verification | ||
| run: pnpm nx run core:db:verify | ||
graphite-app[bot] marked this conversation as resolved.
Show resolved
Hide resolved
graphite-app[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - name: Install sqruff | ||
| uses: quarylabs/install-sqruff-cli-action@main | ||
|
|
||
| - name: Setup Atlas | ||
| uses: ariga/setup-atlas@master | ||
| # ─────────────────────────────────────── 2. FAST TESTS ────────────────────────────────────── | ||
| fast-tests: | ||
| needs: [db-verification] | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: ./.github/actions/setup | ||
| with: | ||
| cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }} | ||
| atlas-cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }} | ||
|
|
||
| - name: Set Nx SHAs for affected commands | ||
| uses: nrwl/nx-set-shas@v4 | ||
|
|
||
| - name: Verify NX_BASE and NX_HEAD are set | ||
| run: echo "BASE=$NX_BASE HEAD=$NX_HEAD" | ||
|
|
||
| - name: Quality gate (lint + typecheck + test) | ||
| - name: Lint, typecheck, build, and fast tests | ||
graphite-app[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| run: pnpm nx affected -t lint typecheck test --parallel --configuration=production --base="$NX_BASE" --head="$NX_HEAD" | ||
|
|
||
| - name: Build all affected projects (except playground) | ||
| run: pnpm nx affected -t build --configuration=production --parallel --exclude=playground --base="$NX_BASE" --head="$NX_HEAD" | ||
|
|
||
|
|
||
| # ─────────────────────────────────────── 2. EDGE-WORKER E2E ────────────────────────────────────── | ||
| edge-worker-e2e: | ||
| # ─────────────────────────────────────── 3. CLI LIVE TESTS ────────────────────────────────────── | ||
| cli-live-tests: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider running live tests sequentially instead of in parallel by making cli-live-tests depend on db-verification, core-live-tests depend on cli-live-tests, client-live-tests depend on core-live-tests, and edge-worker-live-tests depend on client-live-tests. This would prevent resource conflicts at the cost of longer CI run times. Spotted by Graphite Agent (based on CI logs) |
||
| needs: [db-verification] | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | ||
|
|
@@ -65,45 +80,133 @@ jobs: | |
| fetch-depth: 0 | ||
|
|
||
| - uses: ./.github/actions/setup | ||
| with: | ||
| atlas-cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }} | ||
|
|
||
| - name: Setup Deno | ||
| uses: denoland/setup-deno@v2 | ||
| - name: Set Nx SHAs for affected commands | ||
| uses: nrwl/nx-set-shas@v4 | ||
|
|
||
| - name: Check if cli is affected | ||
| id: check-affected | ||
| run: | | ||
| if pnpm nx show projects --affected --base="$NX_BASE" --head="$NX_HEAD" | grep -q "^cli$"; then | ||
| echo "affected=true" >> $GITHUB_OUTPUT | ||
| echo "CLI is affected by changes" | ||
| else | ||
| echo "affected=false" >> $GITHUB_OUTPUT | ||
| echo "CLI is not affected by changes - skipping" | ||
| fi | ||
| - name: Run cli live tests | ||
| if: steps.check-affected.outputs.affected == 'true' | ||
| run: pnpm nx run cli:test:live | ||
|
|
||
|
|
||
| # ─────────────────────────────────────── 4. CORE LIVE TESTS ────────────────────────────────────── | ||
| core-live-tests: | ||
| needs: [db-verification] | ||
|
Comment on lines
+106
to
+107
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The core-live-tests job should depend on fast-tests instead of db-verification to ensure it runs after fast-tests completes, creating a sequential chain of jobs. Spotted by Graphite Agent (based on CI logs) |
||
| runs-on: ubuntu-latest | ||
| env: | ||
| NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| deno-version: '1.45.2' | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Install sqruff | ||
| uses: quarylabs/install-sqruff-cli-action@main | ||
| - uses: ./.github/actions/setup | ||
| with: | ||
| atlas-cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }} | ||
|
|
||
| - name: Setup Atlas | ||
| uses: ariga/setup-atlas@master | ||
| - name: Set Nx SHAs for affected commands | ||
| uses: nrwl/nx-set-shas@v4 | ||
|
|
||
| - name: Check if core is affected | ||
| id: check-affected | ||
| run: | | ||
| if pnpm nx show projects --affected --base="$NX_BASE" --head="$NX_HEAD" | grep -q "^core$"; then | ||
| echo "affected=true" >> $GITHUB_OUTPUT | ||
| echo "Core is affected by changes" | ||
| else | ||
| echo "affected=false" >> $GITHUB_OUTPUT | ||
| echo "Core is not affected by changes - skipping" | ||
| fi | ||
| - name: Run core live tests | ||
| if: steps.check-affected.outputs.affected == 'true' | ||
| run: pnpm nx run core:test:live | ||
|
|
||
|
|
||
| # ─────────────────────────────────────── 5. CLIENT LIVE TESTS ────────────────────────────────────── | ||
| client-live-tests: | ||
| needs: [db-verification] | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: ./.github/actions/setup | ||
| with: | ||
| cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }} | ||
| atlas-cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }} | ||
|
|
||
| - name: Set Nx SHAs for affected commands | ||
| uses: nrwl/nx-set-shas@v4 | ||
|
|
||
| - name: Verify NX_BASE and NX_HEAD are set | ||
| run: echo "BASE=$NX_BASE HEAD=$NX_HEAD" | ||
| - name: Check if client is affected | ||
| id: check-affected | ||
| run: | | ||
| if pnpm nx show projects --affected --base="$NX_BASE" --head="$NX_HEAD" | grep -q "^client$"; then | ||
| echo "affected=true" >> $GITHUB_OUTPUT | ||
| echo "Client is affected by changes" | ||
| else | ||
| echo "affected=false" >> $GITHUB_OUTPUT | ||
| echo "Client is not affected by changes - skipping" | ||
| fi | ||
| - name: Run client live tests | ||
| if: steps.check-affected.outputs.affected == 'true' | ||
| run: pnpm nx run client:test:live | ||
|
|
||
|
|
||
| # ─────────────────────────────────────── 6. EDGE-WORKER LIVE TESTS ────────────────────────────────────── | ||
| edge-worker-live-tests: | ||
| needs: [db-verification] | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: ./.github/actions/setup | ||
| with: | ||
| atlas-cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }} | ||
|
|
||
| - name: Check if edge-worker e2e tests are affected | ||
| - name: Set Nx SHAs for affected commands | ||
| uses: nrwl/nx-set-shas@v4 | ||
|
|
||
| - name: Check if edge-worker is affected | ||
| id: check-affected | ||
| run: | | ||
| if pnpm nx show projects --affected -t test:e2e --base="$NX_BASE" --head="$NX_HEAD" | grep -q "^edge-worker$"; then | ||
| if pnpm nx show projects --affected --base="$NX_BASE" --head="$NX_HEAD" | grep -q "^edge-worker$"; then | ||
| echo "affected=true" >> $GITHUB_OUTPUT | ||
| echo "Edge-worker e2e tests are affected by changes" | ||
| echo "Edge-worker is affected by changes" | ||
| else | ||
| echo "affected=false" >> $GITHUB_OUTPUT | ||
| echo "Edge-worker e2e tests are not affected by changes - skipping" | ||
| echo "Edge-worker is not affected by changes - skipping" | ||
| fi | ||
| - name: Run edge-worker e2e tests | ||
| - name: Run edge-worker live tests | ||
| if: steps.check-affected.outputs.affected == 'true' | ||
| run: pnpm nx affected -t test:e2e --parallel --base="$NX_BASE" --head="$NX_HEAD" | ||
| run: pnpm nx run edge-worker:test:live | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a timeout to prevent the edge-worker live tests from being terminated prematurely. Change to: run: pnpm nx run edge-worker:test:live --timeout=10m Spotted by Graphite Agent (based on CI logs) |
||
|
|
||
|
|
||
| # ────────────────────────────────── 3. DEPLOY PLAYGROUND ─────────────────────────── | ||
| # ────────────────────────────────── 7. DEPLOY PLAYGROUND ─────────────────────────── | ||
| deploy-playground: | ||
| needs: [build-and-test, edge-worker-e2e] | ||
| needs: [fast-tests] | ||
| if: false # Disabled | ||
| # if: >- | ||
| # ${{ | ||
|
|
@@ -143,9 +246,10 @@ jobs: | |
| preview-url: https://pr-${{ github.event.pull_request.number }}--pgflow-demo.netlify.app | ||
| production-url: https://playground.pgflow.dev | ||
|
|
||
| # ────────────────────────────────── 4. DEPLOY WEBSITE ─────────────────────────── | ||
|
|
||
| # ────────────────────────────────── 8. DEPLOY WEBSITE ─────────────────────────── | ||
| deploy-website: | ||
| needs: [build-and-test, edge-worker-e2e] | ||
| needs: [fast-tests, cli-live-tests, core-live-tests, client-live-tests, edge-worker-live-tests] | ||
| runs-on: ubuntu-latest | ||
| environment: ${{ github.event_name == 'pull_request' && 'preview' || 'production' }} | ||
| env: | ||
|
|
@@ -177,7 +281,7 @@ jobs: | |
| echo "affected=false" >> $GITHUB_OUTPUT | ||
| echo "Website is not affected by changes - skipping deployment" | ||
| fi | ||
| - name: Deploy website | ||
| id: deploy-website | ||
| if: steps.check-affected.outputs.affected == 'true' | ||
|
|
@@ -197,4 +301,3 @@ jobs: | |
| project-name: Website | ||
| preview-url: https://pr-${{ github.event.pull_request.number }}.pgflow.pages.dev | ||
| production-url: https://pgflow.dev | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step is failing because the 'quarylabs/install-sqruff-cli-action@main' action cannot successfully download and install the sqruff-linux-x86_64-musl.tar.gz file. Either pin this action to a specific stable version (e.g., 'quarylabs/install-sqruff-cli-action@v1.0.0') instead of using the potentially unstable '@main' reference, or temporarily remove this step until the upstream action is fixed.
Spotted by Graphite Agent (based on CI logs)

Is this helpful? React 👍 or 👎 to let us know.