105 lines
2.8 KiB
YAML
105 lines
2.8 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@v3
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: node_modules/
|
|
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
|
|
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
|
|
- 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@v3
|
|
|
|
- name: Cache NW.js
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: cache/
|
|
key: nwjs-${{ inputs.debug_build && 'debug' || 'release' }}-${{ runner.os }}-${{ hashFiles('gulpfile.js') }}
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: node_modules/
|
|
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
|
|
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
|
|
- name: Install Java JDK 8
|
|
uses: actions/setup-java@v3
|
|
if: ${{ matrix.name == 'Android' }}
|
|
with:
|
|
distribution: temurin
|
|
java-version: '8'
|
|
|
|
- run: yarn install --immutable --immutable-cache --check-cache
|
|
|
|
- run: yarn version --no-git-tag-version --new-version ${{ github.ref_name }}
|
|
if: ${{ !inputs.debug_build }}
|
|
|
|
- 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@v3
|
|
with:
|
|
name: Betaflight-Configurator${{ inputs.debug_build == 'true' && '-Debug' || '' }}-${{ matrix.name }}
|
|
path: release/
|
|
retention-days: 90
|