Skip to content

Commit 81f719b

Browse files
committed
ci(.github/workflows): precompile source code to v8 bytecode before being written to the output file
Signed-off-by: Leonardo Di Donato <[email protected]>
1 parent f016a7a commit 81f719b

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

.github/workflows/build_v2.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# NOTE:
2+
# This CI workflow builds erborist with bytecode.
3+
# TODO: install `ldid` linux utility to PATH for automatic ad-hoc signing of macos targets.
4+
name: building
5+
6+
on:
7+
push:
8+
branches: ['ci/build-bytecode']
9+
pull_request:
10+
branches: ['ci/build-bytecode']
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
make:
17+
strategy:
18+
matrix:
19+
os:
20+
- macos
21+
- linux
22+
- win
23+
arch:
24+
- x64
25+
- arm64
26+
node-version:
27+
- 18
28+
29+
runs-on: ubuntu-20.04
30+
31+
steps:
32+
- name: Checkout action code
33+
uses: actions/checkout@v3
34+
35+
- name: Setup Node.js ${{ matrix.node-version }}
36+
uses: actions/setup-node@v3
37+
with:
38+
node-version: ${{ matrix.node-version }}.x
39+
40+
- name: Cache pkg data
41+
uses: actions/cache@v3
42+
with:
43+
path: ~/.pkg-cache/
44+
key: node${{ matrix.node-version }}
45+
enableCrossOsArchive: true
46+
47+
- name: Install deps
48+
run: npm install
49+
50+
- name: Make (x64)
51+
if: ${{ matrix.arch == 'x64' }}
52+
shell: bash
53+
run: |
54+
./node_modules/.bin/pkg \
55+
--compress Brotli \
56+
-t node${{ matrix.node-version }}-${{ matrix.os }}-${{ matrix.arch }} \
57+
--out-path dist/erborist_${{ matrix.os }}_amd64_v1/ \
58+
.
59+
60+
- name: Make (arm64)
61+
if: ${{ matrix.arch == 'arm64' }}
62+
uses: uraimo/[email protected]
63+
with:
64+
arch: aarch64
65+
distro: ubuntu20.04
66+
githubToken: ${{ github.token }}
67+
dockerRunArgs: |
68+
--volume "${HOME}/.pkg-cache:/root/.pkg-cache"
69+
install: |
70+
apt-get update -q -y
71+
apt-get install -q -y curl
72+
curl -fsSL https://deb.nodesource.com/setup_${{ matrix.node-version }}.x | bash -
73+
apt-get install -y nodejs
74+
run: |
75+
./node_modules/.bin/pkg \
76+
--compress Brotli \
77+
-t node${{ matrix.node-version }}-${{ matrix.os }}-${{ matrix.arch }} \
78+
--out-path dist/erborist_${{ matrix.os }}_arm64/ \
79+
.
80+
81+
- name: Archive binaries
82+
uses: actions/upload-artifact@v3
83+
with:
84+
name: binaries
85+
path: dist/
86+
if-no-files-found: error
87+
retention-days: 1

0 commit comments

Comments
 (0)