This repository was archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
114 lines (94 loc) · 3.36 KB
/
ci.yml
File metadata and controls
114 lines (94 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: CI
on:
push:
branches: [master]
tags:
- v*.*.*
pull_request:
branches: [master]
jobs:
build:
name: ${{ matrix.friendlyName }}
env:
DISPLAY: ":99.0"
CC: "clang"
CXX: "clang++"
npm_config_clang: "1"
strategy:
fail-fast: false
matrix:
node-version: [15.x]
os: [ubuntu-18.04, windows-latest, macos-latest]
include:
- os: ubuntu-18.04
friendlyName: Ubuntu
- os: windows-latest
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 }}
# 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-latest' }}
name: Install Windows arm64 node.lib
- run: npm install
name: Setup environment
- run: npm run build
name: Build native module from source
- run: npm test
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-18.04' }}
- run: npm run prebuild-napi-ia32
if: ${{ matrix.os == 'windows-latest' }}
name: Prebuild (Windows x86)
- run: |
mkdir -p prebuilds && chmod 777 prebuilds
docker build -t node-fs-admin/i386 docker/i386
docker run --rm -v ${PWD}:/project node-fs-admin/i386 /bin/bash -c "cd /project && npm run prebuild-napi-ia32 && rm -rf build"
docker build -t node-fs-admin/arm64-cross-compile docker/arm64-cross-compile
docker run --rm -v ${PWD}:/project node-fs-admin/arm64-cross-compile /bin/bash -c "cd /project && npm run prebuild-napi-arm64"
if: ${{ matrix.os == 'ubuntu-18.04' }}
name: Prebuild (Linux x86 + ARM64)
- 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
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 }}