Skip to content

Commit acf15f3

Browse files
Merge branch 'main' into feat/org-wide-workflows
2 parents 1e79f55 + dbf4be2 commit acf15f3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+710
-104
lines changed

.github/actions/cache-build/action.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ runs:
2020
key-2: ${{ hashFiles('apps/**/**.[jt]s', 'apps/**/**.[jt]sx', 'packages/**/**.[jt]s', 'packages/**/**.[jt]sx', '!**/node_modules') }}
2121
key-3: ${{ github.event.pull_request.number || github.ref }}
2222
key-4: ${{ github.sha }}
23+
key-5: ${{ github.event.pull_request.head.sha }}
2324
with:
2425
path: |
2526
${{ github.workspace }}/apps/web/.next
2627
${{ github.workspace }}/apps/web/public/embed
2728
**/.turbo/**
2829
**/dist/**
29-
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ env.key-3 }}-${{ env.key-4 }}
30+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ env.key-3 }}-${{ env.key-4 }}-${{ env.key-5 }}
3031
- run: |
3132
export NODE_OPTIONS="--max_old_space_size=8192"
3233
yarn build

.github/workflows/api-v1-production-build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
- uses: ./.github/actions/yarn-install
6666
- uses: ./.github/actions/cache-db
6767
- name: Cache API v1 production build
68-
uses: buildjet/cache@v3
68+
uses: buildjet/cache@v4
6969
id: cache-api-v1-build
7070
env:
7171
cache-name: api-v1-build

.github/workflows/api-v2-production-build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- uses: ./.github/actions/dangerous-git-checkout
3535
- uses: ./.github/actions/yarn-install
3636
- name: Cache API v2 production build
37-
uses: buildjet/cache@v3
37+
uses: buildjet/cache@v4
3838
id: cache-api-v2-build
3939
env:
4040
cache-name: api-v2-build

.github/workflows/nextjs-bundle-analysis.yml

-6
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,7 @@ env:
4545
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
4646

4747
jobs:
48-
build:
49-
name: Production builds
50-
if: ${{ github.event_name == 'push' }}
51-
uses: ./.github/workflows/production-build-without-database.yml
52-
secrets: inherit
5348
analyze:
54-
needs: build
5549
if: always()
5650
runs-on: buildjet-2vcpu-ubuntu-2204
5751
steps:

.github/workflows/pr-labeled.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: PR Labeled with ready-for-e2e
2+
3+
on:
4+
pull_request_target:
5+
types: [labeled]
6+
branches:
7+
- main
8+
- gh-actions-test-branch
9+
workflow_dispatch:
10+
jobs:
11+
run-e2e-jobs:
12+
name: Run E2E Jobs
13+
runs-on: buildjet-2vcpu-ubuntu-2204
14+
permissions:
15+
pull-requests: read
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: ./.github/actions/dangerous-git-checkout
19+
20+
- name: Check Label and Retrigger Checks
21+
uses: actions/github-script@v7
22+
with:
23+
github-token: ${{ secrets.GITHUB_TOKEN }}
24+
script: |
25+
const labelName = context.payload.label.name;
26+
const prNumber = context.payload.pull_request.number;
27+
const owner = context.repo.owner;
28+
const repo = context.repo.repo;
29+
30+
if (labelName === 'ready-for-e2e') {
31+
console.log(`Running E2E jobs for PR #${prNumber}...`);
32+
33+
const checkRuns = await github.rest.checks.listForRef({
34+
owner,
35+
repo,
36+
ref: context.payload.pull_request.head.sha,
37+
});
38+
39+
for (const check of checkRuns.data.check_runs) {
40+
console.log('check.name', check.name);
41+
if (check.name.includes('e2e')) {
42+
await github.rest.actions.reRunJob({
43+
owner,
44+
repo,
45+
job_id: check.id,
46+
});
47+
console.log(`Triggering job #${check.id}`);
48+
}
49+
}
50+
51+
console.log(`Triggered E2E checks for PR #${prNumber}`);
52+
} else {
53+
console.log(`Label ${labelName} does not trigger re-running checks.`);
54+
}

.github/workflows/pr-review.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: PR Reviewed
2+
3+
on:
4+
pull_request_review:
5+
types: [submitted]
6+
7+
jobs:
8+
label-pr:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Label PR as ready for E2E
13+
if: github.event.review.state == 'approved'
14+
uses: actions-ecosystem/action-add-labels@v1
15+
with:
16+
github_token: ${{ secrets.GITHUB_TOKEN }}
17+
labels: 'ready-for-e2e'

.github/workflows/pr.yml

+117-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
pull_request_target:
55
branches:
66
- main
7+
- gh-actions-test-branch
78
workflow_dispatch:
89

910
concurrency:
@@ -18,6 +19,7 @@ jobs:
1819
pull-requests: read
1920
outputs:
2021
has-files-requiring-all-checks: ${{ steps.filter.outputs.has-files-requiring-all-checks }}
22+
commit-sha: ${{ steps.get_sha.outputs.commit-sha }}
2123
steps:
2224
- uses: actions/checkout@v4
2325
- uses: ./.github/actions/dangerous-git-checkout
@@ -27,37 +29,146 @@ jobs:
2729
filters: |
2830
has-files-requiring-all-checks:
2931
- "!(**.md|.github/CODEOWNERS)"
32+
- name: Get Latest Commit SHA
33+
id: get_sha
34+
run: |
35+
echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
36+
37+
check-label:
38+
needs: [changes]
39+
runs-on: buildjet-2vcpu-ubuntu-2204
40+
name: Check for E2E label
41+
outputs:
42+
run-e2e: ${{ steps.check-if-pr-has-label.outputs.run-e2e == 'true' && (github.event.action != 'labeled' || (github.event.action == 'labeled' && github.event.label.name == 'ready-for-e2e')) }}
43+
steps:
44+
- name: Check if PR exists with ready-for-e2e label for this SHA
45+
id: check-if-pr-has-label
46+
uses: actions/github-script@v7
47+
with:
48+
script: |
49+
let labels = [];
50+
51+
if (context.payload.pull_request) {
52+
labels = context.payload.pull_request.labels;
53+
} else {
54+
try {
55+
const sha = '${{ needs.changes.outputs.commit-sha }}';
56+
console.log('sha', sha);
57+
const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
58+
owner: context.repo.owner,
59+
repo: context.repo.repo,
60+
commit_sha: sha
61+
});
62+
63+
if (prs.length === 0) {
64+
core.setOutput('run-e2e', false);
65+
console.log(`No pull requests found for commit SHA ${sha}`);
66+
return;
67+
}
68+
69+
const pr = prs[0];
70+
console.log(`PR number: ${pr.number}`);
71+
console.log(`PR title: ${pr.title}`);
72+
console.log(`PR state: ${pr.state}`);
73+
console.log(`PR URL: ${pr.html_url}`);
74+
75+
labels = pr.labels;
76+
}
77+
catch (e) {
78+
core.setOutput('run-e2e', false);
79+
console.log(e);
80+
}
81+
}
82+
83+
const labelFound = labels.map(l => l.name).includes('ready-for-e2e');
84+
console.log('Found the label?', labelFound);
85+
core.setOutput('run-e2e', labelFound);
86+
3087
type-check:
3188
name: Type check
32-
needs: [changes]
89+
needs: [changes, check-label]
3390
if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
3491
uses: ./.github/workflows/check-types.yml
3592
secrets: inherit
3693

3794
lint:
3895
name: Linters
39-
needs: [changes]
96+
needs: [changes, check-label]
4097
if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
4198
uses: ./.github/workflows/lint.yml
4299
secrets: inherit
43100

44101
unit-test:
45102
name: Tests
46-
needs: [changes]
103+
needs: [changes, check-label]
47104
if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
48105
uses: ./.github/workflows/unit-tests.yml
49106
secrets: inherit
50107

51108
integration-test:
52109
name: Tests
53-
needs: [changes]
110+
needs: [changes, check-label]
54111
if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
55112
uses: ./.github/workflows/integration-tests.yml
56113
secrets: inherit
57114

115+
build-api-v1:
116+
name: Production builds
117+
needs: [changes, check-label]
118+
if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
119+
uses: ./.github/workflows/api-v1-production-build.yml
120+
secrets: inherit
121+
122+
build-api-v2:
123+
name: Production builds
124+
needs: [changes, check-label]
125+
if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
126+
uses: ./.github/workflows/api-v2-production-build.yml
127+
secrets: inherit
128+
129+
build:
130+
name: Production builds
131+
needs: [changes, check-label]
132+
if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
133+
uses: ./.github/workflows/production-build-without-database.yml
134+
secrets: inherit
135+
136+
e2e:
137+
name: e2e
138+
needs: [changes, check-label, build]
139+
if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
140+
uses: ./.github/workflows/e2e.yml
141+
secrets: inherit
142+
143+
e2e-app-store:
144+
name: e2e-app-store
145+
needs: [changes, check-label, build]
146+
if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
147+
uses: ./.github/workflows/e2e-app-store.yml
148+
secrets: inherit
149+
150+
e2e-embed:
151+
name: e2e-embed
152+
needs: [changes, check-label, build]
153+
if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
154+
uses: ./.github/workflows/e2e-embed.yml
155+
secrets: inherit
156+
157+
e2e-embed-react:
158+
name: e2e-embed-react
159+
needs: [changes, check-label, build]
160+
if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
161+
uses: ./.github/workflows/e2e-embed-react.yml
162+
secrets: inherit
163+
164+
analyze:
165+
name: Analyze Build
166+
needs: [build]
167+
uses: ./.github/workflows/nextjs-bundle-analysis.yml
168+
secrets: inherit
169+
58170
required:
59-
needs: [changes, lint, type-check, unit-test, integration-test]
60-
if: always()
171+
needs: [changes, lint, type-check, unit-test, integration-test, check-label, build, build-api-v1, build-api-v2, e2e, e2e-embed, e2e-embed-react, e2e-app-store]
61172
runs-on: buildjet-2vcpu-ubuntu-2204
62173
steps:
63174
- name: fail if conditional jobs failed

apps/api/v1/instrumentation.ts

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ export function register() {
44
if (process.env.NEXT_RUNTIME === "nodejs") {
55
Sentry.init({
66
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
7-
// reduce sample rate to 10% on production
8-
tracesSampleRate: process.env.NODE_ENV !== "production" ? 1.0 : 0.1,
97
});
108
}
119

0 commit comments

Comments
 (0)