forked from atom/node-keytar
-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (155 loc) · 4.89 KB
/
ci.yml
File metadata and controls
164 lines (155 loc) · 4.89 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Prebuild
on:
push:
# tags:
# - v*
pull_request:
branches:
- master
env:
NAPI_VERSION: 3
BINDING_NAME: keytar
jobs:
build-and-test:
name: Build ${{ matrix.arch }} on ${{ matrix.os }} ${{ matrix.libc }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# windows
- os: windows-2019
arch: x64
is-native: true
- os: windows-2019
arch: arm64
is-native: false
- os: windows-2019
arch: ia32
is-native: false
- os: macos-11
arch: arm64
is-native: false
- os: macos-11
arch: x64
is-native: true
# linux
- os: ubuntu-latest
arch: x64
is-native: true
# linux-libc
- os: ubuntu-latest
arch: arm64
is-native: false
docker-arch: linux/arm64
docker-image: node:16-buster
- os: ubuntu-latest
arch: arm
is-native: false
docker-arch: linux/arm/v7
docker-image: node:16-buster
# linux-musl
- os: ubuntu-latest
arch: x64
is-native: false
docker-arch: linux/amd64
docker-image: node:16-alpine
libc: musl
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: cibuild
if: ${{ matrix.os == 'ubuntu-latest' && !matrix.docker-arch }}
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y gnome-keyring
bash script/cibuild
- name: download-node-lib-win-arm64
if: ${{ matrix.os == 'windows-2019' && matrix.arch == 'arm64' }}
run: |
$NodeVersion = (node --version) -replace '^.'
$NodeFallbackVersion = "16.5.0"
& .\script\download-node-lib-win-arm64.ps1 $NodeVersion $NodeFallbackVersion
- name: rebuild
if: ${{ !matrix.docker-arch }}
shell: bash
run: |
yarn
# if is native and os other than ubuntu, run test
if [ -n "${{ matrix.is-native }}" ] && [ "${{ matrix.os }}" != "ubuntu-latest" ]; then
yarn test
fi
yarn rebuild --arch=${{ matrix.arch }}
ls -l build/Release
yarn pkg-prebuilds-copy --baseDir=build/Release \
--source=$BINDING_NAME.node \
--name=$BINDING_NAME \
--strip \
--napi_version=$NAPI_VERSION \
--arch=${{ matrix.arch }}
env:
CI: true
npm_config_build_from_source: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: matrix.docker-arch
- name: rebuild (in docker)
uses: addnab/docker-run-action@v3
if: matrix.docker-arch
with:
image: ${{ matrix.docker-image }}
options: --cap-add ipc_lock --platform=${{ matrix.docker-arch }} -v ${{ github.workspace }}:/work -e CI=1 -e npm_config_build_from_source=1 -e NAPI_VERSION -e BINDING_NAME
run: |
# if /etc/machine-id does not exist, create it
if [ ! -f /etc/machine-id ]; then
uuidgen | tr -d '-' > /etc/machine-id
fi
if command -v apt-get &> /dev/null
then
echo "deb http://deb.debian.org/debian buster-backports main contrib non-free" | tee -a /etc/apt/sources.list.d/backports.list
apt update
apt install -y cmake/buster-backports yasm libsecret-1-dev gnome-keyring
elif command -v apk &> /dev/null
then
apk update
apk add cmake make g++ gcc yasm libsecret-dev
fi
cd /work
script/cibuild
yarn
yarn test
yarn pkg-prebuilds-copy --baseDir=build/Release \
--source=$BINDING_NAME.node \
--name=$BINDING_NAME \
--strip \
--napi_version=$NAPI_VERSION \
--arch=${{ matrix.arch }} \
--libc=${{ matrix.libc }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-${{ matrix.arch }}-${{ matrix.libc }}-prebuilds
path: prebuilds
retention-days: 1
bundle:
name: Bundle prebuilds
needs: build-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
path: tmp
- name: Display structure of downloaded files
run: |
mkdir prebuilds
mv tmp/*/* prebuilds/
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: all-prebuilds
path: prebuilds
retention-days: 7