Skip to content

Commit 5b7cefe

Browse files
committed
Add 'Notify dasboard' step to CI
1 parent 71b91be commit 5b7cefe

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
path: ${{ env.WORKSPACE_SRC_PATH }}
3333

3434
- name: Build and install
35+
id: build-and-install
3536
shell: bash
3637
run: |
3738
cmake_options="-GNinja \
@@ -72,12 +73,14 @@ jobs:
7273
echo "artifact_name=$artifact_name" >> $env:GITHUB_OUTPUT
7374
7475
- name: Create artifact
76+
id: create-artifact
7577
uses: actions/[email protected]
7678
with:
7779
name: ${{ steps.sanitize.outputs.artifact_name }}
7880
path: ${{ env.WORKSPACE_INSTALL_PATH }}
7981

8082
- name: Install artifact
83+
id: install-artifact
8184
uses: actions/[email protected]
8285
with:
8386
name: ${{ steps.sanitize.outputs.artifact_name }}
@@ -106,13 +109,41 @@ jobs:
106109
fi
107110
108111
- name: Run Sofa.Metis_test
112+
id: unit-tests
109113
if: always()
110114
shell: bash
111115
run: |
112116
chmod +x $WORKSPACE_BUILD_PATH/tests/Sofa.Metis_test${{ steps.sofa.outputs.exe }}
113117
cd $WORKSPACE_BUILD_PATH
114118
./tests/Sofa.Metis_test${{ steps.sofa.outputs.exe }}
115119
120+
- name: Notify dashboard
121+
if: always() && startsWith(github.repository, 'sofa-framework') && startsWith(github.ref, 'refs/heads/master') # we are not on a fork and on master
122+
env:
123+
DASH_AUTH: ${{ secrets.PLUGIN_DASH }}
124+
shell: bash
125+
run: |
126+
test_status=$([ '${{ steps.unit-tests.outcome }}' == 'success' ] && \
127+
echo 'true' || echo 'false')
128+
129+
build_status=$([ '${{ steps.build-and-install.outcome }}' == 'success' ] && \
130+
echo 'true' || echo 'false')
131+
132+
binary_status=$([ '${{ steps.create-artifact.outcome }}' == 'success' ] && \
133+
[ '${{ steps.install-artifact.outcome }}' == 'success' ] && \
134+
[ '${{ steps.sanitize.outcome }}' == 'success' ] && \
135+
echo 'true' || echo 'false')
136+
137+
138+
curl -X POST -H "X-API-KEY: $DASH_AUTH" -H "Content-Type: application/json" -d \
139+
"{\"id\":\"$(echo "${{ github.repository }}" | awk -F/ '{ print $2 }')\",\
140+
\"github_ref\":\"${{ github.sha }}\",\
141+
\"url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\",\
142+
\"build\":\"$build_status\",\
143+
\"tests\":\"$test_status\",\
144+
\"binary\":\"$binary_status\"}"\
145+
https://sofa-framework.org:5000/api/v1/plugins
146+
116147
deploy:
117148
name: Deploy artifacts
118149
if: always() && startsWith(github.ref, 'refs/heads/') # we are on a branch (not a PR)

0 commit comments

Comments
 (0)