build: Skip example app tests when required (#902) #1762
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Build & Test' | |
on: | |
push: | |
branches: | |
- master | |
- release/** | |
pull_request: | |
env: | |
ELECTRON_CACHE_DIR: ${{ github.workspace }} | |
FAILURE_LOG: true | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: 'package.json' | |
- name: Install | |
run: yarn install | |
- name: Build | |
run: yarn build | |
- name: Pack | |
run: yarn pack | |
- name: Archive Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ github.sha }} | |
path: | | |
${{ github.workspace }}/*.tgz | |
- id: set-matrix | |
run: echo "matrix=$(node ./scripts/e2e-test-versions.js)" >> "$GITHUB_OUTPUT" | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: 'package.json' | |
- run: yarn install | |
- name: Run Linter | |
run: yarn lint | |
test: | |
name: Unit Tests | |
needs: build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
# we want that the matrix keeps running, default is to cancel all if one fails. | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: 'package.json' | |
- run: yarn install | |
- name: Run Unit Tests | |
timeout-minutes: 10 | |
run: yarn test | |
e2e: | |
name: E2E Tests | |
needs: build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
electron: ${{ fromJson(needs.build.outputs.matrix) }} | |
env: | |
ELECTRON_VERSION: ${{ matrix.electron }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: 'package.json' | |
- run: yarn install | |
- name: Run E2E Tests | |
timeout-minutes: 30 | |
run: yarn e2e | |
required_jobs_passed: | |
name: All required jobs passed or were skipped | |
needs: [build, lint, test, e2e] | |
# Always run this, even if a dependent job failed | |
if: always() | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check for failures | |
if: contains(needs.*.result, 'failure') | |
run: | | |
echo "One of the dependent jobs have failed. You may need to re-run it." && exit 1 |