main #350
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: main | |
on: | |
workflow_dispatch: | |
inputs: | |
skip-tests: | |
description: Skip tests | |
required: false | |
default: false | |
type: boolean | |
skip-build-app: | |
description: Skip build-app | |
required: false | |
default: false | |
type: boolean | |
push: | |
branches: [main] | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
jobs: | |
paths-filter: | |
name: 'Paths Filter' | |
uses: ./.github/workflows/paths-filter.yml | |
tests: | |
name: 'Tests' | |
needs: [paths-filter] | |
if: ${{ !inputs.skip-tests && github.event.pull_request.draft != true && needs.paths-filter.outputs.should-test != 'false' }} | |
uses: grigorye/ReusableWorkflows/.github/workflows/tests-generic.yml@v20 | |
secrets: inherit | |
with: | |
runs-on: 'macos-12' | |
unit-tests-scheme: 'TMBuddyTests' | |
snapshot-tests-scheme: 'TMBuddySnapshots' | |
ui-snapshot-tests-scheme: 'TMBuddyUITestSnapshots' | |
build-app: | |
name: 'App' | |
needs: [paths-filter] | |
if: ${{ !inputs.skip-build-app && github.event.pull_request.draft != true && needs.paths-filter.outputs.should-build != 'false' }} | |
uses: grigorye/ReusableWorkflows/.github/workflows/build-app-generic.yml@v20 | |
with: | |
macos-app-scheme: 'TMBuddy' | |
build-configs: '[\"app-store\", \"developer-id\"]' | |
secrets: inherit | |
finalize: | |
name: 'Finalize Run' | |
if: always() | |
needs: [paths-filter, tests, build-app] | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Flag non-succeeding app builds' | |
if: always() && needs.paths-filter.outputs.should-build != 'false' && needs.build-app.result != 'success' | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
core.setFailed('Some app build did not succeed.') | |
- name: 'Flag tests that did not run' | |
if: always() && needs.paths-filter.outputs.should-test != 'false' && needs.tests.result != 'success' | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
core.setFailed('Some tests did not run.') | |
- name: 'Flag tests that did fail' | |
if: always() && needs.paths-filter.outputs.should-test != 'false' && needs.tests.outputs.tests-passed != 'true' | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
core.setFailed('Some tests did fail.') | |
- name: 'Report success for skipped jobs' | |
if: always() && needs.paths-filter.outputs.should-test == 'false' && needs.paths-filter.outputs.should-build == 'false' | |
run: | | |
echo 'No job to do.' |