@@ -14,27 +14,10 @@ jobs:
14
14
submodules : recursive
15
15
fetch-depth : 0
16
16
17
- - name : Check if container files was modified and if container version already exists
18
- id : checks
19
- run : |
20
- echo modified=$(./.ci/check-container-sources-modified) >> "$GITHUB_OUTPUT"
21
- echo container-published=$(./.ci/check-container-version-published) >> "$GITHUB_OUTPUT"
22
-
23
- - name : Build container image
24
- if : steps.checks.outputs.modified == 'true'
25
- run : |
26
- if "${{ steps.checks.outputs.container-published }}" == "true"; then
27
- echo "::error::Container modified but version $(cat .containerversion) already published"
28
- exit 1
29
- fi
30
- ./.ci/build-container
31
-
32
- - name : Pull container image
33
- if : steps.checks.outputs.modified == 'false'
34
- run : ./.ci/pull-container
35
-
36
- - name : Run CI in container
37
- run : ./.ci/run-container-ci ${{github.workspace}} ${{ github.event.pull_request.base.sha }}
17
+ - name : CI
18
+ uses : ./.github/actions/pr-ci-common
19
+ with :
20
+ base-sha : ${{ github.event.pull_request.base.sha }}
38
21
39
22
# Generate a list of commits to run CI on
40
23
generate-matrix :
54
37
echo matrix=$(.ci/matrix-from-commit-log ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}~) >> $GITHUB_OUTPUT
55
38
56
39
# Run this job for every commit in the PR except HEAD.
40
+ # This job simulates what github does for the PR HEAD commit but for every other commit in the
41
+ # PR. So for every commit, it creates a merge commit between that commit and the base branch.
42
+ # Then it runs the CI on that merge commit.
43
+ # The only caveat is that this file (pr-ci.yml) is already loaded from the PR HEAD merge commit,
44
+ # and therefore we need to load the `.ci` scripts from the PR HEAD merge commit. The outcome of
45
+ # that is that changes to the CI is not tested per commit. All commits use the final version.
57
46
pr-commit-ci :
58
47
runs-on : ubuntu-22.04
59
48
needs : [ generate-matrix ]
82
71
# get the .ci scripts from there as well.
83
72
git checkout -f ${{ github.event.pull_request.merge_commit_sha }} -- .ci .github
84
73
85
- - name : Check if container files was modified and if container version already exists
86
- id : checks
87
- run : |
88
- echo modified=$(./.ci/check-container-sources-modified) >> "$GITHUB_OUTPUT"
89
- echo container-published=$(./.ci/check-container-version-published) >> "$GITHUB_OUTPUT"
90
-
91
- - name : Build container image
92
- if : steps.checks.outputs.modified == 'true'
93
- run : |
94
- if "${{ steps.checks.outputs.container-published }}" == "true"; then
95
- echo "::error::Container modified but version $(cat .containerversion) already published"
96
- exit 1
97
- fi
98
- ./.ci/build-container
99
-
100
- - name : Pull container image
101
- if : steps.checks.outputs.modified == 'false'
102
- run : ./.ci/pull-container
103
-
104
- - name : Run CI in container
105
- run : ./.ci/run-container-ci ${{github.workspace}} ${{ github.event.pull_request.base.sha }}
74
+ - name : CI
75
+ uses : ./.github/actions/pr-ci-common
76
+ with :
77
+ base-sha : ${{ github.event.pull_request.base.sha }}
0 commit comments