Skip to content

Build

Build #751

Workflow file for this run

name: Build
on:
push:
tags:
- "1.*"
- "2.*"
- "3.*"
- "4.*"
pull_request:
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-22.04
env:
node_version: 18.8.0
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.node_version }}
- run: npm install prettier
- run: npm run test:codestyle
build-electron:
needs: [lint]
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
architecture: [x64]
electron: [32.0.0, 31.0.0]
python_version: ["3.10"]
electron_mocha_version: ["^11"]
include:
- architecture: x64
architecture_node: x64
target_architecture: x64
- electron: 32.0.0
node: 20.16.0
- electron: 31.0.0
node: 20.16.0
runs-on: ${{ matrix.os }}
steps:
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
version: 13
platform: ${{matrix.architecture}}
if: ${{ matrix.os == 'ubuntu-20.04' }}
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.architecture_node }}
- run: node --version
- run: npm --version
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
- uses: actions/cache@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-electron-${{ matrix.target_architecture }}-${{ matrix.architecture }}-${{ matrix.electron }}-${{ hashFiles('**/package-lock.json') }}
- 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/wretry.action@v3
with:
command: npm install -g electron@${{ matrix.electron }} electron-mocha@${{ matrix.electron_mocha_version }}
attempt_limit: 3
attempt_delay: 10000
- name: Run test
uses: coactions/setup-xvfb@90473c3ebc69533a1a6e0505c36511b69c8c3135
with:
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@v4
with:
path: build/stage/julianhille/MuhammaraJS/releases/download/**/*.gz
name: bindings-electron-${{ matrix.os }}-${{ matrix.target_architecture }}-${{matrix.electron}}
if-no-files-found: error
build-electron-outdated:
needs: [lint]
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
architecture: [x644]
electron: [28.0.0]
include:
- electron_mocha_version: ^11
python_version: "3.10"
- architecture: x64
architecture_node: x64
target_architecture: x64
- electron: 28.0.0
node: 18.18.2
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
version: 13
platform: ${{matrix.architecture}}
if: ${{ matrix.os == 'ubuntu-20.04' }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.architecture_node }}
- run: node --version
- run: npm --version
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
- uses: actions/cache@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-electron-${{ matrix.target_architecture }}-${{ matrix.architecture }}-${{ matrix.electron }}-${{ hashFiles('**/package-lock.json') }}
- 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/wretry.action@v3
with:
command: npm install -g electron@${{ matrix.electron }} electron-mocha@${{ matrix.electron_mocha_version }}
attempt_limit: 3
attempt_delay: 10000
- name: Run test
uses: coactions/setup-xvfb@90473c3ebc69533a1a6e0505c36511b69c8c3135
with:
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@v4
with:
path: build/stage/julianhille/MuhammaraJS/releases/download/**/*.gz
name: bindings-electron-${{ matrix.os }}-${{ matrix.target_architecture }}-${{matrix.electron}}
if-no-files-found: error