|
| 1 | +# Builds Betaflight Configurator on Windows, Android, Linux and macOS platforms. |
| 2 | +# |
| 3 | +# After building, artifacts are released to a seperate repository. |
| 4 | + |
| 5 | +env: |
| 6 | + debugBuild: true |
| 7 | + |
| 8 | +name: CI |
| 9 | + |
| 10 | +on: |
| 11 | + push: |
| 12 | + branches: |
| 13 | + - master |
| 14 | + - '*-maintenance' |
| 15 | + pull_request: |
| 16 | + branches: |
| 17 | + - master |
| 18 | + - '*-maintenance' |
| 19 | + |
| 20 | +jobs: |
| 21 | + test: |
| 22 | + name: Test |
| 23 | + runs-on: ubuntu-20.04 |
| 24 | + |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v2 |
| 27 | + |
| 28 | + - name: Install Node.js |
| 29 | + uses: actions/setup-node@v2 |
| 30 | + with: |
| 31 | + node-version-file: '.nvmrc' |
| 32 | + cache: yarn |
| 33 | + |
| 34 | + - run: yarn install --immutable --immutable-cache --check-cache |
| 35 | + |
| 36 | + - name: Run unit tests |
| 37 | + run: yarn test |
| 38 | + |
| 39 | + - name: Publish Unit Test Results |
| 40 | + uses: EnricoMi/publish-unit-test-result-action@043296c976c53f4536194ebe3841ed720e04d496 # v1.26 |
| 41 | + if: always() |
| 42 | + with: |
| 43 | + files: test-results-junit/**/*.xml |
| 44 | + comment_mode: 'off' |
| 45 | + |
| 46 | + build: |
| 47 | + name: Build (${{ matrix.name }}) |
| 48 | + needs: test |
| 49 | + runs-on: ${{ matrix.os }} |
| 50 | + strategy: |
| 51 | + matrix: |
| 52 | + include: |
| 53 | + - name: Android |
| 54 | + os: ubuntu-20.04 |
| 55 | + releaseArgs: --android |
| 56 | + |
| 57 | + - name: Linux |
| 58 | + os: ubuntu-20.04 |
| 59 | + releaseArgs: --linux64 |
| 60 | + |
| 61 | + - name: macOS |
| 62 | + os: macos-11 |
| 63 | + releaseArgs: --osx64 |
| 64 | + |
| 65 | + - name: Windows |
| 66 | + os: windows-2022 |
| 67 | + releaseArgs: --win64 |
| 68 | + steps: |
| 69 | + - uses: actions/checkout@v2 |
| 70 | + |
| 71 | + - name: Cache NW.js |
| 72 | + uses: actions/cache@v2 |
| 73 | + with: |
| 74 | + path: cache/ |
| 75 | + key: ${{ runner.os }}-${{ hashFiles('gulpfile.js') }} |
| 76 | + |
| 77 | + - name: Install Node.js |
| 78 | + uses: actions/setup-node@v2 |
| 79 | + with: |
| 80 | + node-version-file: '.nvmrc' |
| 81 | + cache: yarn |
| 82 | + |
| 83 | + - name: Install Java JDK 8 |
| 84 | + uses: actions/setup-java@v2 |
| 85 | + if: ${{ matrix.name == 'Android' }} |
| 86 | + with: |
| 87 | + distribution: temurin |
| 88 | + java-version: '8' |
| 89 | + |
| 90 | + - run: yarn install --immutable --immutable-cache --check-cache |
| 91 | + |
| 92 | + - run: yarn gulp release ${{ matrix.releaseArgs }} |
| 93 | + if: ${{ !env.debugBuild }} |
| 94 | + |
| 95 | + - run: yarn gulp debug-release ${{ matrix.releaseArgs }} |
| 96 | + if: ${{ env.debugBuild }} |
| 97 | + |
| 98 | + - name: Publish build artifacts |
| 99 | + uses: actions/upload-artifact@v2 |
| 100 | + with: |
| 101 | + name: Betaflight-Configurator${{ env.debugBuild == 'true' && '-Debug' || '' }}-${{ matrix.name }} |
| 102 | + path: release/ |
| 103 | + retention-days: 10 |
0 commit comments