diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..4566bc67 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,103 @@ +# Builds Betaflight Configurator on Windows, Android, Linux and macOS platforms. +# +# After building, artifacts are released to a seperate repository. + +env: + debugBuild: true + +name: CI + +on: + push: + branches: + - master + - '*-maintenance' + pull_request: + branches: + - master + - '*-maintenance' + +jobs: + test: + name: Test + runs-on: ubuntu-20.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 + + - name: Publish Unit Test Results + uses: EnricoMi/publish-unit-test-result-action@043296c976c53f4536194ebe3841ed720e04d496 # v1.26 + if: always() + with: + files: test-results-junit/**/*.xml + comment_mode: 'off' + + build: + name: Build (${{ matrix.name }}) + needs: test + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - name: Android + os: ubuntu-20.04 + releaseArgs: --android + + - name: Linux + os: ubuntu-20.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: ${{ !env.debugBuild }} + + - run: yarn gulp debug-release ${{ matrix.releaseArgs }} + if: ${{ env.debugBuild }} + + - name: Publish build artifacts + uses: actions/upload-artifact@v2 + with: + name: Betaflight-Configurator${{ env.debugBuild == 'true' && '-Debug' || '' }}-${{ matrix.name }} + path: release/ + retention-days: 10 diff --git a/test/karma.conf.js b/test/karma.conf.js index f937d992..3185a744 100644 --- a/test/karma.conf.js +++ b/test/karma.conf.js @@ -35,7 +35,7 @@ module.exports = function(config) { outputFile: 'test_results.xml', }, junitReporter: { - outputDir: 'test-results-junit' + outputDir: 'test-results-junit', }, singleRun: true, preprocessors: {