Skip to content

Commit 110df88

Browse files
chore: updated turborepo config (#5524)
Co-authored-by: Brian Muenzenmeyer <[email protected]>
1 parent c6f543f commit 110df88

File tree

3 files changed

+207
-82
lines changed

3 files changed

+207
-82
lines changed

.github/workflows/build-and-analysis.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ permissions:
1818
actions: read
1919
pull-requests: write
2020

21+
env:
22+
TURBO_REF_FILTER: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
23+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
24+
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
25+
2126
jobs:
2227
build:
2328
name: Build on ${{ matrix.os }}
@@ -29,15 +34,15 @@ jobs:
2934
os: [ubuntu-latest, windows-latest]
3035

3136
steps:
32-
- name: 'Use GNU tar instead BSD tar'
37+
- name: Use GNU tar instead BSD tar
3338
if: matrix.os == 'windows-latest'
3439
shell: cmd
3540
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
3641

3742
- name: Git Checkout
3843
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
3944
with:
40-
fetch-depth: 2
45+
fetch-depth: 0
4146

4247
- name: Restore Cache
4348
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
@@ -58,11 +63,19 @@ jobs:
5863
- name: Install NPM packages
5964
run: npm ci --no-audit --no-fund --omit=dev
6065

61-
- name: Build Next.js
62-
run: npx turbo build
66+
- name: Build Next.js (Windows)
67+
if: matrix.os == 'windows-latest'
68+
run: npx turbo build --filter=$env:TURBO_REF_FILTER
69+
env:
70+
TURBO_FORCE: true
71+
NODE_OPTIONS: '--max_old_space_size=4096'
72+
NEXT_TELEMETRY_DISABLED: 1
73+
74+
- name: Build Next.js (Ubuntu)
75+
if: matrix.os == 'ubuntu-latest'
76+
run: npx turbo build --filter=$TURBO_REF_FILTER
6377
env:
64-
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
65-
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
78+
TURBO_FORCE: true
6679
NODE_OPTIONS: '--max_old_space_size=4096'
6780
NEXT_TELEMETRY_DISABLED: 1
6881

@@ -87,7 +100,7 @@ jobs:
87100
analysis:
88101
name: Analysis
89102
runs-on: ubuntu-latest
90-
needs: build
103+
needs: [build]
91104

92105
steps:
93106
- name: Git Checkout

.github/workflows/pull-request.yml

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
name: Pull Request Checks
22

33
on:
4-
pull_request_target:
5-
branches:
6-
- main
4+
pull_request:
75
workflow_dispatch:
86

97
defaults:
@@ -14,6 +12,11 @@ permissions:
1412
contents: read
1513
actions: read
1614

15+
env:
16+
TURBO_REF_FILTER: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
17+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
18+
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
19+
1720
jobs:
1821
lint:
1922
name: Lint
@@ -23,7 +26,7 @@ jobs:
2326
- name: Git Checkout
2427
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
2528
with:
26-
fetch-depth: 2
29+
fetch-depth: 0
2730

2831
- name: Restore Cache
2932
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
@@ -45,16 +48,10 @@ jobs:
4548
run: npm ci --no-audit --no-fund
4649

4750
- name: Run Linting
48-
run: npx turbo lint
49-
env:
50-
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
51-
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
51+
run: npx turbo lint --filter=$TURBO_REF_FILTER
5252

5353
- name: Run Prettier
54-
run: npx turbo prettier
55-
env:
56-
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
57-
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
54+
run: npx turbo prettier --filter=$TURBO_REF_FILTER
5855

5956
unit-tests:
6057
name: Tests on ${{ matrix.os }}
@@ -66,15 +63,15 @@ jobs:
6663
os: [ubuntu-latest, windows-latest]
6764

6865
steps:
69-
- name: 'Use GNU tar instead BSD tar'
66+
- name: Use GNU tar instead BSD tar
7067
if: matrix.os == 'windows-latest'
7168
shell: cmd
7269
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
7370

7471
- name: Git Checkout
7572
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
7673
with:
77-
fetch-depth: 2
74+
fetch-depth: 0
7875

7976
- name: Restore Cache
8077
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
@@ -95,14 +92,18 @@ jobs:
9592
- name: Install NPM packages
9693
run: npm ci --no-audit --no-fund
9794

98-
- name: Run Unit Tests
99-
run: npx turbo test:unit -- --coverage
100-
env:
101-
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
102-
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
103-
104-
- name: Run Storybook Tests
105-
run: npx turbo test:storybook
106-
env:
107-
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
108-
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
95+
- name: Run Unit Tests (Windows)
96+
if: matrix.os == 'windows-latest'
97+
run: npx turbo test:unit --filter=$env:TURBO_REF_FILTER -- --coverage
98+
99+
- name: Run Unit Tests (Ubuntu)
100+
if: matrix.os == 'ubuntu-latest'
101+
run: npx turbo test:unit --filter=$TURBO_REF_FILTER -- --coverage
102+
103+
- name: Run Storybook Tests (Windows)
104+
if: matrix.os == 'windows-latest'
105+
run: npx turbo test:storybook --filter=$env:TURBO_REF_FILTER
106+
107+
- name: Run Storybook Tests (Ubuntu)
108+
if: matrix.os == 'ubuntu-latest'
109+
run: npx turbo test:storybook --filter=$TURBO_REF_FILTER

0 commit comments

Comments
 (0)