betaflight-configurator/.github/workflows/ci.yml

92 lines
2.3 KiB
YAML

# Builds Betaflight Configurator on Windows, Android, Linux and macOS platforms.
#
# After building, artifacts are released to a seperate repository.
name: CI
on:
workflow_call:
inputs:
debug_build:
description: 'Specifies if it is a debug build or a release build'
default: true
required: false
type: boolean
jobs:
test:
name: Test
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version-file: '.nvmrc'
cache: yarn
- run: yarn install --immutable --immutable-cache --check-cache
- name: Run unit tests
run: yarn test
build:
name: Build (${{ matrix.name }})
needs: test
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: Android
os: ubuntu-22.04
releaseArgs: --android
- name: Linux
os: ubuntu-22.04
releaseArgs: --linux64
- name: macOS
os: macos-11
releaseArgs: --osx64
- name: Windows
os: windows-2022
releaseArgs: --win64
steps:
- uses: actions/checkout@v2
- name: Cache NW.js
uses: actions/cache@v2
with:
path: cache/
key: ${{ runner.os }}-${{ hashFiles('gulpfile.js') }}
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version-file: '.nvmrc'
cache: yarn
- name: Install Java JDK 8
uses: actions/setup-java@v2
if: ${{ matrix.name == 'Android' }}
with:
distribution: temurin
java-version: '8'
- run: yarn install --immutable --immutable-cache --check-cache
- run: yarn gulp release ${{ matrix.releaseArgs }}
if: ${{ !inputs.debug_build && matrix.name != 'Android' }}
- run: yarn gulp debug-release ${{ matrix.releaseArgs }}
if: ${{ inputs.debug_build || matrix.name == 'Android' }}
- name: Publish build artifacts
uses: actions/upload-artifact@v2
with:
name: Betaflight-Configurator${{ inputs.debug_build == 'true' && '-Debug' || '' }}-${{ matrix.name }}
path: release/
retention-days: 90