@@ -14,98 +14,96 @@ jobs:
14
14
runs-on : ubuntu-20.04
15
15
strategy :
16
16
matrix :
17
- node-version : [ 16.x]
17
+ node-version : [18]
18
+ arch : [amd64, arm64, arm]
19
+ platform : [debian, alpine]
20
+ include :
21
+ # Set baselines per platform
22
+ - triple : " alpine-linux-musl"
23
+ platform : alpine
24
+ version : 3.16
25
+ libc : musl
26
+ gcc_install : clang lld
27
+ gcc : clang
28
+ gxx : clang++
29
+ # libc is intentionally not set here, as prebuild-install requires libc to not be set for glibc builds
30
+ - triple : " linux-gnu"
31
+ platform : debian
32
+ version : bullseye
33
+ # Set baselines per architecture
34
+ - triple_arch : x86_64
35
+ node_arch : x64
36
+ arch : amd64
37
+ - triple_arch : armv7
38
+ node_arch : arm
39
+ triple_postfix : eabihf
40
+ arch : arm
41
+ flags : -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -fPIC
42
+ - triple_arch : aarch64
43
+ node_arch : arm64
44
+ arch : arm64
45
+ flags : -march=armv8-a -fPIC
46
+ # Set edge case overrides for specific platform + architecture
47
+ # also define gcc commands for each architecture
48
+ - arch : amd64
49
+ platform : debian
50
+ gcc_install : gcc g++
51
+ gcc : gcc
52
+ gxx : g++
53
+ - arch : arm64
54
+ platform : debian
55
+ gcc_install : gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
56
+ gcc : aarch64-linux-gnu-gcc
57
+ gxx : aarch64-linux-gnu-g++
58
+ # debian uses the triple `arm-linux-gnueabihf` instead of alpine's `armv7-alpine-linux-musleabihf`
59
+ # because of this, we explicitly override triple_arch for debian arm
60
+ - triple_arch : arm
61
+ arch : arm
62
+ platform : debian
63
+ gcc_install : gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
64
+ gcc : arm-linux-gnueabihf-gcc
65
+ gxx : arm-linux-gnueabihf-g++
18
66
19
67
steps :
20
- - uses : actions/checkout@v2
68
+ - uses : actions/checkout@v4
21
69
- name : Use Node.js ${{ matrix.node-version }}
22
- uses : actions/setup-node@v1
70
+ uses : actions/setup-node@v4
23
71
with :
24
72
node-version : ${{ matrix.node-version }}
25
- - name : Build
26
- run : npm install --build-from-source
73
+ - name : Install node dependencies
74
+ run : npm install --ignore-scripts
27
75
env :
28
76
CI : true
29
- - name : Test
30
- run : npm run test
31
- env :
32
- CI : true
33
- - name : Upload
34
- run : node_modules/.bin/prebuild -r napi --upload -u ${{ secrets.GITHUB_TOKEN }}
35
- env :
36
- CI : true
37
-
38
- build-linux-armv7 :
39
- runs-on : ubuntu-20.04
40
-
41
- strategy :
42
- matrix :
43
- node-version : [16.x]
44
- steps :
45
- - uses : actions/checkout@v2
46
- - name : Prepare Cross Compile
47
- run : |
48
- sudo apt update
49
- sudo apt install -y g++-arm-linux-gnueabihf gcc-arm-linux-gnueabihf
50
- mkdir sysroot && cd sysroot
51
- wget https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/ef5c4f84bcafb7a3796d36bb1db7826317dde51c/debian_sid_arm_sysroot.tar.xz
52
- tar xf debian_sid_arm_sysroot.tar.xz
53
- echo "ARM_SYSROOT=$(pwd)" >> $GITHUB_ENV
54
- ls -l
55
- - name : Use Node.js ${{ matrix.node-version }}
56
- uses : actions/setup-node@v1
77
+ - if : matrix.arch != 'amd64'
78
+ name : Set up QEMU
79
+ uses : docker/setup-qemu-action@v3
57
80
with :
58
- node-version : ${{ matrix.node-version }}
59
- - name : Build & Upload
81
+ platforms : ${{ matrix.arch }}
82
+ - name : Install system dependencies
60
83
run : |
61
- npm install --ignore-scripts
62
- node_modules/.bin/prebuild -r napi --backend cmake-js --arch arm --upload -u ${{ secrets.GITHUB_TOKEN }} -- --CDCMAKE_TOOLCHAIN_FILE:FILEPATH=./cmake/toolchain/armv7.cmake
84
+ sudo apt update
85
+ sudo apt install -y podman ninja-build ${{ matrix.gcc_install }}
86
+ - name : List installed libc
87
+ run : apt list --installed | grep libc6-dev
88
+ - name : Build sysroot
89
+ run : sudo podman build --isolation=chroot -t ndc-buildroot:${{ matrix.platform }}-${{ matrix.arch }} ./build-containers --file Dockerfile.${{ matrix.platform }} --platform linux/${{ matrix.arch }} --build-arg="version=${{ matrix.version }}" --build-arg="node_version=${{ matrix.node-version }}"
90
+ - name : Mount sysroot
91
+ id : sysroot
92
+ run : echo "sysroot=$(sudo podman image mount ndc-buildroot:${{ matrix.platform }}-${{ matrix.arch }})" >> $GITHUB_OUTPUT
93
+ - name : Build
94
+ run : sudo --preserve-env=SYSROOT,TRIPLE,COMPILER_FLAGS,LIBC,GCC,GXX,CI,PATH node_modules/.bin/prebuild --arch ${{ matrix.node_arch }} -r napi --backend cmake-js -- --CDCMAKE_TOOLCHAIN_FILE:FILEPATH=./cmake/toolchain/ci.cmake
63
95
env :
96
+ SYSROOT : ${{ steps.sysroot.outputs.sysroot }}
97
+ TRIPLE : ${{ matrix.triple_arch }}-${{ matrix.triple }}${{ matrix.triple_postfix }}
98
+ COMPILER_FLAGS : ${{ matrix.flags }}
99
+ LIBC : ${{ matrix.libc }}
100
+ GCC : ${{ matrix.gcc }}
101
+ GXX : ${{ matrix.gxx }}
64
102
CI : true
65
-
66
- build-linux-arm64 :
67
- runs-on : ubuntu-20.04
68
-
69
- strategy :
70
- matrix :
71
- node-version : [16.x]
72
- steps :
73
- - uses : actions/checkout@v2
74
- - name : Prepare Cross Compile
75
- run : |
76
- sudo apt update
77
- sudo apt install -y g++-aarch64-linux-gnu gcc-aarch64-linux-gnu
78
- mkdir sysroot && cd sysroot
79
- wget https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/41a6c8dec4c4304d6509e30cbaf9218dffb4438e/debian_bullseye_arm64_sysroot.tar.xz
80
- tar xf debian_bullseye_arm64_sysroot.tar.xz
81
- echo "ARM64_SYSROOT=$(pwd)" >> $GITHUB_ENV
82
- ls -l
83
- - name : Use Node.js ${{ matrix.node-version }}
84
- uses : actions/setup-node@v1
85
- with :
86
- node-version : ${{ matrix.node-version }}
87
- - name : Build & Upload
88
- run : |
89
- npm install --ignore-scripts
90
- node_modules/.bin/prebuild -r napi --backend cmake-js --arch arm64 --upload -u ${{ secrets.GITHUB_TOKEN }} -- --CDCMAKE_TOOLCHAIN_FILE:FILEPATH=./cmake/toolchain/arm64.cmake
103
+ - name : Test
104
+ run : sudo podman run --rm -v $(pwd):/usr/app/ -e CI=true --platform linux/${{ matrix.arch }} -t ndc-buildroot:${{ matrix.platform }}-${{ matrix.arch }} npm run test
105
+ - name : Upload
106
+ run : sudo --preserve-env=CI,LIBC node_modules/.bin/prebuild --arch ${{ matrix.node_arch }} -r napi --upload -u ${{ secrets.GITHUB_TOKEN }}
91
107
env :
108
+ LIBC : ${{ matrix.libc }}
92
109
CI : true
93
-
94
- # npm-publish:
95
- # needs: [build-linux, build-linux-armv7, build-linux-arm64]
96
- # name: npm-publish
97
- # runs-on: ubuntu-latest
98
- # steps:
99
- # - name: Checkout repository
100
- # uses: actions/checkout@v2
101
- # - name: Set up Node.js
102
- # uses: actions/setup-node@v1
103
- # with:
104
- # node-version: 16.x
105
- # registry-url: "https://registry.npmjs.org"
106
- # - name: Publish
107
- # run: |
108
- # npm install
109
- # npm publish
110
- # env:
111
- # NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
0 commit comments