117 lines (94 loc) · 3.55 KB
/
build_reusable.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Build Reusable
on:
workflow_call:
inputs:
afterBuild:
required: false
description: 'additional steps to run'
type: string
skipInstallBuild:
required: false
description: 'whether to skip pnpm install && pnpm build'
type: string
skipForDocsOnly:
required: false
description: 'skip for docs only changes'
type: string
nodeVersion:
required: false
description: 'version of Node.js to use'
type: string
needsNextest:
required: false
description: 'if nextest rust dep is needed'
type: string
env:
NAPI_CLI_VERSION: 2.14.7
TURBO_VERSION: 1.9.6
RUST_TOOLCHAIN: nightly-2023-03-09
PNPM_VERSION: 7.24.3
NODE_MAINTENANCE_VERSION: 16
NODE_LTS_VERSION: 18
TEST_CONCURRENCY: 6
# TODO: remove after testing
# NEXT_TEST_CONTINUE_ON_ERROR: 'true'
TURBO_TEAM: 'vercel'
TURBO_REMOTE_ONLY: 'true'
NEXT_TELEMETRY_DISABLED: 1
# we build a dev binary for use in CI so skip downloading
# canary next-swc binaries in the monorepo
NEXT_SKIP_NATIVE_POSTINSTALL: 1
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN }}
NEXT_TEST_JOB: 1
DATADOG_API_KEY: ${{ secrets.DATA_DOG_API_KEY }}
jobs:
build:
runs-on: [self-hosted, linux, x64]
steps:
- run: fnm install ${{ inputs.nodeVersion || env.NODE_LTS_VERSION }}
- run: fnm use ${{ inputs.nodeVersion || env.NODE_LTS_VERSION }}
- run: node -v
- run: pwd
- name: Install
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: rustfmt, clippy
- name: Install nextest
if: ${{ inputs.needsNextest == 'yes' }}
uses: taiki-e/install-action@nextest
- run: rustc --version
- run: npm i -g yarn "pnpm@${PNPM_VERSION}" "turbo@${TURBO_VERSION}" "@napi-rs/cli@${NAPI_CLI_VERSION}"
- uses: actions/checkout@v3
with:
fetch-depth: 25
# clean up any previous artifacts to avoid hitting disk space limits
- run: git clean -xdf && rm -rf /tmp/next-repo-*; rm -rf /tmp/next-install-* /tmp/yarn-* /tmp/ncc-cache target && cargo clean
- run: echo "DOCS_CHANGE<<EOF" >> $GITHUB_OUTPUT; echo "$(node scripts/run-for-change.js --not --type docs --exec echo 'nope')" >> $GITHUB_OUTPUT; echo 'EOF' >> $GITHUB_OUTPUT
name: check docs only change
id: docs-change
# normalize versions before build-native for better cache hits
- run: node scripts/normalize-version-bump.js
name: normalize versions
- run: turbo run build-native-release --summarize true -- --target x86_64-unknown-linux-gnu
# undo normalize version changes for install/build
- run: git checkout .
if: ${{ inputs.skipInstallBuild != 'yes' }}
- run: pnpm store path
- run: pnpm install
if: ${{ inputs.skipInstallBuild != 'yes' }}
- run: pnpm build
if: ${{ inputs.skipInstallBuild != 'yes' }}
- run: pnpm playwright install-deps
if: ${{ inputs.skipInstallBuild != 'yes' }}
- run: pnpm playwright install chromium
if: ${{ inputs.skipInstallBuild != 'yes' }}
- run: turbo run get-test-timings -- --build ${{ github.sha }}
- run: /bin/bash -c "${{ inputs.afterBuild }}"
if: ${{inputs.skipForDocsOnly != 'yes' || steps.docs-change.outputs.DOCS_CHANGE == 'nope'}}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: turbo run summary
path: .turbo/runs