Skip to content

Use Buffer.from instead of new Buffer #648

Use Buffer.from instead of new Buffer

Use Buffer.from instead of new Buffer #648

Workflow file for this run

name: Build
on:
push:
tags:
- "1.*"
- "2.*"
- "3.*"
- "4.*"
branches:
pull_request:
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-22.04
env:
node_version: 18.8.0
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.node_version }}
- run: npm install prettier
- run: npm run test:codestyle
build-musl-arm:
needs: [lint]
strategy:
fail-fast: false
matrix:
node: [15.7.0, 16.11.1, 17.6.0, 18.8.0, 19.0.0]
include:
- architecture: arm64
architecture_node: x64
target_architecture: arm64
extra_compile_flags: -march=armv8-a
- python_version: 3
node: 16.11.1
- python_version: 3
node: 17.6.0
- python_version: 3
node: 18.8.0
- python_version: 3
node: 19.0.0
runs-on: ubuntu-latest
container:
image: dockcross/linux-arm64-musl
credentials:
username: "${{ secrets.DOCKER_USERNAME }}"
password: "${{ secrets.DOCKER_PASSWORD }}"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.architecture_node }}
- run: apt-get install -y python${{ matrix.python_version }}
- run: npm config set unsafe-perm true
- run: node --version
- run: npm --version
- run: chmod 0777 tests/output/
- run: npm install --build-from-source
env:
npm_config_arch: ${{ matrix.architecture }}
npm_config_target_arch: ${{ matrix.target_architecture }}
CFLAGS: ${{ matrix.extra_compile_flags }}
CPPFLAGS: ${{ matrix.extra_compile_flags }}
EXTRA_NODE_PRE_GYP_FLAGS: --target_libc=musl
# - run: npm run test, this is not an arm64 machine so we can not test.
- run: ./node_modules/.bin/node-pre-gyp package --target_libc=musl --target_arch=${{ matrix.target_architecture }}
- uses: actions/upload-artifact@v2
with:
path: build/stage/julianhille/MuhammaraJS/releases/download/**/*.gz
name: bindings
if-no-files-found: error
build-musl:
needs: [lint]
strategy:
fail-fast: false
matrix:
node: [15.7.0, 16.11.1, 17.6.0, 18.8.0, 19.0.0]
include:
- python_version: 3
node: 16.11.1
- python_version: 3
node: 17.6.0
- python_version: 3
node: 18.8.0
- python_version: 3
node: 19.0.0
runs-on: ubuntu-latest
container:
image: node:${{ matrix.node }}-alpine
credentials:
username: "${{ secrets.DOCKER_USERNAME }}"
password: "${{ secrets.DOCKER_PASSWORD }}"
steps:
- uses: actions/checkout@v2
- run: apk update
- run: apk add --no-cache make gcc jq g++ python${{ matrix.python_version }} tar
- run: npm config set unsafe-perm true
- run: node --version
- run: npm --version
- run: chmod 0777 tests/output/
- run: npm install --build-from-source
env:
EXTRA_NODE_PRE_GYP_FLAGS: --target_libc=musl
- run: npm run test
- run: ./node_modules/.bin/node-pre-gyp package testpackage --target_libc=musl
- uses: actions/upload-artifact@v2
with:
path: build/stage/julianhille/MuhammaraJS/releases/download/**/*.gz
name: bindings
if-no-files-found: error
build-electron:
needs: [lint]
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-11, windows-2019]
architecture: [x64, ia32, arm64]
electron:
[
25.3.0,
25.2.0,
25.1.0,
25.0.0,
24.6.0,
24.5.0,
24.4.0,
24.3.0,
24.2.0,
24.1.0,
24.0.0,
23.3.0,
23.2.0,
23.1.0,
23.0.0,
22.3.0,
22.2.0,
22.1.0,
22.0.0,
21.4.0,
21.3.0,
21.2.0,
21.1.0,
21.0.0,
20.3.3,
20.2.0,
20.1.0,
20.0.3,
19.1.0,
19.0.0,
18.3.0,
18.2.0,
18.1.0,
18.0.0,
17.4.0,
17.3.0,
17.2.0,
17.1.0,
17.0.0,
16.0.1,
15.3.0,
15.2.0,
15.1.2,
15.0.0,
]
include:
- electron_mocha_version: ^11
python_version: "3.10"
- architecture: arm64
architecture_node: x64
target_architecture: arm64
extra_compile_flags: -arch arm64
- architecture: ia32
architecture_node: x86
target_architecture: ia32
- architecture: x64
architecture_node: x64
target_architecture: x64
- architecture: x64
node: 16.13.2
- electron: 25.3.0
node: 18.15.0
- electron: 25.2.0
node: 18.15.0
- electron: 25.1.0
node: 18.15.0
- electron: 25.0.0
node: 18.15.0
- electron: 24.6.0
node: 18.14.0
- electron: 24.5.0
node: 18.14.0
- electron: 24.4.0
node: 18.14.0
- electron: 24.3.0
node: 18.14.0
- electron: 24.2.0
node: 18.14.0
- electron: 24.1.0
node: 18.14.0
- electron: 24.0.0
node: 18.14.0
- electron: 23.3.0
node: 18.12.1
- electron: 23.2.0
node: 18.12.1
- electron: 23.1.0
node: 18.12.1
- electron: 23.0.0
node: 18.12.1
- electron: 22.3.0
node: 16.17.1
- electron: 22.2.0
node: 16.17.1
- electron: 22.1.0
node: 16.17.1
- electron: 22.0.0
node: 16.17.1
- electron: 21.4.0
node: 16.16.0
- electron: 21.3.0
node: 16.16.0
- electron: 21.2.0
node: 16.16.0
- electron: 21.1.0
node: 16.16.0
- electron: 21.0.0
node: 16.16.0
- electron: 20.3.3
node: 16.15.0
- electron: 20.2.0
node: 16.15.0
- electron: 20.1.0
node: 16.15.0
- electron: 20.0.3
node: 16.15.0
- electron: 19.1.0
node: 16.14.2
- electron: 19.0.0
node: 16.14.2
- electron: 18.3.0
node: 16.13.2
- electron: 18.2.0
node: 16.13.2
- electron: 18.1.0
node: 16.13.2
- electron: 18.0.0
node: 16.13.2
- electron: 17.4.0
node: 16.13.0
- electron: 17.3.0
node: 16.13.0
- electron: 17.2.0
node: 16.13.0
- electron: 17.1.0
node: 16.13.0
- electron: 17.0.0
node: 16.13.0
- electron: 16.0.1
node: 16.9.1
- electron: 15.3.0
node: 16.5.0
- electron: 15.2.0
node: 16.5.0
- electron: 15.1.2
node: 16.5.0
- electron: 15.0.0
node: 16.5.0
exclude:
- os: macos-11
architecture: ia32
- os: ubuntu-20.04
architecture: arm64
- os: windows-2019
architecture: arm64
- os: ubuntu-20.04
architecture: ia32
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.architecture_node }}
- run: node --version
- run: npm --version
- run: npm install --build-from-source
env:
npm_config_arch: ${{ matrix.architecture }}
npm_config_msbuild_path: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe'
npm_config_target_arch: ${{ matrix.target_architecture }}
npm_config_target: ${{ matrix.electron }}
npm_config_disturl: https://artifacts.electronjs.org/headers/dist
npm_config_runtime: electron
npm_config_python: python${{ matrix.python_version }}
CFLAGS: ${{ matrix.extra_compile_flags }}
CPPFLAGS: ${{ matrix.extra_compile_flags }}
- uses: Wandalen/[email protected]
with:
command: npm install -g electron@${{ matrix.electron }} electron-mocha@${{ matrix.electron_mocha_version }}
attempt_limit: 3
attempt_delay: 10000
- name: Run test
uses: GabrielBB/xvfb-action@v1
with:
working-directory: ./ #optional
run: npm run test:electron
if: ${{ matrix.target_architecture != 'arm64' }}
- run: ./node_modules/.bin/node-pre-gyp package testpackage
env:
npm_config_runtime: electron
npm_config_target: ${{ matrix.electron }}
if: ${{ matrix.target_architecture != 'arm64' }}
- run: ./node_modules/.bin/node-pre-gyp package --target_arch=${{ matrix.target_architecture }}
if: ${{ matrix.target_architecture == 'arm64' }}
env:
npm_config_runtime: electron
npm_config_target: ${{ matrix.electron }}
- uses: actions/upload-artifact@v3
with:
path: build/stage/julianhille/MuhammaraJS/releases/download/**/*.gz
name: bindings
if-no-files-found: error
build-node:
needs: [lint]
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-11, windows-2019]
node: [15.7.0, 16.11.1, 17.6.0, 18.8.0, 19.0.0, 20.0.0]
architecture: [x64, ia32, arm64]
include:
- python_version: "3.10"
- node: 15.7.0
python_version: "3.6"
- node: 15.7.0
python_version: "2"
os: macos-11
- node: 16.11.1
python_version: "3.6"
- architecture: ia32
architecture_node: x86
target_architecture: ia32
- architecture: x64
architecture_node: x64
target_architecture: x64
- architecture: arm64
architecture_node: x64
target_architecture: arm64
extra_compile_flags: -arch arm64
EXTRA_NODE_PRE_GYP_FLAGS: --target_arch=arm64
exclude:
- os: ubuntu-20.04
architecture: arm64
- os: windows-2019
architecture: arm64
- os: macos-11
architecture: ia32
- os: ubuntu-20.04
architecture: ia32
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.architecture_node }}
- run: node --version
- run: npm --version
- run: npm install --build-from-source
env:
npm_config_arch: ${{ matrix.architecture }}
npm_config_target_arch: ${{ matrix.target_architecture }}
npm_config_python: python${{ matrix.python_version }}
npm_config_msbuild_path: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe'
CFLAGS: ${{ matrix.extra_compile_flags }}
CPPFLAGS: ${{ matrix.extra_compile_flags }}
- run: ./node_modules/.bin/node-pre-gyp package testpackage
if: ${{ matrix.target_architecture != 'arm64' }}
- run: ./node_modules/.bin/node-pre-gyp package --target_arch=${{ matrix.target_architecture }}
if: ${{ matrix.target_architecture == 'arm64' }}
- uses: actions/upload-artifact@v3
with:
path: build/stage/julianhille/MuhammaraJS/releases/download/**/*.gz
name: bindings
if-no-files-found: error
publish:
needs: [build-musl, build-musl-arm, build-electron, build-node]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 10
- uses: actions/download-artifact@v3
with:
name: bindings
path: builds/bindings
id: upload-release-asset
- run: ls -lah builds/bindings/
- name: Parse semver string
id: semver_parser
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: ${{ github.ref }}
version_extractor_regex: 'tags\/(.*)$'
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.semver_parser.outputs.fullversion }}
release_name: ${{ steps.semver_parser.outputs.fullversion }}
draft: false
prerelease: steps.semver_parser.outputs.prerelease != []
- uses: AButler/[email protected]
with:
files: "builds/bindings/**/*"
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ steps.semver_parser.outputs.fullversion }}
- run: npm install
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}