-
Notifications
You must be signed in to change notification settings - Fork 8
172 lines (147 loc) · 6.22 KB
/
pull-requests.yaml
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#
# Copyright contributors to the Galasa project
#
# SPDX-License-Identifier: EPL-2.0
#
name: Pull Request Build Orchestrator
on:
pull_request:
branches: [main]
jobs:
detect-secrets:
name: Detect secrets
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Turn script into an executable
working-directory: ./tools
run: chmod +x detect-secrets.sh
- name: Run the detect secrets script
working-directory: ./tools
run: ./detect-secrets.sh
# Get modules that were changed as part of this Pull Request,
# set that as an output of this job to be passed to the next job.
get-changed-modules:
name: Get the modules changed in this Pull Request
runs-on: ubuntu-latest
outputs:
platform_changed: ${{ steps.get-changed-modules.outputs.PLATFORM_CHANGED }}
buildutils_changed: ${{ steps.get-changed-modules.outputs.BUILDUTILS_CHANGED }}
wrapping_changed: ${{ steps.get-changed-modules.outputs.WRAPPING_CHANGED }}
gradle_changed: ${{ steps.get-changed-modules.outputs.GRADLE_CHANGED }}
maven_changed: ${{ steps.get-changed-modules.outputs.MAVEN_CHANGED }}
framework_changed: ${{ steps.get-changed-modules.outputs.FRAMEWORK_CHANGED }}
extensions_changed: ${{ steps.get-changed-modules.outputs.EXTENSIONS_CHANGED }}
managers_changed: ${{ steps.get-changed-modules.outputs.MANAGERS_CHANGED }}
obr_changed: ${{ steps.get-changed-modules.outputs.OBR_CHANGED }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
sparse-checkout: |
.github/scripts
- name: Get the modules changed in this Pull Request
id: get-changed-modules
env:
GH_TOKEN: ${{ github.token }}
run: |
./.github/scripts/get-changed-modules-pull-request.sh --github-repo ${{ github.event.pull_request.head.repo.full_name }} --pr-number ${{ github.event.number }}
find-artifacts:
name: Get Workflow Run ID to download artifacts from
runs-on: ubuntu-latest
outputs:
workflow_for_artifact_download_id: ${{ steps.find-artifacts.outputs.workflow_for_artifact_download_id }}
steps:
- name: Get last successful workflow run of the "Main Build Orchestrator" for PR's base ref
id: find-artifacts
env:
GH_TOKEN: ${{ github.token }}
run: |
echo "workflow_for_artifact_download_id=$(gh run list \
--repo ${{ github.repository }} \
--workflow 'Main Build Orchestrator' \
--branch ${{ github.base_ref }} \
--status success \
--limit 1 \
--json databaseId | jq '.[0].databaseId')" >> $GITHUB_OUTPUT
pr-build-platform:
name: Build the 'platform' module
needs: [get-changed-modules, find-artifacts]
uses: ./.github/workflows/pr-platform.yaml
secrets: inherit
with:
changed: ${{ needs.get-changed-modules.outputs.platform_changed }}
pr-build-buildutils:
name: Build the 'buildutils' module
needs: [get-changed-modules, find-artifacts]
uses: ./.github/workflows/pr-buildutils.yaml
secrets: inherit
with:
changed: ${{ needs.get-changed-modules.outputs.buildutils_changed }}
pr-build-wrapping:
name: Build the 'wrapping' module
needs: [get-changed-modules, find-artifacts, pr-build-platform]
uses: ./.github/workflows/pr-wrapping.yaml
secrets: inherit
with:
changed: ${{ needs.get-changed-modules.outputs.wrapping_changed }}
artifact-id: ${{ needs.find-artifacts.outputs.workflow_for_artifact_download_id }}
pr-build-gradle:
name: Build the 'gradle' module
needs: [get-changed-modules, find-artifacts, pr-build-platform]
uses: ./.github/workflows/pr-gradle.yaml
secrets: inherit
with:
changed: ${{ needs.get-changed-modules.outputs.gradle_changed }}
artifact-id: ${{ needs.find-artifacts.outputs.workflow_for_artifact_download_id }}
pr-build-maven:
name: Build the 'maven' module
needs: [get-changed-modules, find-artifacts, pr-build-gradle]
uses: ./.github/workflows/pr-maven.yaml
secrets: inherit
with:
changed: ${{ needs.get-changed-modules.outputs.maven_changed }}
artifact-id: ${{ needs.find-artifacts.outputs.workflow_for_artifact_download_id }}
pr-build-framework:
name: Build the 'framework' module
needs: [get-changed-modules, find-artifacts, pr-build-buildutils, pr-build-wrapping, pr-build-maven]
uses: ./.github/workflows/pr-framework.yaml
secrets: inherit
with:
changed: ${{ needs.get-changed-modules.outputs.framework_changed }}
artifact-id: ${{ needs.find-artifacts.outputs.workflow_for_artifact_download_id }}
pr-build-extensions:
name: Build the 'extensions' module
needs: [get-changed-modules, find-artifacts, pr-build-framework]
uses: ./.github/workflows/pr-extensions.yaml
secrets: inherit
with:
changed: ${{ needs.get-changed-modules.outputs.extensions_changed }}
artifact-id: ${{ needs.find-artifacts.outputs.workflow_for_artifact_download_id }}
pr-build-managers:
name: Build the 'managers' module
needs: [get-changed-modules, find-artifacts, pr-build-framework]
uses: ./.github/workflows/pr-managers.yaml
secrets: inherit
with:
changed: ${{ needs.get-changed-modules.outputs.managers_changed }}
artifact-id: ${{ needs.find-artifacts.outputs.workflow_for_artifact_download_id }}
pr-build-obr:
name: Build the 'obr' module
needs: [get-changed-modules, find-artifacts, pr-build-extensions, pr-build-managers]
uses: ./.github/workflows/pr-obr.yaml
secrets: inherit
with:
changed: ${{ needs.get-changed-modules.outputs.obr_changed }}
artifact-id: ${{ needs.find-artifacts.outputs.workflow_for_artifact_download_id }}
# This is required as all previous jobs are optional based on if a module has changed.
# This job is set in the branch protection rules as required to merge a Pull Request.
end-pull-request-build:
name: Pull Request build was successful
needs: [pr-build-obr, detect-secrets]
runs-on: ubuntu-latest
steps:
- name: End of Pull Request build
run: |
echo "Pull Request build was successful"