Skip to content

Commit 1a2b142

Browse files
authored
fix: improve regression-tests workflow structure and concurrency (#2948)
* fix: split regression-tests workflow into two separate flows * fix: merge back to a single file * use deployments.ref for PRs
1 parent 620ac0e commit 1a2b142

1 file changed

Lines changed: 21 additions & 35 deletions

File tree

.github/workflows/regression-tests.yml

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,15 @@ on:
77
env:
88
VERCEL_PROTECTION_BYPASS: ${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }}
99

10-
concurrency:
11-
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.deployment_status.target_url }}
12-
cancel-in-progress: true
13-
1410
jobs:
1511
detect-provider:
1612
name: Detect Deployment Provider
1713
runs-on: ubuntu-latest
1814
outputs:
1915
provider: ${{ steps.detect.outputs.provider }}
20-
is-preview: ${{ steps.detect.outputs.is-preview }}
2116
production-url: ${{ steps.detect.outputs.production-url }}
22-
is-canary-branch: ${{ steps.detect.outputs.is-canary-branch }}
2317
branch-label: ${{ steps.detect.outputs.branch-label }}
18+
is-preview: ${{ steps.detect.outputs.is-preview }}
2419
steps:
2520
- uses: actions/checkout@v4
2621

@@ -30,13 +25,17 @@ jobs:
3025
CREATOR="${{ github.event.deployment_status.creator.login }}"
3126
ENVIRONMENT="${{ github.event.deployment.environment }}"
3227
28+
if [[ "$ENVIRONMENT" == "Preview" ]]; then
29+
echo "is-preview=true" >> $GITHUB_OUTPUT
30+
else
31+
echo "is-preview=false" >> $GITHUB_OUTPUT
32+
fi
33+
3334
if [[ "$CREATOR" == "vercel[bot]" ]]; then
3435
echo "provider=vercel" >> $GITHUB_OUTPUT
36+
PKG_NAME=$(node -p "require('./core/package.json').name")
37+
3538
if [[ "$ENVIRONMENT" == "Preview" ]]; then
36-
echo "is-preview=true" >> $GITHUB_OUTPUT
37-
echo "is-canary-branch=false" >> $GITHUB_OUTPUT
38-
echo "branch-label=" >> $GITHUB_OUTPUT
39-
PKG_NAME=$(node -p "require('./core/package.json').name")
4039
case "$PKG_NAME" in
4140
"@bigcommerce/catalyst-core")
4241
echo "production-url=https://canary.catalyst-demo.site/" >> $GITHUB_OUTPUT ;;
@@ -46,58 +45,45 @@ jobs:
4645
echo "::warning::No production URL configured for package: $PKG_NAME. Skipping comparison."
4746
echo "production-url=" >> $GITHUB_OUTPUT ;;
4847
esac
48+
echo "branch-label=" >> $GITHUB_OUTPUT
4949
else
50-
PKG_NAME=$(node -p "require('./core/package.json').name")
51-
echo "is-preview=false" >> $GITHUB_OUTPUT
5250
case "$PKG_NAME" in
5351
"@bigcommerce/catalyst-core")
54-
echo "is-canary-branch=true" >> $GITHUB_OUTPUT
5552
echo "branch-label=canary" >> $GITHUB_OUTPUT
5653
echo "production-url=${{ github.event.deployment_status.target_url }}" >> $GITHUB_OUTPUT ;;
5754
"@bigcommerce/catalyst-makeswift")
58-
echo "is-canary-branch=true" >> $GITHUB_OUTPUT
5955
echo "branch-label=integrations/makeswift" >> $GITHUB_OUTPUT
6056
echo "production-url=${{ github.event.deployment_status.target_url }}" >> $GITHUB_OUTPUT ;;
6157
*)
62-
echo "is-canary-branch=false" >> $GITHUB_OUTPUT
6358
echo "branch-label=" >> $GITHUB_OUTPUT
6459
echo "production-url=" >> $GITHUB_OUTPUT ;;
6560
esac
6661
fi
6762
6863
elif [[ "$CREATOR" == "cloudflare-pages[bot]" ]]; then
6964
echo "provider=cloudflare" >> $GITHUB_OUTPUT
70-
echo "is-canary-branch=false" >> $GITHUB_OUTPUT
65+
echo "::warning::Cloudflare production URL not yet configured. Skipping comparison."
66+
echo "production-url=" >> $GITHUB_OUTPUT
7167
echo "branch-label=" >> $GITHUB_OUTPUT
72-
if [[ "$ENVIRONMENT" == "Preview" ]]; then
73-
echo "is-preview=true" >> $GITHUB_OUTPUT
74-
echo "::warning::Cloudflare production URL not yet configured. Skipping comparison."
75-
echo "production-url=" >> $GITHUB_OUTPUT
76-
else
77-
echo "is-preview=false" >> $GITHUB_OUTPUT
78-
echo "production-url=" >> $GITHUB_OUTPUT
79-
fi
8068
8169
else
8270
echo "::warning::Unknown deployment provider: $CREATOR. Skipping audits."
8371
echo "provider=unknown" >> $GITHUB_OUTPUT
84-
echo "is-preview=false" >> $GITHUB_OUTPUT
85-
echo "is-canary-branch=false" >> $GITHUB_OUTPUT
86-
echo "branch-label=" >> $GITHUB_OUTPUT
8772
echo "production-url=" >> $GITHUB_OUTPUT
73+
echo "branch-label=" >> $GITHUB_OUTPUT
8874
fi
8975
9076
unlighthouse-audit-preview:
9177
name: Unlighthouse Audit Preview (${{ needs.detect-provider.outputs.provider }}) - ${{ matrix.device }}
9278
needs: [detect-provider]
9379
if: needs.detect-provider.outputs.is-preview == 'true'
9480
runs-on: ubuntu-latest
81+
concurrency:
82+
group: regression-preview-${{ github.event.deployment.ref }}-${{ matrix.device }}
83+
cancel-in-progress: true
9584
strategy:
9685
matrix:
9786
device: [desktop, mobile]
98-
concurrency:
99-
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.deployment_status.target_url }}-${{ matrix.device }}
100-
cancel-in-progress: true
10187

10288
steps:
10389
- uses: actions/checkout@v4
@@ -130,14 +116,14 @@ jobs:
130116
unlighthouse-audit-production:
131117
name: Unlighthouse Audit Production (${{ needs.detect-provider.outputs.provider }}) - ${{ matrix.device }}
132118
needs: [detect-provider]
133-
if: (needs.detect-provider.outputs.is-preview == 'true' && needs.detect-provider.outputs.production-url != '') || needs.detect-provider.outputs.is-canary-branch == 'true'
119+
if: needs.detect-provider.outputs.production-url != ''
134120
runs-on: ubuntu-latest
121+
concurrency:
122+
group: regression-production-${{ github.event.deployment.environment == 'Preview' && github.event.deployment.ref || github.event.deployment.sha }}-${{ matrix.device }}
123+
cancel-in-progress: ${{ github.event.deployment.environment == 'Preview' }}
135124
strategy:
136125
matrix:
137126
device: [desktop, mobile]
138-
concurrency:
139-
group: ${{ github.workflow }}-${{ github.ref }}-production-${{ matrix.device }}
140-
cancel-in-progress: true
141127

142128
steps:
143129
- uses: actions/checkout@v4
@@ -210,7 +196,7 @@ jobs:
210196
unlighthouse-report:
211197
name: Unlighthouse Report (${{ needs.detect-provider.outputs.provider }}) — ${{ needs.detect-provider.outputs.branch-label }}
212198
needs: [detect-provider, unlighthouse-audit-production]
213-
if: needs.detect-provider.outputs.is-canary-branch == 'true'
199+
if: needs.detect-provider.outputs.is-preview == 'false' && needs.detect-provider.outputs.production-url != ''
214200
runs-on: ubuntu-latest
215201
permissions:
216202
contents: write

0 commit comments

Comments
 (0)