Skip to content

Commit d67224e

Browse files
authored
upgrade keytar toolchain to modern Node versions, add support for packaging on arm (#1)
* upgrade keytar toolchain to modern Node versions, add support for packaging on arm * other CI fixes * also use python3 now * and one more python mention * upgrade codeql build to latest versions of dependencies * use configured node version instead of hard-coding where possible * add missing dependencies for codeql * maybe just some dependencies
1 parent deae59a commit d67224e

File tree

9 files changed

+4019
-2860
lines changed

9 files changed

+4019
-2860
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@ on:
88
pull_request:
99
branches: [ master ]
1010

11+
permissions:
12+
contents: write # to allow workflow to publish release
13+
1114
jobs:
1215
build:
1316
name: ${{ matrix.friendlyName }}
14-
env:
15-
CC: "clang"
16-
CXX: "clang++"
17-
npm_config_clang: "1"
1817

1918
strategy:
2019
matrix:
21-
node-version: [15.x]
20+
node-version: [22.x]
2221
os: [ubuntu-20.04, windows-2019, macos-latest]
2322
include:
2423
- os: ubuntu-20.04
@@ -31,11 +30,11 @@ jobs:
3130
runs-on: ${{ matrix.os }}
3231

3332
steps:
34-
- uses: actions/checkout@v2
35-
- name: Use Node.js ${{ matrix.node-version }}
36-
uses: actions/setup-node@v1
33+
- uses: actions/checkout@v4
34+
- name: Install Node.js
35+
uses: actions/setup-node@v4
3736
with:
38-
node-version: ${{ matrix.node-version }}
37+
node-version-file: '.node-version'
3938
- run: |
4039
sudo apt-get install gnome-keyring \
4140
libsecret-1-dev \
@@ -44,16 +43,7 @@ jobs:
4443
if: ${{ matrix.os == 'ubuntu-20.04' }}
4544
name: Install additional dependencies
4645
47-
# This step can be removed as soon as official Windows arm64 builds are published:
48-
# https://github.com/nodejs/build/issues/2450#issuecomment-705853342
49-
- run: |
50-
$NodeVersion = (node --version) -replace '^.'
51-
$NodeFallbackVersion = "15.8.0"
52-
& .\script\download-node-lib-win-arm64.ps1 $NodeVersion $NodeFallbackVersion
53-
if: ${{ matrix.os == 'windows-2019' }}
54-
name: Install Windows arm64 node.lib
55-
56-
- run: npm install
46+
- run: npm ci
5747
name: Setup environment
5848

5949
- run: npm run build
@@ -93,6 +83,7 @@ jobs:
9383
docker run --rm -v ${PWD}:/project node-keytar/i386 /bin/bash -c "cd /project && npm run prebuild-napi-ia32 && rm -rf build"
9484
docker build -t node-keytar/arm64-cross-compile docker/arm64-cross-compile
9585
docker run --rm -v ${PWD}:/project node-keytar/arm64-cross-compile /bin/bash -c "cd /project && npm run prebuild-napi-arm64 && rm -rf build"
86+
docker run --rm -v ${PWD}:/project node-keytar/arm64-cross-compile /bin/bash -c "cd /project && npm run prebuild-napi-arm && rm -rf build"
9687
docker build -t node-keytar/armv7l-cross-compile docker/armv7l-cross-compile
9788
docker run --rm -v ${PWD}:/project node-keytar/armv7l-cross-compile /bin/bash -c "cd /project && npm run prebuild-napi-armv7l"
9889
if: ${{ matrix.os == 'ubuntu-20.04' }}
@@ -103,37 +94,34 @@ jobs:
10394
name: List prebuilds
10495
10596
- name: Upload prebuilds to GitHub
106-
run: npm run upload
97+
run: npx prebuild --verbose --upload-all ${{ secrets.GITHUB_TOKEN }}
10798
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
108-
env:
109-
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11099

111100
alpine-build:
112101
runs-on: ubuntu-latest
113-
container: node:15-alpine3.12
102+
container: node:22-alpine3.20
114103
steps:
115-
- uses: actions/checkout@v2
104+
- uses: actions/checkout@v4
116105
- name: install additional dependencies
117106
run: |
118-
apk add g++ make python2 libsecret-dev
107+
apk add g++ make python3 libsecret-dev
119108
120-
- run: npm install
109+
- run: npm ci
121110
name: Setup environment
122111

123112
- run: |
124113
npm run prebuild-napi-x64
125114
npm run prebuild-napi-arm64
115+
npm run prebuild-napi-arm
126116
name: Prebuild
127117
128118
- run: |
129119
ls prebuilds/
130120
name: List prebuilds
131121
132122
- name: Upload prebuilds to GitHub
133-
run: npm run upload
123+
run: npx prebuild --verbose --upload-all ${{ secrets.GITHUB_TOKEN }}
134124
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
135-
env:
136-
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
137125

138126
# Separate step for publishing to NPM so we're sure that generating + uploading prebuilds worked on all platforms
139127
npm-publish:
@@ -143,17 +131,17 @@ jobs:
143131
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
144132

145133
steps:
146-
- uses: actions/checkout@v2
147-
- name: Use Node.js 15
148-
uses: actions/setup-node@v1
134+
- uses: actions/checkout@v4
135+
- name: Install NodeJS
136+
uses: actions/setup-node@v4
149137
with:
150-
node-version: 15.x
138+
node-version-file: '.node-version'
151139
registry-url: 'https://registry.npmjs.org'
152140

153141
- run: sudo apt-get install libsecret-1-dev
154142
name: Install additional dependencies
155143

156-
- run: npm install
144+
- run: npm ci
157145
name: Setup environment
158146

159147
- run: npm publish --access public

.github/workflows/codeql.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,29 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
os: [ubuntu-latest, windows-2019, macos-latest]
14+
os: [ubuntu-latest, windows-latest, macos-latest]
1515
include:
1616
- os: ubuntu-latest
1717
friendlyName: Ubuntu
18-
- os: windows-2019
18+
- os: windows-latest
1919
friendlyName: Windows
2020
- os: macos-latest
2121
friendlyName: macOS
2222
steps:
2323
- name: Checkout repository
24-
uses: actions/checkout@v2
24+
uses: actions/checkout@v4
2525

2626
# Initializes the CodeQL tools for scanning.
2727
- name: Initialize CodeQL
28-
uses: github/codeql-action/init@v1
28+
uses: github/codeql-action/init@v3
2929
with:
3030
languages: javascript, cpp
3131

32+
- run: |
33+
sudo apt-get install libsecret-1-dev
34+
if: ${{ matrix.os == 'ubuntu-latest' }}
35+
name: Install additional dependencies
36+
3237
# Setup dependencies (and build native modules from source)
3338
- name: Install dependencies
3439
run: |
@@ -37,4 +42,4 @@ jobs:
3742
3843
# Run code analysis
3944
- name: Perform CodeQL Analysis
40-
uses: github/codeql-action/analyze@v1
45+
uses: github/codeql-action/analyze@v3

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14.15.1
1+
22.13.1

docker/arm64-cross-compile/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
FROM debian:buster
1+
FROM debian:bookworm
22

33
RUN dpkg --add-architecture arm64
44
RUN apt-get update && apt-get install -y --no-install-recommends \
55
crossbuild-essential-arm64 \
6-
python \
6+
python3 \
77
git \
88
pkg-config \
99
fakeroot \
@@ -25,5 +25,5 @@ ENV AS=/usr/bin/aarch64-linux-gnu-as \
2525
FC=/usr/bin/aarch64-linux-gnu-gfortran \
2626
PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig
2727

28-
RUN curl -sL https://deb.nodesource.com/setup_15.x | bash -
28+
RUN curl -sL https://deb.nodesource.com/setup_22.x | bash -
2929
RUN apt-get install -y nodejs

docker/armv7l-cross-compile/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
FROM debian:buster
1+
FROM debian:bookworm
22

33
RUN dpkg --add-architecture armhf
44
RUN apt-get update && apt-get install -y --no-install-recommends \
55
crossbuild-essential-armhf \
6-
python \
6+
python3 \
77
git \
88
pkg-config \
99
fakeroot \
@@ -25,5 +25,5 @@ ENV AS=/usr/bin/arm-linux-gnueabihf-as \
2525
FC=/usr/bin/arm-linux-gnueabihf-gfortran \
2626
PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig
2727

28-
RUN curl -sL https://deb.nodesource.com/setup_15.x | bash -
28+
RUN curl -sL https://deb.nodesource.com/setup_22.x | bash -
2929
RUN apt-get install -y nodejs

docker/i386/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM i386/debian:stretch
1+
FROM i386/debian:bullseye
22

33
RUN apt-get update
44
RUN apt-get install --quiet --yes \
@@ -9,8 +9,9 @@ RUN apt-get install --quiet --yes \
99
python \
1010
libsecret-1-dev
1111

12-
RUN curl -sL https://deb.nodesource.com/setup_9.x | bash -
13-
RUN apt-get install -y nodejs
12+
RUN curl -sL 'https://unofficial-builds.nodejs.org/download/release/v20.12.2/node-v20.12.2-linux-x86.tar.xz' | xzcat | tar -vx --strip-components=1 -C /usr/local/
13+
14+
RUN node -v
1415

1516
ENV CC clang
1617
ENV CXX clang++

0 commit comments

Comments
 (0)