From c6f9c558ec53fba6862625bda0f222939428a180 Mon Sep 17 00:00:00 2001 From: Rokas Kupstys Date: Thu, 8 Oct 2020 15:06:46 +0300 Subject: [PATCH] CI: Use our own discord notifier. --- .github/workflows/build.yml | 71 +++++++++++---------------- .github/workflows/static-analysis.yml | 37 +++++++++++--- 2 files changed, 59 insertions(+), 49 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a15d5e23..a8db3199 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -179,14 +179,6 @@ jobs: shell: cmd run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx12/example_win32_directx12.vcxproj /p:Platform=x64 /p:Configuration=Release' - - uses: sarisia/actions-status-discord@v1 - if: failure() - with: - webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} - username: GitHub Actions - color: 0xFF0000 - title: ${{ github.job }} - Linux: runs-on: ubuntu-20.04 steps: @@ -318,15 +310,6 @@ jobs: - name: Build example_sdl_opengl3 run: make -C examples/example_sdl_opengl3 - # Use https://github.com/marketplace/actions/actions-status-discord to send status to Discord - - uses: sarisia/actions-status-discord@v1 - if: failure() - with: - webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} - username: GitHub Actions - color: 0xFF0000 - title: ${{ github.job }} - MacOS: runs-on: macOS-latest steps: @@ -382,15 +365,6 @@ jobs: - name: Build example_apple_opengl2 run: xcodebuild -project examples/example_apple_opengl2/example_apple_opengl2.xcodeproj -target example_osx_opengl2 - # Use https://github.com/marketplace/actions/actions-status-discord to send status to Discord - - uses: sarisia/actions-status-discord@v1 - if: failure() - with: - webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} - username: GitHub Actions - color: 0xFF0000 - title: ${{ github.job }} - iOS: runs-on: macOS-latest steps: @@ -403,15 +377,6 @@ jobs: # Code signing is required, but we disable it because it is irrelevant for CI builds. xcodebuild -project examples/example_apple_metal/example_apple_metal.xcodeproj -target example_apple_metal_ios CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO - # Use https://github.com/marketplace/actions/actions-status-discord to send status to Discord - - uses: sarisia/actions-status-discord@v1 - if: failure() - with: - webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} - username: GitHub Actions - color: 0xFF0000 - title: ${{ github.job }} - Emscripten: runs-on: ubuntu-18.04 steps: @@ -434,11 +399,33 @@ jobs: popd make -C examples/example_emscripten - # Use https://github.com/marketplace/actions/actions-status-discord to send status to Discord - - uses: sarisia/actions-status-discord@v1 - if: failure() + Discord-CI: + runs-on: ubuntu-18.04 + if: always() + needs: [Windows, Linux, MacOS, iOS, Emscripten] + steps: + - uses: dearimgui/github_discord_notifier@latest with: - webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} - username: GitHub Actions - color: 0xFF0000 - title: ${{ github.job }} + discord-webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} + github-token: ${{ github.token }} + action-task: discord-jobs + discord-filter: "'{{ github.branch }}'.match(/master|docking|tables/g) != null && '{{ run.conclusion }}' != '{{ last_run.conclusion }}'" + discord-username: GitHub Actions + discord-job-new-failure-message: '' + discord-job-fixed-failure-message: '' + discord-job-new-failure-embed: | + { + "title": "`{{ job.name }}` job is failing on `{{ github.branch }}`!", + "description": "Commit [{{ github.context.payload.head_commit.title }}]({{ github.context.payload.head_commit.url }}) pushed to [{{ github.branch }}]({{ github.branch_url }}) broke [{{ job.name }}]({{ job.url }}) build job.\nFailing steps: {{ failing_steps }}", + "url": "{{ job.url }}", + "color": "0xFF0000", + "timestamp": "{{ run.updated_at }}" + } + discord-job-fixed-failure-embed: | + { + "title": "`{{ github.branch }}` branch is no longer failing!", + "description": "Build failures were fixed on [{{ github.branch }}]({{ github.branch_url }}) branch.", + "color": "0x00FF00", + "url": "{{ github.context.payload.head_commit.url }}", + "timestamp": "{{ run.completed_at }}" + } diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 3681ecb2..868b5740 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -42,10 +42,33 @@ jobs: pvs-studio-analyzer analyze -e ../../imstb_rectpack.h -e ../../imstb_textedit.h -e ../../imstb_truetype.h -l ../../pvs-studio.lic -o pvs-studio.log plog-converter -a 'GA:1,2;OP:1' -t errorfile -w pvs-studio.log - - uses: sarisia/actions-status-discord@v1 - if: failure() - with: - webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} - username: GitHub Actions - color: 0xFF0000 - title: ${{ github.job }} + Discord-CI: + runs-on: ubuntu-18.04 + needs: [PVS-Studio] + if: always() + steps: + - uses: dearimgui/github_discord_notifier@latest + with: + discord-webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} + github-token: ${{ github.token }} + action-task: discord-jobs + discord-filter: "'{{ github.branch }}'.match(/master|docking|tables/g) != null && '{{ run.conclusion }}' != '{{ last_run.conclusion }}'" + discord-username: GitHub Actions + discord-job-new-failure-message: '' + discord-job-fixed-failure-message: '' + discord-job-new-failure-embed: | + { + "title": "`{{ job.name }}` job is failing on `{{ github.branch }}`!", + "description": "Commit [{{ github.context.payload.head_commit.title }}]({{ github.context.payload.head_commit.url }}) pushed to [{{ github.branch }}]({{ github.branch_url }}) broke static analysis [{{ job.name }}]({{ job.url }}) job.\nFailing steps: {{ failing_steps }}", + "url": "{{ job.url }}", + "color": "0xFF0000", + "timestamp": "{{ run.updated_at }}" + } + discord-job-fixed-failure-embed: | + { + "title": "`{{ github.branch }}` branch is no longer failing!", + "description": "Staic analysis failures were fixed on [{{ github.branch }}]({{ github.branch_url }}) branch.", + "color": "0x00FF00", + "url": "{{ github.context.payload.head_commit.url }}", + "timestamp": "{{ run.completed_at }}" + }