Skip to content

Employed labels for dispatching. #273

Employed labels for dispatching.

Employed labels for dispatching. #273

Workflow file for this run

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, labeled]
defaults:
run:
shell: bash --noprofile --norc -x -euo pipefail {0}
jobs:
paths-filter:
name: 'Paths Filter'
uses: ./.github/workflows/paths-filter.yml
labels-filter:
name: 'Labels Filter'
runs-on: ubuntu-latest
outputs:
should-test: ${{ steps.filter.outputs.should-test }}
should-build: ${{ steps.filter.outputs.should-build }}
steps:
- name: 'Filter labels'
id: filter
if: ${{ github.event_name == 'pull_request' && github.event.action == 'labeled' }}
run: |
if [[ "${{ github.event.label.name }}" =~ 'ci: test' ]]; then
echo "should-test=true" >> $GITHUB_OUTPUT
fi
if [[ "${{ github.event.label.name }}" =~ 'ci: build' ]]; then
echo "should-build=true" >> $GITHUB_OUTPUT
fi
tests:
name: 'Tests'
needs: [paths-filter, labels-filter]
if: ${{ !inputs.skip-tests && github.event.pull_request.draft != true && needs.paths-filter.outputs.should-test != 'false' && needs.labels-filter.outputs.should-test == 'true' }}
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, labels-filter]
if: ${{ !inputs.skip-build-app && github.event.pull_request.draft != true && needs.paths-filter.outputs.should-build != 'false' && needs.labels-filter.outputs.should-build == 'true' }}
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.'