Files
directus/.github/workflows/ci.yml
2021-11-03 11:10:00 -04:00

70 lines
2.3 KiB
YAML

# ### Continuous Integration
#
# Entrypoint for all CI related workflows
#
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
# Check whether workflow is skippable
pre_check:
name: Pre-Check
runs-on: ubuntu-latest
outputs:
# Returns 'true' if workflow is skippable for one of the following reasons:
# - Exact same files have been successfully checked in older workflow run
# - Only files that do not require checks (paths_ignore) have been changed and
# workflow run on previous commit has been successful (backtracking)
should_skip: ${{ steps.skip_check.outputs.should_skip }}
skipped_by: ${{ steps.skip_check.outputs.skipped_by }}
steps:
- name: Check whether workflow is skippable
id: skip_check
uses: fkirc/skip-duplicate-actions@master
# Run all the jobs if the pre-check should fail for any reason
# (setting this on step-level makes sure the pre-check will still be marked as 'passed',
# better solution pending at https://github.com/actions/toolkit/issues/399)
continue-on-error: true
with:
# Cancel outdated workflow runs
cancel_others: 'true'
# Ignore changes in the following files
paths_ignore: '["app/src/lang/translations/*.yaml"]'
lint:
name: Lint
needs: pre_check
uses: directus/directus/.github/workflows/lint.yml@main
with:
should_skip: ${{ needs.pre_check.outputs.should_skip }}
codeql_analysis:
name: CodeQL Analysis
needs: pre_check
uses: directus/directus/.github/workflows/codeql-analysis.yml@main
with:
should_skip: ${{ needs.pre_check.outputs.should_skip }}
unit_tests:
name: Unit Tests
needs: pre_check
uses: directus/directus/.github/workflows/unit-tests.yml@main
with:
should_skip: ${{ needs.pre_check.outputs.should_skip }}
# For now, run end-to-end tests only on push events on 'main' branch
# (therefore not skippable by successful workflow run which hasn't been triggered by a 'push' event)
e2e_tests:
name: End-to-End Tests
needs: pre_check
uses: directus/directus/.github/workflows/e2e-tests.yml@main
with:
should_skip: ${{ github.event_name != 'push' || (needs.pre_check.outputs.skipped_by && fromJSON(needs.pre_check.outputs.skipped_by).event == 'push') }}