This repository has been archived by the owner on Feb 9, 2024. It is now read-only.
Merge upstream #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ master ] | |
tags: | |
- v*.*.* | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
name: ${{ matrix.friendlyName }} | |
env: | |
CC: "clang" | |
CXX: "clang++" | |
npm_config_clang: "1" | |
strategy: | |
matrix: | |
node-version: [15.x] | |
os: [ubuntu-20.04, windows-2019, macos-latest] | |
include: | |
- os: ubuntu-20.04 | |
friendlyName: Ubuntu | |
- os: windows-2019 | |
friendlyName: Windows | |
- os: macos-latest | |
friendlyName: macOS | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: | | |
sudo apt-get install gnome-keyring \ | |
libsecret-1-dev \ | |
dbus-x11 \ | |
python3-dev | |
if: ${{ matrix.os == 'ubuntu-20.04' }} | |
name: Install additional dependencies | |
# This step can be removed as soon as official Windows arm64 builds are published: | |
# https://github.com/nodejs/build/issues/2450#issuecomment-705853342 | |
- run: | | |
$NodeVersion = (node --version) -replace '^.' | |
$NodeFallbackVersion = "15.8.0" | |
& .\script\download-node-lib-win-arm64.ps1 $NodeVersion $NodeFallbackVersion | |
if: ${{ matrix.os == 'windows-2019' }} | |
name: Install Windows arm64 node.lib | |
- run: npm install | |
name: Setup environment | |
- run: npm run build | |
name: Build native module from source | |
- run: | | |
echo "Install keyring..." | |
pip3 install --upgrade pip | |
pip3 install keyring | |
echo "Prepare D-Bus session..." | |
eval $(dbus-launch --sh-syntax); | |
eval $(echo 'somecredstorepass' | gnome-keyring-daemon --unlock) | |
echo "Create a test key using script..." | |
python -c "import keyring;keyring.set_password('system', 'login', 'pwd');" | |
npm test | |
if: ${{ matrix.os == 'ubuntu-20.04' }} | |
name: Run tests (Linux) | |
- run: npm test | |
if: ${{ matrix.os != 'ubuntu-20.04' }} | |
name: Run tests (Windows/macOS) | |
- run: npm run prebuild-napi-x64 | |
name: Prebuild (x64) | |
- run: npm run prebuild-napi-arm64 | |
name: Prebuild (arm64) | |
if: ${{ matrix.os != 'ubuntu-20.04' }} | |
- run: npm run prebuild-napi-ia32 | |
if: ${{ matrix.os == 'windows-2019' }} | |
name: Prebuild (Windows x86) | |
- run: | | |
mkdir -p prebuilds && chmod 777 prebuilds | |
docker build -t node-keytar/i386 docker/i386 | |
docker run --rm -v ${PWD}:/project node-keytar/i386 /bin/bash -c "cd /project && npm run prebuild-napi-ia32 && rm -rf build" | |
docker build -t node-keytar/arm64-cross-compile docker/arm64-cross-compile | |
docker run --rm -v ${PWD}:/project node-keytar/arm64-cross-compile /bin/bash -c "cd /project && npm run prebuild-napi-arm64 && rm -rf build" | |
docker build -t node-keytar/armv7l-cross-compile docker/armv7l-cross-compile | |
docker run --rm -v ${PWD}:/project node-keytar/armv7l-cross-compile /bin/bash -c "cd /project && npm run prebuild-napi-armv7l" | |
if: ${{ matrix.os == 'ubuntu-20.04' }} | |
name: Prebuild (Linux x86 + ARM64 + ARMV7L) | |
- run: | | |
ls prebuilds/ | |
name: List prebuilds | |
- name: Upload prebuilds to GitHub | |
run: npm run upload | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
env: | |
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
alpine-build: | |
runs-on: ubuntu-latest | |
container: node:15-alpine3.12 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: install additional dependencies | |
run: | | |
apk add g++ make python2 libsecret-dev | |
- run: npm install | |
name: Setup environment | |
- run: | | |
npm run prebuild-napi-x64 | |
npm run prebuild-napi-arm64 | |
name: Prebuild | |
- run: | | |
ls prebuilds/ | |
name: List prebuilds | |
- name: Upload prebuilds to GitHub | |
run: npm run upload | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
env: | |
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Separate step for publishing to NPM so we're sure that generating + uploading prebuilds worked on all platforms | |
npm-publish: | |
needs: [build, alpine-build] | |
name: Publish to NPM | |
runs-on: ubuntu-20.04 | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js 15 | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 15.x | |
registry-url: 'https://registry.npmjs.org' | |
- run: sudo apt-get install libsecret-1-dev | |
name: Install additional dependencies | |
- run: npm install | |
name: Setup environment | |
- run: npm publish --access public | |
name: Upload to NPM | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |