Skip to content

Commit 4941d69

Browse files
authored
Add 'Notify dasboard' step to CI (#18)
* Add 'Notify dasboard' step to CI * Add 'Notify dasboard' step to CI
1 parent cb6acf8 commit 4941d69

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
@@ -41,6 +41,7 @@ jobs:
4141
path: ${{ env.WORKSPACE_SRC_PATH }}
4242

4343
- name: Build and install
44+
id: build-and-install
4445
shell: bash
4546
run: |
4647
if [[ "$RUNNER_OS" == "Windows" ]]; then
@@ -82,12 +83,14 @@ jobs:
8283
echo "artifact_name=$artifact_name" >> $env:GITHUB_OUTPUT
8384
8485
- name: Create artifact
86+
id: create-artifact
8587
uses: actions/upload-artifact@v4.4.0
8688
with:
8789
name: ${{ steps.sanitize.outputs.artifact_name }}
8890
path: ${{ env.WORKSPACE_INSTALL_PATH }}
8991

9092
- name: Install artifact
93+
id: install-artifact
9194
uses: actions/download-artifact@v4.1.7
9295
with:
9396
name: ${{ steps.sanitize.outputs.artifact_name }}
@@ -120,12 +123,40 @@ jobs:
120123
ls -la "$WORKSPACE_ARTIFACT_PATH"
121124
122125
- name: Run test PluginExample_test
126+
id: unit-tests
123127
if: always()
124128
shell: bash
125129
run: |
126130
cd $WORKSPACE_BUILD_PATH
127131
./PluginExample_test/PluginExample_test${{ steps.sofa.outputs.exe }}
128132
133+
- name: Notify dashboard
134+
if: always() && startsWith(github.repository, 'sofa-framework') && startsWith(github.ref, 'refs/heads/master') # we are not on a fork and on master
135+
env:
136+
DASH_AUTH: ${{ secrets.PLUGIN_DASH }}
137+
shell: bash
138+
run: |
139+
test_status=$([ '${{ steps.unit-tests.outcome }}' == 'success' ] && \
140+
echo 'true' || echo 'false')
141+
142+
build_status=$([ '${{ steps.build-and-install.outcome }}' == 'success' ] && \
143+
echo 'true' || echo 'false')
144+
145+
binary_status=$([ '${{ steps.create-artifact.outcome }}' == 'success' ] && \
146+
[ '${{ steps.install-artifact.outcome }}' == 'success' ] && \
147+
[ '${{ steps.sanitize.outcome }}' == 'success' ] && \
148+
echo 'true' || echo 'false')
149+
150+
151+
curl -X POST -H "X-API-KEY: $DASH_AUTH" -H "Content-Type: application/json" -d \
152+
"{\"id\":\"$(echo "${{ github.repository }}" | awk -F/ '{ print $2 }')\",\
153+
\"github_ref\":\"${{ github.sha }}\",\
154+
\"url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\",\
155+
\"build\":\"$build_status\",\
156+
\"tests\":\"$test_status\",\
157+
\"binary\":\"$binary_status\"}"\
158+
https://sofa-framework.org:5000/api/v1/plugins
159+
129160
deploy:
130161
name: Deploy artifacts
131162
if: always() && startsWith(github.ref, 'refs/heads/') # we are on a branch (not a PR)

0 commit comments

Comments
 (0)