Skip to content

Commit e9670c3

Browse files
authored
Add step to publish status (#497)
* Add step to notify dashboard, still need to add secret containing auth key * Update ci.yml * PAss secret correctly to action * Fix typo * Fix typo
1 parent f385923 commit e9670c3

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
key: ccache_${{ runner.os }}
4747

4848
- name: Build and install
49+
id: build-install
4950
shell: bash
5051
run: |
5152
cmake_options="-GNinja \
@@ -91,6 +92,7 @@ jobs:
9192
echo "PYTHONPATH=$WORKSPACE_INSTALL_PATH/lib/python3/site-packages" | tee -a $GITHUB_ENV
9293
9394
- name: Generate stubfiles
95+
id: gen-stub
9496
shell: bash
9597
run: |
9698
@@ -121,12 +123,14 @@ jobs:
121123
echo "ARTIFACT_NAME=$ARTIFACT_NAME" | tee -a $GITHUB_ENV
122124
123125
- name: Create artifact
126+
id: gen-artifact
124127
uses: actions/[email protected]
125128
with:
126129
name: ${{ env.ARTIFACT_NAME }}
127130
path: ${{ env.WORKSPACE_INSTALL_PATH }}
128131

129132
- name: Install artifact
133+
id: install-artifact
130134
uses: actions/[email protected]
131135
with:
132136
name: ${{ env.ARTIFACT_NAME }}
@@ -170,33 +174,67 @@ jobs:
170174
python -c "import sys; print('sys.version = ' + str(sys.version)); print('sys.path = ' + str(sys.path))"
171175
172176
- name: Run test Binding.Sofa.Tests
177+
id: test-sofa
173178
if: always()
174179
shell: bash
175180
run: |
176181
cd $WORKSPACE_ARTIFACT_PATH
177182
./bin/Bindings.Sofa.Tests${{ steps.sofa.outputs.exe }}
178183
179184
- name: Run test Bindings.SofaRuntime.Tests
185+
id: test-sofaruntime
180186
if: always()
181187
shell: bash
182188
run: |
183189
cd $WORKSPACE_ARTIFACT_PATH
184190
./bin/Bindings.SofaRuntime.Tests${{ steps.sofa.outputs.exe }}
185191
186192
- name: Run test Bindings.SofaTypes.Tests
193+
id: test-sofatypes
187194
if: always()
188195
shell: bash
189196
run: |
190197
cd $WORKSPACE_ARTIFACT_PATH
191198
./bin/Bindings.SofaTypes.Tests${{ steps.sofa.outputs.exe }}
192199
193200
- name: Run test Bindings.Modules.Tests
201+
id: test-sofamodules
194202
if: always()
195203
shell: bash
196204
run: |
197205
cd $WORKSPACE_ARTIFACT_PATH
198206
./bin/Bindings.Modules.Tests${{ steps.sofa.outputs.exe }}
199207
208+
- name: Notify dashboard
209+
if: always() && startsWith(github.repository, 'sofa-framework') && startsWith(github.ref, 'refs/heads/master') # we are not on a fork and on master
210+
env:
211+
DASH_AUTH: ${{ secrets.PLUGIN_DASH }}
212+
shell: bash
213+
run: |
214+
test_status=$([ '${{ steps.test-sofa.outcome }}' == 'success' ] && \
215+
[ '${{ steps.test-sofaruntime.outcome }}' == 'success' ] && \
216+
[ '${{ steps.test-sofatypes.outcome }}' == 'success' ] && \
217+
[ '${{ steps.test-sofamodules.outcome }}' == 'success' ] && \
218+
echo 'true' || echo 'false')
219+
220+
build_status=$([ '${{ steps.build-install.outcome }}' == 'success' ] && \
221+
[ '${{ steps.gen-stub.outcome }}' == 'success' ] && \
222+
echo 'true' || echo 'false')
223+
224+
binary_status=$([ '${{ steps.gen-artifact.outcome }}' == 'success' ] && \
225+
[ '${{ steps.install-artifact.outcome }}' == 'success' ] && \
226+
echo 'true' || echo 'false')
227+
228+
229+
curl -X POST -H "X-API-KEY: $DASH_AUTH" -H "Content-Type: application/json" -d \
230+
"{\"id\":\"$(echo "${{ github.repository }}" | awk -F/ '{ print $2 }')\",\
231+
\"github_ref\":\"${{ github.sha }}\",\
232+
\"url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\",\
233+
\"build\":\"$build_status\",\
234+
\"tests\":\"$test_status\",\
235+
\"binary\":\"$binary_status\"}"\
236+
https://sofa-framework.org:5000/api/v1/plugins
237+
200238
deploy:
201239
name: Deploy artifacts
202240
if: always() && startsWith(github.repository, 'sofa-framework') && (startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/tags/')) # we are not on a fork and on a branch or a tag (not a PR)

0 commit comments

Comments
 (0)