From 00b0b7ea4a70ea03e6e9f02eb189db6fa369ac8e Mon Sep 17 00:00:00 2001 From: bakpaul Date: Thu, 15 May 2025 18:25:10 +0200 Subject: [PATCH 1/5] Add step to notify dashboard, still need to add secret containing auth key --- .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd8f72cf..3eda34a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,7 @@ jobs: key: ccache_${{ runner.os }} - name: Build and install + id: build-install shell: bash run: | cmake_options="-GNinja \ @@ -91,6 +92,7 @@ jobs: echo "PYTHONPATH=$WORKSPACE_INSTALL_PATH/lib/python3/site-packages" | tee -a $GITHUB_ENV - name: Generate stubfiles + id: gen-stub shell: bash run: | @@ -121,12 +123,14 @@ jobs: echo "ARTIFACT_NAME=$ARTIFACT_NAME" | tee -a $GITHUB_ENV - name: Create artifact + id: gen-artifact uses: actions/upload-artifact@v4.4.0 with: name: ${{ env.ARTIFACT_NAME }} path: ${{ env.WORKSPACE_INSTALL_PATH }} - name: Install artifact + id: install-artifact uses: actions/download-artifact@v4.1.7 with: name: ${{ env.ARTIFACT_NAME }} @@ -170,6 +174,7 @@ jobs: python -c "import sys; print('sys.version = ' + str(sys.version)); print('sys.path = ' + str(sys.path))" - name: Run test Binding.Sofa.Tests + id: test-sofa if: always() shell: bash run: | @@ -177,6 +182,7 @@ jobs: ./bin/Bindings.Sofa.Tests${{ steps.sofa.outputs.exe }} - name: Run test Bindings.SofaRuntime.Tests + id: test-sofaruntime if: always() shell: bash run: | @@ -184,6 +190,7 @@ jobs: ./bin/Bindings.SofaRuntime.Tests${{ steps.sofa.outputs.exe }} - name: Run test Bindings.SofaTypes.Tests + id: test-sofatypes if: always() shell: bash run: | @@ -191,12 +198,41 @@ jobs: ./bin/Bindings.SofaTypes.Tests${{ steps.sofa.outputs.exe }} - name: Run test Bindings.Modules.Tests + id: test-sofamodules if: always() shell: bash run: | cd $WORKSPACE_ARTIFACT_PATH ./bin/Bindings.Modules.Tests${{ steps.sofa.outputs.exe }} + - name: notify dashboard + if: always() && startsWith(github.repository, 'sofa-framework') && startsWith(github.ref, 'refs/heads/master') # we are not on a fork and on master + shell: bash + run: | + test_status=$([ '${{ steps.test-sofa.outcome }}' == 'success' ] && \ + [ '${{ steps.test-sofaruntime.outcome }}' == 'success' ] && \ + [ '${{ steps.test-sofatypes.outcome }}' == 'success' ] && \ + [ '${{ steps.test-sofamodules.outcome }}' == 'success' ] && \ + echo 'true' || echo 'false') + + build_status=$([ '${{ steps.build-install.outcome }}' == 'success' ] && \ + [ '${{ steps.gen-stub.outcome }}' == 'success' ] && \ + echo 'true' || echo 'false') + + binary_status=$([ '${{ steps.gen-artifact.outcome }}' == 'success' ] && \ + [ '${{ steps.install-artifact.outcome }}' == 'success' ] && \ + echo 'true' || echo 'false') + + + curl -X POST -H "X-API-KEY: ${{ secrets.PLUGIN_DASH }}" -H "Content-Type: application/json" -d \ + "{\"id":\"$(echo "${{ github.repository }}" | awk -F/ '{ print $2 }')\",\ + \"github_ref":\"${{ github.sha }}\",\ + \"url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\",\ + \"build\":\"\$build_status",\ + \"tests\":\"$test_status\",\ + \"binary\":\"$binary_status\"}"\ + https://sofa-framework.org:5000/api/v1/plugins + deploy: name: Deploy artifacts 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) From aadeb4cfe1df127b8f66f16507fb59eeda45f894 Mon Sep 17 00:00:00 2001 From: Paul Baksic <30337881+bakpaul@users.noreply.github.com> Date: Fri, 16 May 2025 14:32:36 +0200 Subject: [PATCH 2/5] Update ci.yml --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3eda34a4..08ac0b59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -225,10 +225,10 @@ jobs: curl -X POST -H "X-API-KEY: ${{ secrets.PLUGIN_DASH }}" -H "Content-Type: application/json" -d \ - "{\"id":\"$(echo "${{ github.repository }}" | awk -F/ '{ print $2 }')\",\ - \"github_ref":\"${{ github.sha }}\",\ + "{\"id\":\"$(echo "${{ github.repository }}" | awk -F/ '{ print $2 }')\",\ + \"github_ref\":\"${{ github.sha }}\",\ \"url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\",\ - \"build\":\"\$build_status",\ + \"build\":\"\$build_status\",\ \"tests\":\"$test_status\",\ \"binary\":\"$binary_status\"}"\ https://sofa-framework.org:5000/api/v1/plugins From 2bd607c95189aa03c2be77b242a0862596a9b117 Mon Sep 17 00:00:00 2001 From: Paul Baksic <30337881+bakpaul@users.noreply.github.com> Date: Fri, 16 May 2025 14:46:54 +0200 Subject: [PATCH 3/5] PAss secret correctly to action --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08ac0b59..7a9ea161 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -207,6 +207,8 @@ jobs: - name: notify dashboard if: always() && startsWith(github.repository, 'sofa-framework') && startsWith(github.ref, 'refs/heads/master') # we are not on a fork and on master + env: + DASH_AUTH: ${{ secrets.PLUGIN_DASH }} shell: bash run: | test_status=$([ '${{ steps.test-sofa.outcome }}' == 'success' ] && \ @@ -224,7 +226,7 @@ jobs: echo 'true' || echo 'false') - curl -X POST -H "X-API-KEY: ${{ secrets.PLUGIN_DASH }}" -H "Content-Type: application/json" -d \ + curl -X POST -H "X-API-KEY: $DASH_AUTH" -H "Content-Type: application/json" -d \ "{\"id\":\"$(echo "${{ github.repository }}" | awk -F/ '{ print $2 }')\",\ \"github_ref\":\"${{ github.sha }}\",\ \"url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\",\ From fb2447e325fca22b600b72c1c33d384b96a972d5 Mon Sep 17 00:00:00 2001 From: Paul Baksic <30337881+bakpaul@users.noreply.github.com> Date: Fri, 16 May 2025 15:03:39 +0200 Subject: [PATCH 4/5] Fix typo --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a9ea161..546e78c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -205,7 +205,7 @@ jobs: cd $WORKSPACE_ARTIFACT_PATH ./bin/Bindings.Modules.Tests${{ steps.sofa.outputs.exe }} - - name: notify dashboard + - name: Notify dashboard if: always() && startsWith(github.repository, 'sofa-framework') && startsWith(github.ref, 'refs/heads/master') # we are not on a fork and on master env: DASH_AUTH: ${{ secrets.PLUGIN_DASH }} From d32f6418e1141327678a2e85d6436ec99adbce0b Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Fri, 16 May 2025 15:29:49 +0200 Subject: [PATCH 5/5] Fix typo --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 546e78c3..8d8df4da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -230,7 +230,7 @@ jobs: "{\"id\":\"$(echo "${{ github.repository }}" | awk -F/ '{ print $2 }')\",\ \"github_ref\":\"${{ github.sha }}\",\ \"url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\",\ - \"build\":\"\$build_status\",\ + \"build\":\"$build_status\",\ \"tests\":\"$test_status\",\ \"binary\":\"$binary_status\"}"\ https://sofa-framework.org:5000/api/v1/plugins