-
Notifications
You must be signed in to change notification settings - Fork 0
208 lines (199 loc) · 7.49 KB
/
Copy pathcpp-merge-request.yml
File metadata and controls
208 lines (199 loc) · 7.49 KB
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: Ecosystem branch check (C++)
on:
workflow_dispatch:
inputs:
branch:
type: string
required: true
concurrency:
group: ${{ inputs.branch }}
cancel-in-progress: true
jobs:
validate-PRs:
uses: Geode-solutions/Versions/.github/workflows/validate-pr.yml@master
with:
branch: ${{ inputs.branch }}
repos: "OpenGeode;OpenGeode-IO;OpenGeode-Geosciences;OpenGeode-GeosciencesIO;OpenGeode-Inspector;OpenGeode-Inspector_Geosciences;OpenGeode-Stochastic;Geode-Common_private;Geode-Conversion_private;Geode-Background_private;Geode-Simplex_private;Geode-Hybrid_private;Geode-Hybrid_Geosciences_private;Geode-Viewables_private;Geode-Explicit_private;Geode-Explicit_Geosciences_private;Geode-Implicit_private;Geode-DHI;Geode-SLB;Geode-Fracsima"
workflow: cpp
secrets: inherit
linux:
needs: validate-PRs
runs-on: ubuntu-latest
container: ghcr.io/geode-solutions/ubuntu:master
outputs:
path: ${{ steps.repos.outputs.path }}
steps:
- uses: Geode-solutions/actions/get-release@master
id: repos
with:
repository: ${{ needs.validate-PRs.outputs.repos }}
file: "-ubuntu-private.tar.gz"
token: ${{ secrets.TOKEN }}
branch: ${{ inputs.branch }}
base: ${{ needs.validate-PRs.outputs.base }}
- uses: actions/upload-artifact@v7
with:
name: linux
path: .
linux-test:
needs: [validate-PRs, linux]
runs-on: ubuntu-latest
container: ghcr.io/geode-solutions/ubuntu:master
strategy:
matrix:
repo: ${{ fromJSON(needs.validate-PRs.outputs.repos_array) }}
fail-fast: false
steps:
- uses: actions/download-artifact@v8
with:
name: linux
- name: Libraries
id: libraries
run: |
new_path=$(echo "${{ needs.linux.outputs.path }}" | sed 's/\;/\/lib\:/g')
echo "LD_LIBRARY_PATH=$new_path" >> $GITHUB_ENV
- name: Clone repository
uses: Geode-solutions/actions/install/checkout@master
with:
repo: Geode-solutions/${{ matrix.repo }}
token: ${{ secrets.TOKEN }}
branch: ${{ inputs.branch }}
base: ${{ needs.validate-PRs.outputs.base }}
path: ${{ matrix.repo }}
- name: Compile
run: |
gh auth setup-git
gh api https://api.github.com/repos/Geode-solutions/open-license-manager/contents/projects/geode/geode.lic -H "Accept: application/vnd.github.raw" > geode.lic
mkdir -p build
cd build
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH="${{ needs.linux.outputs.path }}" ../${{ matrix.repo }}/tests
cmake --build .
ctest --output-on-failure --no-tests=error -j 2 -LE unstable
env:
GEODE_LICENSE_LOCATION: ${{ github.workspace }}/geode.lic
GITHUB_TOKEN: ${{ secrets.TOKEN }}
shell: bash
- name: Post to a Slack channel
if: failure()
id: slack
uses: slackapi/slack-github-action@v1
with:
channel-id: C0598GTCLGH
slack-message: "${{ inputs.branch }}: C++ merge request failed for ${{ matrix.repo }} on Linux\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
windows:
needs: validate-PRs
runs-on: windows-2022
outputs:
path: ${{ steps.repos.outputs.path }}
steps:
- uses: Geode-solutions/actions/get-release@master
id: repos
with:
repository: ${{ needs.validate-PRs.outputs.repos }}
file: "-win64-private.zip"
token: ${{ secrets.TOKEN }}
branch: ${{ inputs.branch }}
base: ${{ needs.validate-PRs.outputs.base }}
- uses: actions/upload-artifact@v7
with:
name: windows
path: .
windows-test:
needs: [validate-PRs, windows]
runs-on: windows-2022
strategy:
matrix:
repo: ${{ fromJSON(needs.validate-PRs.outputs.repos_array) }}
fail-fast: false
steps:
- uses: actions/download-artifact@v8
with:
name: windows
- name: Libraries
id: libraries
run: |
$old_path = "${{ needs.windows.outputs.path }}"
$bin_path = $old_path.replace(";", "\bin;").replace("\","/") + "/bin"
echo "bin=$bin_path" >> $env:GITHUB_OUTPUT
$share_path = $old_path.replace(";", "\share;").replace("\","/") + "/share"
echo "share=$share_path" >> $env:GITHUB_OUTPUT
- uses: TheMrMilchmann/setup-msvc-dev@v4
with:
arch: x64
- name: Clone repository
uses: Geode-solutions/actions/install/checkout@master
with:
repo: Geode-solutions/${{ matrix.repo }}
token: ${{ secrets.TOKEN }}
branch: ${{ inputs.branch }}
base: ${{ needs.validate-PRs.outputs.base }}
path: ${{ matrix.repo }}
- name: Compile & Test
run: |
gh auth setup-git
gh api https://api.github.com/repos/Geode-solutions/open-license-manager/contents/projects/geode/geode.lic -H "Accept: application/vnd.github.raw" > geode.lic
mkdir -p build
cd build
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH="${{ needs.windows.outputs.path }}" ../${{ matrix.repo }}/tests
IFS=";" read -a paths <<< "${{ steps.libraries.outputs.bin }}"
for path in "${paths[@]}"
do
if [[ -d $path ]]; then
cp $path/* bin
fi
done
mkdir share
IFS=";" read -a shares <<< "${{ steps.libraries.outputs.share }}"
for share in "${shares[@]}"
do
if [[ -d $share ]]; then
cp -r $share/* share
fi
done
cmake --build .
ctest --output-on-failure --no-tests=error -j 2 -LE unstable
env:
GEODE_LICENSE_LOCATION: ${{ github.workspace }}/geode.lic
GITHUB_TOKEN: ${{ secrets.TOKEN }}
shell: bash
- name: Post to a Slack channel
if: failure()
id: slack
uses: slackapi/slack-github-action@v1
with:
channel-id: C0598GTCLGH
slack-message: "${{ inputs.branch }}: C++ merge request failed for ${{ matrix.repo }} on Windows\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
merge-PRs:
needs: [validate-PRs, linux-test, windows-test]
uses: Geode-solutions/Versions/.github/workflows/merge-pr.yml@master
with:
branch: ${{ inputs.branch }}
repos: ${{ needs.validate-PRs.outputs.repos }}
secrets: inherit
deploy:
runs-on: ubuntu-latest
needs: [merge-PRs, validate-PRs]
steps:
- uses: actions/github-script@v8
with:
github-token: ${{ secrets.TOKEN }}
script: |
github.rest.actions.createWorkflowDispatch({
owner: 'Geode-solutions',
repo: 'Versions',
workflow_id: 'deploy.yml',
ref: 'master',
inputs: { branch: '${{ needs.validate-PRs.outputs.base }}', workflow: 'cpp' }
})
- name: Post to a Slack channel
id: slack
uses: slackapi/slack-github-action@v1
with:
channel-id: C0598GTCLGH
slack-message: "Merge request for ${{ inputs.branch }} complete :tada:"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}