2022-01-03 22:30:24 +00:00
|
|
|
# Builds Betaflight Configurator on Windows, Android, Linux and macOS platforms.
|
|
|
|
#
|
|
|
|
# After building, artifacts are released to a seperate repository.
|
|
|
|
|
|
|
|
name: CI
|
|
|
|
|
2022-02-17 10:17:00 +00:00
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
debug_build:
|
|
|
|
description: 'Specifies if it is a debug build or a release build'
|
|
|
|
default: true
|
|
|
|
required: false
|
|
|
|
type: boolean
|
2022-01-03 22:30:24 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
name: Test
|
2022-05-19 19:43:02 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2022-01-03 22:30:24 +00:00
|
|
|
steps:
|
2022-10-05 06:30:17 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-01-03 22:30:24 +00:00
|
|
|
|
2022-10-05 06:33:11 +00:00
|
|
|
- name: Cache node_modules
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: node_modules/
|
2022-12-08 21:01:57 +00:00
|
|
|
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
|
2022-10-05 06:33:11 +00:00
|
|
|
|
2022-01-03 22:30:24 +00:00
|
|
|
- name: Install Node.js
|
2022-10-05 06:30:17 +00:00
|
|
|
uses: actions/setup-node@v3
|
2022-01-03 22:30:24 +00:00
|
|
|
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
|
2022-05-19 19:43:02 +00:00
|
|
|
os: ubuntu-22.04
|
2022-01-03 22:30:24 +00:00
|
|
|
releaseArgs: --android
|
|
|
|
|
|
|
|
- name: Linux
|
2022-05-19 19:43:02 +00:00
|
|
|
os: ubuntu-22.04
|
2022-01-03 22:30:24 +00:00
|
|
|
releaseArgs: --linux64
|
|
|
|
|
|
|
|
- name: macOS
|
|
|
|
os: macos-11
|
|
|
|
releaseArgs: --osx64
|
|
|
|
|
|
|
|
- name: Windows
|
|
|
|
os: windows-2022
|
|
|
|
releaseArgs: --win64
|
|
|
|
steps:
|
2022-10-05 06:30:17 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-01-03 22:30:24 +00:00
|
|
|
|
|
|
|
- name: Cache NW.js
|
2022-10-05 06:30:17 +00:00
|
|
|
uses: actions/cache@v3
|
2022-01-03 22:30:24 +00:00
|
|
|
with:
|
|
|
|
path: cache/
|
2022-12-08 21:01:57 +00:00
|
|
|
key: nwjs-${{ inputs.debug_build && 'debug' || 'release' }}-${{ runner.os }}-${{ hashFiles('gulpfile.js') }}
|
2022-01-03 22:30:24 +00:00
|
|
|
|
2022-10-05 06:33:11 +00:00
|
|
|
- name: Cache node_modules
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: node_modules/
|
2022-12-08 21:01:57 +00:00
|
|
|
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
|
2022-10-05 06:33:11 +00:00
|
|
|
|
2022-01-03 22:30:24 +00:00
|
|
|
- name: Install Node.js
|
2022-10-05 06:30:17 +00:00
|
|
|
uses: actions/setup-node@v3
|
2022-01-03 22:30:24 +00:00
|
|
|
with:
|
|
|
|
node-version-file: '.nvmrc'
|
|
|
|
|
|
|
|
- name: Install Java JDK 8
|
2022-10-13 14:18:31 +00:00
|
|
|
uses: actions/setup-java@v3
|
2022-01-03 22:30:24 +00:00
|
|
|
if: ${{ matrix.name == 'Android' }}
|
|
|
|
with:
|
|
|
|
distribution: temurin
|
|
|
|
java-version: '8'
|
|
|
|
|
|
|
|
- run: yarn install --immutable --immutable-cache --check-cache
|
|
|
|
|
2022-12-21 16:37:00 +00:00
|
|
|
- run: yarn version --no-git-tag-version --new-version ${{ github.ref_name }}
|
|
|
|
if: ${{ !inputs.debug_build }}
|
|
|
|
|
2022-01-03 22:30:24 +00:00
|
|
|
- run: yarn gulp release ${{ matrix.releaseArgs }}
|
2022-02-17 10:17:00 +00:00
|
|
|
if: ${{ !inputs.debug_build && matrix.name != 'Android' }}
|
2022-01-03 22:30:24 +00:00
|
|
|
|
|
|
|
- run: yarn gulp debug-release ${{ matrix.releaseArgs }}
|
2023-01-05 00:19:09 +00:00
|
|
|
if: ${{ inputs.debug_build || matrix.name == 'Android' }}
|
2022-12-21 05:04:19 +00:00
|
|
|
|
2022-01-03 22:30:24 +00:00
|
|
|
- name: Publish build artifacts
|
2022-10-05 06:30:17 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-01-03 22:30:24 +00:00
|
|
|
with:
|
2022-02-17 10:17:00 +00:00
|
|
|
name: Betaflight-Configurator${{ inputs.debug_build == 'true' && '-Debug' || '' }}-${{ matrix.name }}
|
2022-01-03 22:30:24 +00:00
|
|
|
path: release/
|
2022-02-14 08:34:51 +00:00
|
|
|
retention-days: 90
|