forked from vercel/pkg-fetch
-
-
Notifications
You must be signed in to change notification settings - Fork 13
112 lines (89 loc) · 2.97 KB
/
build-macos.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
name: Build Node binaries for macOS
on:
workflow_dispatch:
workflow_call:
jobs:
macos-x64:
runs-on: macos-13
strategy:
fail-fast: false
matrix:
target-node: [14, 16, 18, 20]
steps:
- uses: actions/checkout@v4
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18
- name: Check arch is x64
run: |
if [[ $(uname -m) != "x86_64" ]]; then
echo "This job should run on x64 architecture"
exit 1
fi
- run: yarn install --ignore-engines
# add missing distutils package to python 3.12
- name: Install distutils
run: |
pip install setuptools
- run: yarn start --node-range node${{ matrix.target-node }} --output dist
env:
MAKE_JOB_COUNT: 2 # prevent to run out of memory
- name: Check if binary is compiled, skip if download only
id: check_file
run: |
ls -l dist
(test -f dist/*.sha256sum && echo "EXISTS=true" >> $GITHUB_OUTPUT) || echo "EXISTS=false" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
if: steps.check_file.outputs.EXISTS == 'true'
with:
name: node${{ matrix.target-node }}-macos-x64
path: dist/*
macos-arm64:
runs-on: macos-13 # macos-14 is arm64: https://github.com/actions/runner-images#available-images but not working
strategy:
fail-fast: false
matrix:
target-node: [14, 16, 18, 20]
steps:
- uses: actions/checkout@v4
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18
- name: Check arch is x64 # arm64
run: |
if [[ $(uname -m) != "x86_64" ]]; then
echo "This job should run on x64 architecture"
exit 1
fi
- run: yarn install --ignore-engines
# add missing distutils package to python 3.12
- name: Install distutils
run: |
# pip install setuptools
brew install python-setuptools
- run: yarn start --node-range node${{ matrix.target-node }} --arch arm64 --output dist
env:
MAKE_JOB_COUNT: 2 # prevent to run out of memory
# uncomment the following lines to build x64
CC: clang -arch arm64
CXX: clang++ -arch arm64
CC_host: clang
CXX_host: clang++
- name: Check if binary is compiled
id: check_file
run: |
ls -l dist
(test -f dist/*.sha256sum && echo "EXISTS=true" >> $GITHUB_OUTPUT) || echo "EXISTS=false" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
if: steps.check_file.outputs.EXISTS == 'true'
with:
name: node${{ matrix.target-node }}-macos-arm64
path: dist/*