-
Notifications
You must be signed in to change notification settings - Fork 33
105 lines (96 loc) · 3.27 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: CI
on:
pull_request:
types: [opened, synchronize, reopened]
branches: [develop]
# on:
# workflow_run:
# workflows: [Pre-commit]
# types: [completed]
# Declare default permissions as write only.
permissions: read-all
# If another push to the same PR or branch happens while this workflow is still running,
# cancel the earlier run in favor of the next run.
#
# There's no point in testing an outdated version of the code. GitHub only allows
# a limited number of job runners to be active at the same time, so it's better to cancel
# pointless jobs early so that more useful jobs can run sooner.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
precommit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
with:
submodules: false
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: pre-commit/action@v3.0.1
- uses: pre-commit-ci/lite-action@v1.1.0
if: always()
pre-success:
needs: precommit
runs-on: ubuntu-latest
if: ${{ needs.precommit.result == 'success' }}
# ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- run: echo 'Pre-commit completed successfully.'
pre-failure:
runs-on: ubuntu-latest
if: ${{ needs.precommit.result == 'failure' }}
# if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo 'Pre-commit failed. Please fix issues.'
pre-exit:
needs: pre-failure
runs-on: ubuntu-latest
steps:
- run: exit 1
Get-Envs:
name: Get Environment vars
runs-on: ubuntu-latest
outputs:
CHECKIN_DOCKERFILE: .github/scripts/docker-compose.yml
CONTAINER_NAME: source_coverage_${{ github.event.pull_request.number }}
SOURCE_REF: ${{ github.event.pull_request.head.sha }}
TARGET_REF: ${{ github.event.pull_request.base.ref }}
steps:
- run: echo "null"
Testing:
# name: Code coverage in Docker
needs: [Get-Envs]
uses: ./.github/workflows/_CI_coverage.yml
with:
container-name: ${{ needs.Get-Envs.outputs.CONTAINER_NAME }}
docker-compose-path: ${{ needs.Get-Envs.outputs.CHECKIN_DOCKERFILE }}
source-ref: ${{ needs.Get-Envs.outputs.SOURCE_REF}}
target-ref: ${{ needs.Get-Envs.outputs.TARGET_REF}}
secrets: inherit
Results:
permissions:
contents: write
issues: write
pull-requests: write
# name: Compare code coverage
needs: [Testing]
uses: ./.github/workflows/_CI_coverage_compare.yml
with:
target_cpp_coverage: ${{ needs.Testing.outputs.target_cpp_coverage }}
target_py_coverage: ${{ needs.Testing.outputs.target_py_coverage }}
source_cpp_coverage: ${{ needs.Testing.outputs.source_cpp_coverage }}
source_py_coverage: ${{ needs.Testing.outputs.source_py_coverage }}
secrets: inherit
Update:
permissions:
contents: write
# name: Lint & Update Reports
needs: [Testing, Results]
if: ${{ always() }}
uses: ./.github/workflows/_CI_update.yml
with:
coverage_value_updated: ${{ needs.Testing.outputs.coverage_value_updated }}
coverage_test_status: ${{ needs.Testing.outputs.coverage_test_status }}
secrets: inherit