chore(deps): update actions/setup-node action to v4 #578
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: | |
pull_request: | |
push: | |
branches: | |
- master | |
jobs: | |
JS_BUILD: | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Install dependencies and build JS | |
run: | | |
npm install | |
npm run build.js | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
path: | | |
./*.js | |
./*.d.ts | |
NATIVE_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: | |
- 12 | |
arch: | |
- x64 | |
prebuild_cmd: | |
- npm run prebuild.native | |
docker: | |
- "" | |
include: | |
- os: windows-2016 | |
node: 12 | |
arch: x86 | |
prebuild_cmd: npm run prebuild.native.ia32 | |
- os: ubuntu-20.04 | |
docker: node:12-alpine | |
arch: x64 | |
apk: python3 make gcc g++ musl-dev | |
node: 12 | |
prebuild_cmd: npm run prebuild.native | |
# - os: macos-11.0 | |
# node: 15 | |
# arch: arm64 | |
# prebuild_cmd: npm run prebuild.native-arm64 | |
name: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.docker }}-${{ matrix.node }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache node_modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: node_modules | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-${{ matrix.node }}-${{ matrix.arch }}-${{ hashFiles('package.json') }} | |
- name: Install Docker | |
if: ${{ matrix.docker }} | |
run: | | |
docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io | |
docker pull ${{ matrix.docker }} | |
docker tag ${{ matrix.docker }} builder | |
# - name: Install Compiler for Ubuntu 16.04 | |
# if: ${{ contains(matrix.os, 'ubuntu-16.04') }} | |
# run: | | |
# sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" | |
# sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-9 10 | |
# 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 | |
# echo "CXX=clang++" >> $GITHUB_ENV | |
- name: Install Node | |
if: ${{ !matrix.docker }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
architecture: ${{ matrix.arch }} | |
- name: Install dependencies | |
run: npm install --ignore-scripts | |
- name: Build native | |
if: ${{ !matrix.docker }} | |
run: npm run build.native | |
- name: Prebuildify | |
if: ${{ !matrix.docker }} | |
run: ${{ matrix.prebuild_cmd }} | |
- name: Prebuildify Docker | |
if: ${{ matrix.docker }} | |
run: docker run --volume ${{ github.workspace }}:/projectdir --workdir /projectdir --privileged builder sh -c "apk add --no-cache ${{ matrix.apk }} && ${{ matrix.prebuild_cmd }}" | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
path: ./prebuilds | |
Test: | |
needs: [NATIVE_Build, JS_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: | |
- 10 | |
- 12 | |
- 14 | |
arch: | |
- x64 | |
include: | |
- os: windows-2016 | |
node: 12 | |
arch: x86 | |
- os: ubuntu-16.04 | |
node: 12 | |
- os: macos-10.15 | |
node: 12 | |
# Node arm64 doesn't exist yet | |
# - os: macos-11.0 | |
# node: 15 | |
# arch: arm64 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache node_modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: node_modules | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-${{ matrix.node }}-${{ matrix.arch }}-${{ hashFiles('package.json') }} | |
- name: Install Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
architecture: ${{ matrix.arch }} | |
- name: Install dependencies only | |
run: | | |
npm install --ignore-scripts | |
- name: Download articats | |
uses: actions/download-artifact@v2 | |
- name: Install prebuilds | |
shell: bash | |
run: | | |
rm -rf build | |
mkdir prebuilds | |
mv ./artifact/*.js . | |
mv ./artifact/*.d.ts . | |
mv artifact/* prebuilds/ | |
- name: Run tests | |
run: npm run test | |
- name: Run benchmarks | |
if: ${{ !contains(matrix.arch, 'x86') }} # https://github.com/npm/npm-lifecycle/issues/54 | |
run: npm run benchmark | |
Lint: | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Commit lint ✨ | |
uses: wagoid/commitlint-github-action@v4 | |
- name: Install dependencies | |
run: npm install | |
- name: Format ✨ | |
run: npm run test.format | |
- name: Lint ✨ | |
run: npm run test.lint |