A reusable workflow for running e2e tests (#144) #508
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: CI | |
env: | |
MIRRORD_TELEMETRY: false | |
on: | |
workflow_dispatch: | |
push: | |
branches-ignore: [ staging-squash-merge.tmp ] | |
pull_request: | |
branches: [ main, staging, trying ] | |
types: [ opened, synchronize, reopened, ready_for_review ] | |
# Cancel previous runs on the same PR. | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
towncrier_check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: install towncrier | |
run: pip install towncrier | |
- name: verify newsfragment exist | |
run: towncrier check | |
lint_markdown: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: avto-dev/markdown-lint@v1 | |
with: | |
config: "markdownlint-config.json" | |
args: "README.md" | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: zulu | |
java-version: 17 | |
- name: Run ktlint | |
run: ./gradlew ktlintCheck | |
e2e: | |
uses: ./.github/workflows/reusable_e2e.yaml | |
ci-success: | |
name: ci | |
# We want this to run even if some of the required jobs got skipped | |
if: always() | |
needs: | |
[ | |
towncrier_check, | |
e2e, | |
lint_markdown, | |
] | |
runs-on: ubuntu-latest | |
steps: | |
- name: CI succeeded | |
# We have to do it in the shell since if it's in the if condition | |
# then skipping is considered success by branch protection rules | |
env: | |
CI_SUCCESS: ${{ (needs.towncrier_check.result == 'success') && | |
(needs.e2e.result == 'success' || needs.e2e.result == 'skipped') && | |
(needs.lint_markdown.result == 'success' || needs.lint_markdown.result == 'skipped') }} | |
run: echo $CI_SUCCESS && if [ "$CI_SUCCESS" == "true" ]; then echo "SUCCESS" && exit 0; else echo "Failure" && exit 1; fi |