forked from betaflight/betaflight-configurator
-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (90 loc) · 3.02 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Builds Betaflight Configurator on Windows, Android, Linux and macOS platforms.
#
# After building, artifacts are released to a separate 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@v4
- name: Cache node_modules
uses: actions/cache@v4
with:
path: node_modules/
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- name: Install Node.js
uses: actions/setup-node@v4
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@v4
- name: Cache NW.js
uses: actions/cache@v4
with:
path: cache/
key: nwjs-${{ inputs.debug_build && 'debug' || 'release' }}-${{ runner.os }}-${{ hashFiles('gulpfile.js') }}
- name: Cache node_modules
uses: actions/cache@v4
with:
path: node_modules/
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install macos dependencies
run: |
sudo -H pip install setuptools packaging
sudo npm install -g yarn@1.22.0 node-gyp@10 macos-alias
yarn --network-timeout 1000000
if: ${{ matrix.name == 'macOs' }}
- name: Install Java JDK 8
uses: actions/setup-java@v4
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@v4
with:
name: Betaflight-Configurator${{ inputs.debug_build == 'true' && '-Debug' || '' }}-${{ matrix.name }}
path: release/
retention-days: 90