-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (131 loc) · 4.44 KB
/
node-medley.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
name: node-medley native module
on:
push:
branches:
- main
- feature/node-medley-arm64
paths:
- .github/workflows/node-medley.yml
- packages/engine/src/**
- packages/node-medley/src/**
- packages/node-medley/scripts/**
- packages/node-medley/binding.gyp
- packages/node-medley/package.json
jobs:
build:
strategy:
matrix:
include:
- runs-on: ubuntu-20.04
node_version: 18
node_arch: x64
build-arch: linux-x64
- runs-on: windows-latest
node_version: 18
node_arch: x64
build-arch: win32-x64
- runs-on: macos-14
node_version: 18
node_arch: arm64
build-arch: darwin-arm64
# # macos-14 runner is arm64, use macos-13 instead
# - runs-on: macos-13
# node_version: 18
# node_arch: x64
# build-arch: darwin-x64
name: Build ${{ matrix.build-arch }}
runs-on: ${{ matrix.runs-on }}
env:
BUILD_ARCH: ${{ matrix.build-arch }}
DEPS_INSTALL: ./packages/node-medley/scripts/install-deps.sh
steps:
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
architecture: ${{ matrix.node_arch }}
- uses: pnpm/action-setup@v2
with:
version: 8.15.5
- name: Make sure pnpm fetch Node
shell: bash
run: |
pnpm &>/dev/null || true
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-store-native-build
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pnpm-store-native-build
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Dependencies (Linux)
if: contains(matrix.build-arch, 'linux')
run: |
sudo apt -y update && sudo apt -y install g++ make cmake pkg-config libasound2-dev
- name: Dependencies
if: contains(matrix.build-arch, 'darwin') || contains(matrix.build-arch, 'linux')
run: |
mkdir -p ./build/deps
cp ${{ env.DEPS_INSTALL }} ./build/deps/
cd ./build/deps
sh install-deps.sh
- name: Cache vcpkg
if: contains(matrix.build-arch, 'win32')
uses: actions/cache@v3
with:
path: |
C:\vcpkg\packages
C:\vcpkg\installed
key: windows-build-vcpkg-cache
- name: Dependencies (Windows)
if: contains(matrix.build-arch, 'win32')
run: |
vcpkg integrate install
vcpkg install libsamplerate:x64-windows-static taglib:x64-windows-static zlib:x64-windows-static
- name: Prepare
working-directory: ./packages/node-medley
run: |
pnpm install --no-frozen-lockfile --ignore-scripts
- name: Build native
working-directory: ./packages/node-medley
run: |
pnpm prebuild
- name: Test prebuilt module
working-directory: ./packages/node-medley
run: |
pnpm test
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.build-arch }}
path: ./packages/node-medley/prebuilds
build-linux-arm64:
name: Build linux-arm64
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build native
working-directory: ./packages/node-medley
run: |
docker build --platform=linux/arm64 -f ./builder/linux/Dockerfile --progress=plain -t node-medley-prebuild ../.. && docker container create --name node-medley-prebuild-cp node-medley-prebuild && docker cp node-medley-prebuild-cp:/src/packages/node-medley/prebuilds ./ && docker rm node-medley-prebuild-cp
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: linux-arm64
path: ./packages/node-medley/prebuilds