Skip to content

Commit

Permalink
ci: replace Travis CI/AppVeyor with GitHub Actions, prebuild for macO…
Browse files Browse the repository at this point in the history
…S/arm64 (#126)

* ci: replace Travis CI/AppVeyor with GitHub Actions

* chore: remove use of prebuildify-ci

* Note that the step only dry runs publishing
  • Loading branch information
malept committed Jan 11, 2022
1 parent 8af909b commit da5832b
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 116 deletions.
126 changes: 126 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: CI

on:
push:
branches:
- main
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macOS-latest, ubuntu-latest]
node-version: [12.x, 14.x, 16.x]

steps:
- name: Fix git checkout line endings
run: git config --global core.autocrlf input
- uses: actions/checkout@v2.3.4
- name: Setup Node.js
uses: actions/setup-node@v2.3.0
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2.1.6
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Windows Setup
if: matrix.os == 'windows-latest'
run: yarn prepare-win32
- name: Install
run: yarn
- name: Lint
run: yarn jshint
- name: Test
run: yarn test

prebuild:
needs: test
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [windows, macOS, ubuntu]
arch: [x64, arm64]
exclude:
- os: windows
arch: arm64
include:
- os: windows
arch: ia32

steps:
- name: Fix git checkout line endings
run: git config --global core.autocrlf input
- uses: actions/checkout@v2.3.4
- name: Setup Node.js
uses: actions/setup-node@v2.3.0
with:
node-version: 12.x
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2.1.6
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.arch }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-${{ matrix.arch }}-yarn-
- name: Windows Setup
if: matrix.os == 'windows'
run: yarn prepare-win32
- name: Install
run: yarn
- name: Prebuild binaries
run: yarn prebuild --v8_enable_pointer_compression=false --v8_enable_31bit_smis_on_64bit_arch=false
env:
PREBUILD_ARCH: ${{ matrix.arch }}
- name: Upload binaries as an artifact
uses: actions/upload-artifact@v2.3.1
with:
name: prebuild-${{ matrix.os }}-${{ matrix.arch }}
path: prebuilds

publish:
needs: prebuild
runs-on: ubuntu-latest

steps:
- name: Fix git checkout line endings
run: git config --global core.autocrlf input
- uses: actions/checkout@v2.3.4
- name: Setup Node.js
uses: actions/setup-node@v2.3.0
with:
node-version: 12.x
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2.1.6
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.arch }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-${{ matrix.arch }}-yarn-
- name: Install
run: yarn
- name: Download prebuild artifacts
uses: actions/download-artifact@v2.1.0
with:
path: artifacts
- name: Merge artifacts to prebuilds directory
run: |
mkdir prebuilds
mv artifacts/*/* prebuilds/
rm -r artifacts
ls prebuilds
- name: Publish to NPM (dry run)
run: npm publish --dry-run
60 changes: 0 additions & 60 deletions .travis.yml

This file was deleted.

51 changes: 0 additions & 51 deletions appveyor.yml

This file was deleted.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
},
"dependencies": {
"node-addon-api": "^3.1.0",
"readable-stream": "^3.6.0",
"node-gyp-build": "^4.2.1"
"node-gyp-build": "^4.2.1",
"readable-stream": "^3.6.0"
},
"keywords": [
"lzma",
Expand All @@ -34,7 +34,7 @@
"scripts": {
"install": "node-gyp-build",
"prebuild": "prebuildify --napi --tag-armv",
"prepack": "prebuildify-ci download && ([ $(ls prebuilds | wc -l) = '5' ] || (echo 'Some prebuilds are missing'; exit 1))",
"prepack": "[ $(ls prebuilds | wc -l) = '6' ] || (echo 'Some prebuilds are missing'; exit 1)",
"test": "mocha --expose-gc -s 1000 -t 5000",
"prepare": "npm run prepare-win32 || true",
"prepare-win32": "cd deps && 7z x -y xz-5.2.3-windows.7z bin_i686/liblzma.dll bin_x86-64/liblzma.dll include doc/liblzma.def",
Expand All @@ -48,7 +48,6 @@
"bl": "^4.1.0",
"jshint": "^2.12.0",
"mocha": "^8.3.1",
"prebuildify": "^3.0.4",
"prebuildify-ci": "^1.0.5"
"prebuildify": "^3.0.4"
}
}

0 comments on commit da5832b

Please sign in to comment.