-
Notifications
You must be signed in to change notification settings - Fork 1
182 lines (157 loc) · 6.41 KB
/
main.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
name: node
on:
push:
workflow_dispatch:
inputs:
repo:
description: The URL of Node.js repo
required: false
type: string
commit:
description: Which Node.js commit or branch to build
required: false
type: string
schedule:
- cron: '0 21 * * *'
env:
WIN_SDK_VERSION: 22621
jobs:
build:
needs: [vs-toolchain]
runs-on: >-
${{
(matrix.os == 'mac' && matrix.arch == 'arm64') &&
'macos-14' ||
(fromJson('{"linux":"ubuntu-22.04","mac":"macos-13","win":"ubuntu-22.04"}')[matrix.os])
}}
continue-on-error: false
strategy:
fail-fast: false
matrix:
os: [linux, mac, win]
arch: [x64, arm64]
steps:
- name: Prepare to Install Linux Dependencies
if: runner.os == 'Linux'
run: sudo apt update
- name: Install Linux Dependencies
if: runner.os == 'Linux' && matrix.os == 'win'
# Needed for running ciopfs, used when setup vs toolchain.
run: sudo apt install -y fuse
- name: Install Linux Cross Compilation Toolchains
if: runner.os == 'linux' && matrix.arch != 'x64'
run: sudo apt install -y gcc-multilib g++-multilib
- name: Install Linux Arm Toolchains
if: matrix.os == 'linux' && startsWith(matrix.arch, 'arm')
run: sudo apt install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-dev-armhf-cross linux-libc-dev-armhf-cross binutils-aarch64-linux-gnu
- uses: actions/setup-python@v3
with:
python-version: '3.11'
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Maximize Build Space
if: matrix.os == 'win'
uses: hirnidrin/free-disk-space@main
- name: Use ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: v0-${{ matrix.os }}-${{ matrix.arch }}
- name: Get Windows SDK
if: matrix.os == 'win'
uses: actions/cache/restore@v3
with:
path: '*.zip'
key: vs-toolchain-${{ env.WIN_SDK_VERSION }}
fail-on-cache-miss: true
enableCrossOsArchive: true
- name: Build
run: |
node scripts/bootstrap.js --target-os=${{ matrix.os }} --target-cpu=${{ matrix.arch }} '--extra-args=cc_wrapper="ccache"' --node-repo=${{ inputs.repo || 'https://github.com/nodejs/node' }} --node-commit=${{ inputs.commit || '' }}
node scripts/build.js
- name: Run Tests
if: runner.arch == matrix.arch && matrix.os != 'win'
run: |
# Build tests.
node scripts/build.js node_cctest node_embedtest overlapped_checker
# Build native addons used for testing.
BUILD_ADDONS_ARGS="--config-gypi-path=`pwd`/out/Release/gen/node/config.gypi --root-dir=`pwd`/node"
python node/tools/build_addons.py node/test/addons --skip-tests=openssl-client-cert-engine,openssl-key-engine,openssl-test-engine $BUILD_ADDONS_ARGS
python node/tools/build_addons.py node/test/node-api $BUILD_ADDONS_ARGS
python node/tools/build_addons.py node/test/js-native-api $BUILD_ADDONS_ARGS
# Some tests assume the path of node binary
cd node
mkdir -p out/Release
cd out/Release && ln -s ../../../out/Release/node . && cd -
# Run tests.
../out/Release/node_cctest
../out/Release/node test/embedding/test-embedding.js
./tools/test.py --shell ../out/Release/node js-native-api
./tools/test.py --shell ../out/Release/node node-api
# TODO(zcbenz): Disabled tests:
# parallel/test-crypto-no-algorithm
# broken by https://github.com/nodejs/node/pull/46237
# parallel/test-worker-nearheaplimit-deadlock
# broken by https://github.com/nodejs/node/pull/51598
# wasm-allocation
# added by https://github.com/nodejs/node/pull/52766
# parallel/test-async-context-frame
# broken by https://github.com/nodejs/node/pull/54510
./tools/test.py --shell ../out/Release/node --flaky-tests=dontcare --skip-tests=parallel/test-crypto-no-algorithm,parallel/test-worker-nearheaplimit-deadlock,wasm-allocation,parallel/test-async-context-frame
vs-toolchain:
runs-on: windows-2022
continue-on-error: false
steps:
- name: Check cache
id: check-cache
# It is not job failure when this step fails.
continue-on-error: true
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
# Check if vs-toolchain has been generated before.
gh extension install actions/gh-actions-cache
gh actions-cache list --repo $GITHUB_REPOSITORY | grep -q vs-toolchain-$WIN_SDK_VERSION
- name: Validate branch
if: steps.check-cache.outcome == 'failure'
run: |
# GitHub limits where cache is accessible, we don't want to create
# vs toolchain for every branch so force creating one on main branch.
if (${env:GITHUB_BASE_REF}) {
$env:GIT_BRANCH = ${env:GITHUB_BASE_REF}
} else {
$env:GIT_BRANCH = ${env:GITHUB_REF} -replace '^refs/heads/', ''
}
if (${env:GIT_BRANCH} -ne 'main') {
Write-Output 'Can not create vs-toolchain in a sub-branch, please re-run the main branch job.'
Write-Output "The value of GIT_BRANCH is: ${env:GIT_BRANCH}."
Exit 1
}
- name: Checkout
if: steps.check-cache.outcome == 'failure'
uses: actions/checkout@v3
with:
repository: yue/build-gn
- name: Generate Windows SDK package
if: steps.check-cache.outcome == 'failure'
# See: https://chromium.googlesource.com/chromium/src/+/master/docs/win_cross.md
run: python third_party/depot_tools/win_toolchain/package_from_installed.py 2022 -w 10.0.${env:WIN_SDK_VERSION}.0
- name: Save to cache
uses: actions/cache/save@v3
if: steps.check-cache.outcome == 'failure'
with:
path: '*.zip'
key: vs-toolchain-${{ env.WIN_SDK_VERSION }}
enableCrossOsArchive: true
notify-build-failure:
needs: [build]
if: failure() && github.event.schedule != null
permissions:
issues: write
runs-on: ubuntu-latest
steps:
- uses: jayqi/failed-build-issue-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}