Skip to content

Commit ac64b59

Browse files
committed
fixup! chore(ci): make cost-saving changes
1 parent f2ab941 commit ac64b59

File tree

1 file changed

+51
-24
lines changed

1 file changed

+51
-24
lines changed

.github/workflows/build.yml

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,9 @@ env:
3030
TURBO_ARGS: --cache-dir=.turbo/cache
3131

3232
jobs:
33-
build:
34-
name: Build on ${{ matrix.os }}
35-
runs-on: ${{ matrix.os }}
36-
37-
strategy:
38-
fail-fast: false
39-
matrix:
40-
os: [ubuntu-slim, windows-latest]
41-
event-name: ${{ github.event_name }}
42-
repo: ${{ github.repository }}
43-
exclude:
44-
- os: windows-latest
45-
# Skipping the Windows build on the merge queue to speed it up
46-
event-name: merge_group
47-
- os: windows-latest
48-
# Skipping the Windows build on the private repo to save on costs
49-
repo: nodejs-private/nodejs.org-private
33+
build-linux:
34+
name: Build on Linux
35+
runs-on: ubuntu-slim
5036

5137
steps:
5238
- uses: nodejs/web-team/actions/setup-environment@9f3c83af227d721768d9dbb63009a47ed4f4282f
@@ -56,12 +42,6 @@ jobs:
5642
# We only want to install required production packages
5743
install-flags: --prod
5844

59-
- name: Use GNU tar instead BSD tar
60-
# This ensures that we use GNU `tar` which is more efficient for extracting caches's
61-
if: matrix.os == 'windows-latest'
62-
shell: cmd
63-
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
64-
6545
- uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
6646
with:
6747
path: ${{ github.workspace }}/apps/site/.next/cache
@@ -80,7 +60,6 @@ jobs:
8060
TURBOPACK_STATS: ${{ matrix.os == 'ubuntu-slim' }}
8161

8262
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
83-
if: matrix.os == 'ubuntu-slim'
8463
with:
8564
name: webpack-stats
8665
path: apps/site/.next/server/webpack-stats.json
@@ -96,3 +75,51 @@ jobs:
9675
# We want to ensure that static exports for all locales do not occur on `pull_request` events
9776
# TODO: The output of this is too large, and it crashes the GitHub Runner
9877
NEXT_PUBLIC_STATIC_EXPORT_LOCALE: false # ${{ github.event_name == 'push' }}
78+
79+
build-windows:
80+
name: Build on windows
81+
runs-on: windows-latest
82+
83+
if: github.event_name != 'merge_group' || github.repository == 'nodejs/nodejs.org'
84+
85+
steps:
86+
- uses: nodejs/web-team/actions/setup-environment@9f3c83af227d721768d9dbb63009a47ed4f4282f
87+
with:
88+
pnpm: true
89+
use-version-file: true
90+
# We only want to install required production packages
91+
install-flags: --prod
92+
93+
- name: Use GNU tar instead BSD tar
94+
# This ensures that we use GNU `tar` which is more efficient for extracting caches's
95+
shell: cmd
96+
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
97+
98+
- uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
99+
with:
100+
path: ${{ github.workspace }}/apps/site/.next/cache
101+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
102+
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
103+
104+
- name: Build Next.js
105+
# We want a ISR build on CI to ensure that regular Next.js builds work as expected.
106+
run: node_modules/.bin/turbo build ${{ env.TURBO_ARGS }}
107+
env:
108+
# We want to ensure we have enough RAM allocated to the Node.js process
109+
# this should be a last resort in case by any chances the build memory gets too high
110+
# but in general this should never happen
111+
NODE_OPTIONS: '--max_old_space_size=4096'
112+
# See https://github.com/vercel/next.js/pull/81318
113+
TURBOPACK_STATS: ${{ matrix.os == 'ubuntu-slim' }}
114+
115+
- name: Build Next.js (Static Export)
116+
# We want to generate a static build, as it is a requirement of our website.
117+
run: node_modules/.bin/turbo deploy ${{ env.TURBO_ARGS }}
118+
env:
119+
# We want to ensure we have enough RAM allocated to the Node.js process
120+
# this should be a last resort in case by any chances the build memory gets too high
121+
# but in general this should never happen
122+
NODE_OPTIONS: '--max_old_space_size=4096'
123+
# We want to ensure that static exports for all locales do not occur on `pull_request` events
124+
# TODO: The output of this is too large, and it crashes the GitHub Runner
125+
NEXT_PUBLIC_STATIC_EXPORT_LOCALE: false # ${{ github.event_name == 'push' }}

0 commit comments

Comments
 (0)