Skip to content

Commit aec6839

Browse files
committed
fix: separate build and test in ci
1 parent 0a7daa7 commit aec6839

File tree

1 file changed

+63
-25
lines changed

1 file changed

+63
-25
lines changed

.github/workflows/CI.yml

Lines changed: 63 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- master
77

88
jobs:
9-
Test:
9+
Build:
1010
if: "!contains(github.event.head_commit.message, '[skip ci]')"
1111
runs-on: ${{ matrix.os }}
1212
strategy:
@@ -17,19 +17,13 @@ jobs:
1717
- macos-11.0
1818
- windows-latest
1919
node_version:
20-
- 10
2120
- 12
22-
- 14
2321
node_arch:
2422
- x64
2523
include:
2624
- os: windows-2016
2725
node_version: 12
2826
node_arch: x86
29-
- os: ubuntu-16.04
30-
node_version: 12
31-
- os: macos-10.15
32-
node_version: 12
3327
steps:
3428
- uses: actions/checkout@v2
3529

@@ -50,7 +44,7 @@ jobs:
5044
# sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-9 10
5145
# sudo update-alternatives --config clang
5246
# sudo update-alternatives --config clang++
53-
47+
5448
# - name: Set Compiler for Ubuntu
5549
# run: |
5650
# echo "CC=clang" >> $GITHUB_ENV
@@ -65,13 +59,6 @@ jobs:
6559
- name: Install dependencies and build
6660
run: npm install
6761

68-
- name: Run tests
69-
run: npm run test
70-
71-
- name: Run benchmarks
72-
if: ${{ !contains(matrix.node_arch, 'x86') }} # https://github.com/npm/npm-lifecycle/issues/54
73-
run: npm run benchmark
74-
7562
- name: Prebuildify x64
7663
if: ${{ contains(matrix.node_version, '12') && contains(matrix.node_arch, 'x64') }}
7764
run: npm run native:prebuild
@@ -80,23 +67,74 @@ jobs:
8067
if: ${{ contains(matrix.node_version, '12') && contains(matrix.node_arch, 'x86') }}
8168
run: npm run native:prebuild-ia32
8269

83-
- name: Upload artifacts for Ubuntu
84-
if: ${{ contains(matrix.node_version, '12') && contains(matrix.os, 'ubuntu-20.04') }}
70+
- name: Upload artifacts
8571
uses: actions/[email protected]
8672
with:
8773
path: ./prebuilds
8874

89-
- name: Upload artifacts for MacOS
90-
if: ${{ contains(matrix.node_version, '12') && contains(matrix.os, 'macos-11.0') }}
91-
uses: actions/[email protected]
75+
Test:
76+
needs: Build
77+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
78+
runs-on: ${{ matrix.os }}
79+
strategy:
80+
fail-fast: false
81+
matrix:
82+
os:
83+
- ubuntu-20.04
84+
- macos-11.0
85+
- windows-latest
86+
node_version:
87+
- 10
88+
- 12
89+
- 14
90+
node_arch:
91+
- x64
92+
include:
93+
- os: windows-2016
94+
node_version: 12
95+
node_arch: x86
96+
- os: ubuntu-16.04
97+
node_version: 12
98+
- os: macos-10.15
99+
node_version: 12
100+
steps:
101+
- uses: actions/checkout@v2
102+
103+
- name: Cache node_modules
104+
uses: actions/cache@v2
105+
env:
106+
cache-name: |
107+
node_modules
92108
with:
93-
path: ./prebuilds
109+
path: node_modules
110+
key: ${{ runner.os }}-${{ matrix.node_version }}-${{ matrix.node_arch }}-${{ hashFiles('package.json') }}
94111

95-
- name: Upload artifacts for Windows
96-
if: ${{ contains(matrix.node_version, '12') && contains(matrix.os, 'windows-latest') }}
97-
uses: actions/[email protected]
112+
- name: Install Node
113+
uses: actions/[email protected]
98114
with:
99-
path: ./prebuilds
115+
node-version: ${{ matrix.node_version }}
116+
architecture: ${{ matrix.node_arch }}
117+
118+
- name: Install dependencies and build
119+
run: npm install
120+
121+
- name: Download articats
122+
uses: actions/download-artifact@v2
123+
124+
- name: Install prebuilds
125+
shell: bash
126+
run: |
127+
rm -rf build
128+
mkdir prebuilds
129+
mv artifact/* prebuilds/
130+
ls prebuilds
131+
132+
- name: Run tests
133+
run: npm run test
134+
135+
- name: Run benchmarks
136+
if: ${{ !contains(matrix.node_arch, 'x86') }} # https://github.com/npm/npm-lifecycle/issues/54
137+
run: npm run benchmark
100138

101139
Skip:
102140
if: contains(github.event.head_commit.message, '[skip ci]')

0 commit comments

Comments
 (0)