Skip to content

Commit cd619b6

Browse files
committed
Add 'Notify dasboard' step to CI
1 parent 62c77d7 commit cd619b6

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 30 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-tests
4445
shell: bash
4546
run: |
4647
if [[ "$RUNNER_OS" == "Windows" ]]; then
@@ -69,12 +70,14 @@ jobs:
6970
ccache -s
7071
fi
7172
- name: Create artifact
73+
id: create-artifact
7274
uses: actions/upload-artifact@v2
7375
with:
7476
name: PluginExample_${{ steps.sofa.outputs.run_branch }}_for-SOFA-${{ steps.sofa.outputs.sofa_version }}_${{ runner.os }}
7577
path: ${{ env.WORKSPACE_INSTALL_PATH }}
7678

7779
- name: Install artifact
80+
id: install-artifact
7881
uses: actions/download-artifact@v2
7982
with:
8083
name: PluginExample_${{ steps.sofa.outputs.run_branch }}_for-SOFA-${{ steps.sofa.outputs.sofa_version }}_${{ runner.os }}
@@ -107,12 +110,39 @@ jobs:
107110
ls -la "$WORKSPACE_ARTIFACT_PATH"
108111
109112
- name: Run test PluginExample_test
113+
id: unit-tests
110114
if: always()
111115
shell: bash
112116
run: |
113117
cd $WORKSPACE_BUILD_PATH
114118
./PluginExample_test/PluginExample_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-tests.outcome }}' == 'success' ] && \
130+
echo 'true' || echo 'false')
131+
132+
binary_status=$([ '${{ steps.create-artifact.outcome }}' == 'success' ] && \
133+
[ '${{ steps.install-artifact.outcome }}' == 'success' ] && \
134+
echo 'true' || echo 'false')
135+
136+
137+
curl -X POST -H "X-API-KEY: $DASH_AUTH" -H "Content-Type: application/json" -d \
138+
"{\"id\":\"$(echo "${{ github.repository }}" | awk -F/ '{ print $2 }')\",\
139+
\"github_ref\":\"${{ github.sha }}\",\
140+
\"url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\",\
141+
\"build\":\"$build_status\",\
142+
\"tests\":\"$test_status\",\
143+
\"binary\":\"$binary_status\"}"\
144+
https://sofa-framework.org:5000/api/v1/plugins
145+
116146
deploy:
117147
name: Deploy artifacts
118148
if: always() && startsWith(github.ref, 'refs/heads/') # we are on a branch (not a PR)

0 commit comments

Comments
 (0)