Skip to content

Commit

Permalink
fix: separate build and test in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Dec 11, 2020
1 parent 0a7daa7 commit aec6839
Showing 1 changed file with 63 additions and 25 deletions.
88 changes: 63 additions & 25 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- master

jobs:
Test:
Build:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -17,19 +17,13 @@ jobs:
- macos-11.0
- windows-latest
node_version:
- 10
- 12
- 14
node_arch:
- x64
include:
- os: windows-2016
node_version: 12
node_arch: x86
- os: ubuntu-16.04
node_version: 12
- os: macos-10.15
node_version: 12
steps:
- uses: actions/checkout@v2

Expand All @@ -50,7 +44,7 @@ jobs:
# sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-9 10
# sudo update-alternatives --config clang
# sudo update-alternatives --config clang++

# - name: Set Compiler for Ubuntu
# run: |
# echo "CC=clang" >> $GITHUB_ENV
Expand All @@ -65,13 +59,6 @@ jobs:
- name: Install dependencies and build
run: npm install

- name: Run tests
run: npm run test

- name: Run benchmarks
if: ${{ !contains(matrix.node_arch, 'x86') }} # https://github.com/npm/npm-lifecycle/issues/54
run: npm run benchmark

- name: Prebuildify x64
if: ${{ contains(matrix.node_version, '12') && contains(matrix.node_arch, 'x64') }}
run: npm run native:prebuild
Expand All @@ -80,23 +67,74 @@ jobs:
if: ${{ contains(matrix.node_version, '12') && contains(matrix.node_arch, 'x86') }}
run: npm run native:prebuild-ia32

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

- name: Upload artifacts for MacOS
if: ${{ contains(matrix.node_version, '12') && contains(matrix.os, 'macos-11.0') }}
uses: actions/[email protected]
Test:
needs: Build
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- macos-11.0
- windows-latest
node_version:
- 10
- 12
- 14
node_arch:
- x64
include:
- os: windows-2016
node_version: 12
node_arch: x86
- os: ubuntu-16.04
node_version: 12
- os: macos-10.15
node_version: 12
steps:
- uses: actions/checkout@v2

- name: Cache node_modules
uses: actions/cache@v2
env:
cache-name: |
node_modules
with:
path: ./prebuilds
path: node_modules
key: ${{ runner.os }}-${{ matrix.node_version }}-${{ matrix.node_arch }}-${{ hashFiles('package.json') }}

- name: Upload artifacts for Windows
if: ${{ contains(matrix.node_version, '12') && contains(matrix.os, 'windows-latest') }}
uses: actions/[email protected]
- name: Install Node
uses: actions/[email protected]
with:
path: ./prebuilds
node-version: ${{ matrix.node_version }}
architecture: ${{ matrix.node_arch }}

- name: Install dependencies and build
run: npm install

- name: Download articats
uses: actions/download-artifact@v2

- name: Install prebuilds
shell: bash
run: |
rm -rf build
mkdir prebuilds
mv artifact/* prebuilds/
ls prebuilds
- name: Run tests
run: npm run test

- name: Run benchmarks
if: ${{ !contains(matrix.node_arch, 'x86') }} # https://github.com/npm/npm-lifecycle/issues/54
run: npm run benchmark

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

0 comments on commit aec6839

Please sign in to comment.