Skip to content

Commit 54d1c68

Browse files
committed
feat(ci/publish): add caching
1 parent c0ceb57 commit 54d1c68

File tree

6 files changed

+171
-120
lines changed

6 files changed

+171
-120
lines changed

.github/workflows/build.yml

-84
This file was deleted.

.github/workflows/publish.yml

+122-33
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,125 @@
1-
name: Publish Package
2-
31
on:
42
workflow_dispatch:
3+
inputs:
4+
test:
5+
type: boolean
6+
description: Skip publishing step
57
push:
68
tags:
79
- "*"
810

11+
name: 🚀 Publish Package
12+
913
jobs:
14+
build-container:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: 📥 Checkout
19+
uses: actions/checkout@v3
20+
21+
- name: 🤖 Setup Qemu
22+
uses: docker/setup-qemu-action@v3
23+
with:
24+
platforms: "arm64"
25+
26+
- name: 🐋 Setup Buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: 🦥 Cache Image
30+
id: cache-image
31+
uses: actions/cache@v3
32+
with:
33+
path: venmic-builder.tar
34+
key: venmic-builder-cache
35+
36+
- name: 🏗️ Build Image
37+
if: steps.cache-image.outputs.cache-hit != 'true'
38+
run: |
39+
cd docker
40+
docker buildx build --platform=linux/amd64,linux/arm64 --tag venmic-builder .
41+
docker save > venmic-builder.tar
42+
43+
build-x86_64:
44+
needs: build-container
45+
runs-on: ubuntu-latest
46+
47+
steps:
48+
- name: 📥 Checkout
49+
uses: actions/checkout@v3
50+
51+
- name: 🦥 Pull Image
52+
uses: actions/cache/restore@v3
53+
id: cache-container
54+
with:
55+
fail-on-cache-miss: true
56+
path: venmic-builder.tar
57+
key: venmic-builder-cache
58+
59+
- name: 🐋 Load Container
60+
run: |
61+
docker load < venmic-builder.tar
62+
63+
- name: 🏗️ Build Addon
64+
uses: addnab/docker-run-action@v3
65+
with:
66+
options: -v ${{ github.workspace }}:/work --platform linux/amd64
67+
image: venmic-builder
68+
shell: bash
69+
run: |
70+
cd /work
71+
pnpm install
72+
73+
- name: ♻️ Upload Artifact
74+
uses: actions/upload-artifact@v3
75+
with:
76+
name: addon-x86_64
77+
path: build/Release
78+
79+
build-arm64:
80+
needs: build-container
81+
runs-on: ubuntu-latest
82+
83+
steps:
84+
- name: 📥 Checkout
85+
uses: actions/checkout@v3
86+
87+
- name: 🦥 Pull Image
88+
uses: actions/cache/restore@v3
89+
id: cache-container
90+
with:
91+
fail-on-cache-miss: true
92+
path: venmic-builder.tar
93+
key: venmic-builder-cache
94+
95+
- name: 🤖 Setup Qemu
96+
uses: docker/setup-qemu-action@v3
97+
with:
98+
platforms: "arm64"
99+
100+
- name: 🐋 Load Container
101+
run: |
102+
docker load < venmic-builder.tar
103+
104+
- name: 🏗️ Build Addon
105+
uses: addnab/docker-run-action@v3
106+
with:
107+
options: -v ${{ github.workspace }}:/work --platform linux/arm64
108+
image: venmic-builder
109+
shell: bash
110+
run: |
111+
cd /work
112+
pnpm install
113+
114+
- name: ♻️ Upload Artifact
115+
uses: actions/upload-artifact@v3
116+
with:
117+
name: addon-arm64
118+
path: build/Release
119+
10120
publish:
121+
needs: [build-arm64, build-x86_64]
11122
runs-on: ubuntu-latest
12-
container: fedora:37
13123

14124
steps:
15125
- name: 📥 Checkout
@@ -36,47 +146,26 @@ jobs:
36146
version: 8
37147
run_install: false
38148

39-
- name: ⏱️ Wait for x86-64 Builds
40-
uses: lewagon/[email protected]
41-
with:
42-
wait-interval: 600
43-
ref: ${{ github.ref }}
44-
check-name: "build-fedora37"
45-
repo-token: ${{ secrets.GITHUB_TOKEN }}
46-
47-
- name: 📦 Download Build (x86-64)
48-
id: download-artifact
149+
- name: 📦 Download Build (x86_64)
49150
uses: dawidd6/action-download-artifact@v2
50151
with:
51-
workflow: build.yml
52-
name: addon-x86-64
152+
name: addon-x86_64
53153
path: build/Release
54-
allow_forks: false
55-
56-
- name: 🛠️ Prepare Prebuilds (x86-64)
57-
run: pnpm pkg-prebuilds-copy --baseDir build/Release --source venmic-addon.node --name=venmic-addon --strip --napi_version=7
58154

59-
- name: ⏱️ Wait for armv8 Builds
60-
uses: lewagon/[email protected]
61-
with:
62-
wait-interval: 600
63-
ref: ${{ github.ref }}
64-
check-name: "build-fedora37-arm"
65-
repo-token: ${{ secrets.GITHUB_TOKEN }}
155+
- name: 🛠️ Prepare Prebuilds (x86_64)
156+
run: pnpm pkg-prebuilds-copy --baseDir build/Release --source venmic-addon.node --name=venmic-addon --strip --napi_version=7 --arch=x64
66157

67-
- name: 📦 Download Build (armv8)
68-
id: download-artifact
158+
- name: 📦 Download Build (arm64)
69159
uses: dawidd6/action-download-artifact@v2
70160
with:
71-
workflow: build.yml
72-
name: addon-armv8
161+
name: addon-arm64
73162
path: build/Release
74-
allow_forks: false
75163

76-
- name: 🛠️ Prepare Prebuilds (armv8)
77-
run: pnpm pkg-prebuilds-copy --baseDir build/Release --source venmic-addon.node --name=venmic-addon --strip --napi_version=7
164+
- name: 🛠️ Prepare Prebuilds (x86_64)
165+
run: pnpm pkg-prebuilds-copy --baseDir build/Release --source venmic-addon.node --name=venmic-addon --strip --napi_version=7 --arch=arm64
78166

79167
- name: 🛒 Publish
168+
if: "${{ github.event.inputs.test != 'true' }}"
80169
run: pnpm publish
81170
env:
82171
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/server.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
on:
2+
push:
3+
pull_request:
4+
5+
name: 🏗️ Build Server
6+
7+
jobs:
8+
build-fedora:
9+
runs-on: ubuntu-latest
10+
container: fedora:38
11+
12+
steps:
13+
- name: 📥 Checkout
14+
uses: actions/checkout@v3
15+
16+
- name: 👷 Build Dependencies
17+
run: |
18+
dnf install -y make automake gcc gcc-c++ kernel-devel cmake git
19+
dnf install -y pipewire-devel pipewire-libs pulseaudio-libs-devel pipewire-pulseaudio
20+
21+
- name: 🔨 Build
22+
run: |
23+
cmake -B build
24+
cmake --build build
25+
26+
- name: 🚀 Upload Artifact
27+
uses: actions/upload-artifact@v3
28+
with:
29+
name: server-x86-64
30+
path: build/server

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
node_modules
22
.vscode
33
build
4-
prebuilds
4+
prebuilds

.npmignore

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
node_modules
2-
.github
2+
build
3+
4+
docker
35
server
46
tests
5-
build
67

78
.gitignore
9+
.github
10+
811
.clang-*
912
.eslint*

docker/Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This Dockerfile describes the base image used for compiling the node addon on different CPU-Architectures
2+
3+
FROM fedora:37
4+
5+
# Build dependencies
6+
7+
RUN dnf install -y make automake gcc gcc-c++ kernel-devel cmake git nodejs
8+
RUN dnf install -y pipewire-devel pipewire-libs pulseaudio-libs-devel pipewire-pulseaudio
9+
10+
# PNPM
11+
12+
RUN curl -fsSL https://get.pnpm.io/install.sh | sh -
13+
RUN source /root/.bashrc

0 commit comments

Comments
 (0)