Skip to content

Commit 548581e

Browse files
authored
Merge pull request #191 from bakpaul/25_05_add_dashboard_notify
Add 'notify dashboard' step to CI
2 parents 2897605 + 3c5b334 commit 548581e

1 file changed

Lines changed: 37 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: CI
22

33
on:
44
workflow_dispatch:
@@ -29,6 +29,7 @@ jobs:
2929
path: ${{ env.WORKSPACE_SRC_PATH }}
3030

3131
- name: Build and install
32+
id: build-install
3233
shell: bash
3334
run: |
3435
if [[ "$RUNNER_OS" == "Windows" ]]; then
@@ -70,12 +71,14 @@ jobs:
7071
echo "artifact_name=$artifact_name" >> $env:GITHUB_OUTPUT
7172
7273
- name: Create artifact
74+
id: create-artifact
7375
uses: actions/upload-artifact@v4.4.0
7476
with:
7577
name: ${{ steps.sanitize.outputs.artifact_name }}
7678
path: ${{ env.WORKSPACE_INSTALL_PATH }}
7779

7880
- name: Install artifact
81+
id: install-artifact
7982
uses: actions/download-artifact@v4.1.7
8083
with:
8184
name: ${{ steps.sanitize.outputs.artifact_name }}
@@ -116,7 +119,9 @@ jobs:
116119
# echo '----------------------'
117120
# echo "SOFA_ROOT = $SOFA_ROOT"
118121

122+
119123
- name: Run BeamAdapter_test
124+
id: unit-test
120125
if: always()
121126
shell: bash
122127
run: |
@@ -125,6 +130,7 @@ jobs:
125130
./bin/BeamAdapter_test${{ steps.sofa.outputs.exe }}
126131
127132
- name: Fetch, install and run Regression_test
133+
id: regression-test
128134
if: always()
129135
shell: bash
130136
run: |
@@ -146,6 +152,36 @@ jobs:
146152
echo "Regression tests are not supported on the CI for macOS yet (TODO)"
147153
fi
148154
155+
- name: Notify dashboard
156+
if: always() && startsWith(github.repository, 'sofa-framework') && startsWith(github.ref, 'refs/heads/master') # we are not on a fork and on master
157+
env:
158+
DASH_AUTH: ${{ secrets.PLUGIN_DASH }}
159+
shell: bash
160+
run: |
161+
162+
test_status=$([ '${{ steps.unit-test.outcome }}' == 'success' ] && \
163+
[ '${{ steps.regression-test.outcome }}' == 'success' ] && \
164+
echo 'true' || echo 'false')
165+
166+
build_status=$([ '${{ steps.build-install.outcome }}' == 'success' ] && \
167+
echo 'true' || echo 'false')
168+
169+
binary_status=$([ '${{ steps.sanitize.outcome }}' == 'success' ] && \
170+
[ '${{ steps.create-artifact.outcome }}' == 'success' ] && \
171+
[ '${{ steps.install-artifact.outcome }}' == 'success' ] && \
172+
echo 'true' || echo 'false')
173+
174+
175+
curl -X POST -H "X-API-KEY: $DASH_AUTH" -H "Content-Type: application/json" -d \
176+
"{\"id\":\"$(echo "${{ github.repository }}" | awk -F/ '{ print $2 }')\",\
177+
\"github_ref\":\"${{ github.sha }}\",\
178+
\"url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\",\
179+
\"build\":\"$build_status\",\
180+
\"tests\":\"$test_status\",\
181+
\"binary\":\"$binary_status\"}"\
182+
https://sofa-framework.org:5000/api/v1/plugins
183+
184+
149185
deploy:
150186
name: Deploy artifacts
151187
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) needs: [build-and-test]

0 commit comments

Comments
 (0)