CI: Use workflow_run to trigger scheduled builds and static analysis.

Scheduled builds now are triggered by a dummy "scheduled" workflow that is invoked by the timer. This gives forks an ability to disable scheduled builds while maintaining ability to perform CI builds in forked repository. Similarly static analysis is invoked on completion of "build" workflow, ensuring analysis is performed with every build. Also should build workflow triggers change, we do not need to replicate same changes in static analysis workflow file.
This commit is contained in:
Rokas Kupstys 2021-02-16 10:33:29 +02:00 committed by ocornut
parent 30b7545841
commit 9576dfd5e7
4 changed files with 59 additions and 27 deletions

View File

@ -3,8 +3,16 @@ name: build
on: on:
push: push:
pull_request: pull_request:
schedule: workflow_run:
- cron: '0 9 * * *' # Use a workflow as a trigger of scheduled builds. Forked repositories can disable scheduled builds by disabling
# "scheduled" workflow, while maintaining ability to perform local CI builds.
workflows:
- scheduled
branches:
- master
- docking
types:
- requested
jobs: jobs:
Windows: Windows:
@ -98,22 +106,22 @@ jobs:
- name: Build Win32 example_glfw_opengl3 - name: Build Win32 example_glfw_opengl3
shell: cmd shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj /p:Platform=Win32 /p:Configuration=Release' run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj /p:Platform=Win32 /p:Configuration=Release'
if: github.event_name == 'schedule' if: github.event_name == 'workflow_run'
- name: Build Win32 example_glfw_vulkan - name: Build Win32 example_glfw_vulkan
shell: cmd shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release' run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release'
if: github.event_name == 'schedule' if: github.event_name == 'workflow_run'
- name: Build Win32 example_sdl_vulkan - name: Build Win32 example_sdl_vulkan
shell: cmd shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release' run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release'
if: github.event_name == 'schedule' if: github.event_name == 'workflow_run'
- name: Build Win32 example_sdl_opengl2 - name: Build Win32 example_sdl_opengl2
shell: cmd shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj /p:Platform=Win32 /p:Configuration=Release' run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj /p:Platform=Win32 /p:Configuration=Release'
if: github.event_name == 'schedule' if: github.event_name == 'workflow_run'
- name: Build Win32 example_sdl_opengl3 - name: Build Win32 example_sdl_opengl3
shell: cmd shell: cmd
@ -122,7 +130,7 @@ jobs:
- name: Build Win32 example_sdl_directx11 - name: Build Win32 example_sdl_directx11
shell: cmd shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_directx11/example_sdl_directx11.vcxproj /p:Platform=Win32 /p:Configuration=Release' run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_directx11/example_sdl_directx11.vcxproj /p:Platform=Win32 /p:Configuration=Release'
if: github.event_name == 'schedule' if: github.event_name == 'workflow_run'
- name: Build Win32 example_win32_directx9 - name: Build Win32 example_win32_directx9
shell: cmd shell: cmd
@ -135,12 +143,12 @@ jobs:
- name: Build Win32 example_win32_directx11 - name: Build Win32 example_win32_directx11
shell: cmd shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx11/example_win32_directx11.vcxproj /p:Platform=Win32 /p:Configuration=Release' run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx11/example_win32_directx11.vcxproj /p:Platform=Win32 /p:Configuration=Release'
if: github.event_name == 'schedule' if: github.event_name == 'workflow_run'
- name: Build x64 example_glfw_opengl2 - name: Build x64 example_glfw_opengl2
shell: cmd shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj /p:Platform=x64 /p:Configuration=Release' run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj /p:Platform=x64 /p:Configuration=Release'
if: github.event_name == 'schedule' if: github.event_name == 'workflow_run'
- name: Build x64 example_glfw_opengl3 - name: Build x64 example_glfw_opengl3
shell: cmd shell: cmd
@ -153,17 +161,17 @@ jobs:
- name: Build x64 example_sdl_vulkan - name: Build x64 example_sdl_vulkan
shell: cmd shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release' run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release'
if: github.event_name == 'schedule' if: github.event_name == 'workflow_run'
- name: Build x64 example_sdl_opengl2 - name: Build x64 example_sdl_opengl2
shell: cmd shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj /p:Platform=x64 /p:Configuration=Release' run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj /p:Platform=x64 /p:Configuration=Release'
if: github.event_name == 'schedule' if: github.event_name == 'workflow_run'
- name: Build x64 example_sdl_opengl3 - name: Build x64 example_sdl_opengl3
shell: cmd shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj /p:Platform=x64 /p:Configuration=Release' run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj /p:Platform=x64 /p:Configuration=Release'
if: github.event_name == 'schedule' if: github.event_name == 'workflow_run'
- name: Build x64 example_sdl_directx11 - name: Build x64 example_sdl_directx11
shell: cmd shell: cmd
@ -172,17 +180,17 @@ jobs:
- name: Build x64 example_win32_directx9 - name: Build x64 example_win32_directx9
shell: cmd shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx9/example_win32_directx9.vcxproj /p:Platform=x64 /p:Configuration=Release' run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx9/example_win32_directx9.vcxproj /p:Platform=x64 /p:Configuration=Release'
if: github.event_name == 'schedule' if: github.event_name == 'workflow_run'
- name: Build x64 example_win32_directx10 - name: Build x64 example_win32_directx10
shell: cmd shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx10/example_win32_directx10.vcxproj /p:Platform=x64 /p:Configuration=Release' run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx10/example_win32_directx10.vcxproj /p:Platform=x64 /p:Configuration=Release'
if: github.event_name == 'schedule' if: github.event_name == 'workflow_run'
- name: Build x64 example_win32_directx11 - name: Build x64 example_win32_directx11
shell: cmd shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx11/example_win32_directx11.vcxproj /p:Platform=x64 /p:Configuration=Release' run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx11/example_win32_directx11.vcxproj /p:Platform=x64 /p:Configuration=Release'
if: github.event_name == 'schedule' if: github.event_name == 'workflow_run'
- name: Build x64 example_win32_directx12 - name: Build x64 example_win32_directx12
shell: cmd shell: cmd
@ -344,17 +352,17 @@ jobs:
- name: Build example_glfw_opengl3 - name: Build example_glfw_opengl3
run: make -C examples/example_glfw_opengl3 run: make -C examples/example_glfw_opengl3
if: github.event_name == 'schedule' if: github.event_name == 'workflow_run'
- name: Build example_sdl_opengl2 - name: Build example_sdl_opengl2
run: make -C examples/example_sdl_opengl2 run: make -C examples/example_sdl_opengl2
if: github.event_name == 'schedule' if: github.event_name == 'workflow_run'
- name: Build example_sdl_opengl3 - name: Build example_sdl_opengl3
run: make -C examples/example_sdl_opengl3 run: make -C examples/example_sdl_opengl3
MacOS: MacOS:
runs-on: macOS-latest runs-on: macos-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -392,7 +400,7 @@ jobs:
- name: Build example_glfw_opengl3 - name: Build example_glfw_opengl3
run: make -C examples/example_glfw_opengl3 run: make -C examples/example_glfw_opengl3
if: github.event_name == 'schedule' if: github.event_name == 'workflow_run'
- name: Build example_glfw_metal - name: Build example_glfw_metal
run: make -C examples/example_glfw_metal run: make -C examples/example_glfw_metal
@ -402,7 +410,7 @@ jobs:
- name: Build example_sdl_opengl2 - name: Build example_sdl_opengl2
run: make -C examples/example_sdl_opengl2 run: make -C examples/example_sdl_opengl2
if: github.event_name == 'schedule' if: github.event_name == 'workflow_run'
- name: Build example_sdl_opengl3 - name: Build example_sdl_opengl3
run: make -C examples/example_sdl_opengl3 run: make -C examples/example_sdl_opengl3
@ -414,7 +422,7 @@ jobs:
run: xcodebuild -project examples/example_apple_opengl2/example_apple_opengl2.xcodeproj -target example_osx_opengl2 run: xcodebuild -project examples/example_apple_opengl2/example_apple_opengl2.xcodeproj -target example_osx_opengl2
iOS: iOS:
runs-on: macOS-latest runs-on: macos-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -460,7 +468,7 @@ jobs:
discord-webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} discord-webhook: ${{ secrets.DISCORD_CI_WEBHOOK }}
github-token: ${{ github.token }} github-token: ${{ github.token }}
action-task: discord-jobs action-task: discord-jobs
discord-filter: "'{{ github.branch }}'.match(/master|docking|tables/g) != null && '{{ run.conclusion }}' != '{{ last_run.conclusion }}'" discord-filter: "'{{ github.branch }}'.match(/master|docking/g) != null && '{{ run.conclusion }}' != '{{ last_run.conclusion }}'"
discord-username: GitHub Actions discord-username: GitHub Actions
discord-job-new-failure-message: '' discord-job-new-failure-message: ''
discord-job-fixed-failure-message: '' discord-job-fixed-failure-message: ''

15
.github/workflows/scheduled.yml vendored Normal file
View File

@ -0,0 +1,15 @@
#
# This is a dummy workflow used to trigger scheduled builds. Forked repositories most likely should disable this
# workflow to avoid daily builds of inactive repositories.
#
name: scheduled
on:
schedule:
- cron: '0 9 * * *'
jobs:
scheduled:
runs-on: ubuntu-latest
steps:
- run: exit 0

View File

@ -1,8 +1,12 @@
name: static-analysis name: static-analysis
on: on:
push: {} workflow_run:
pull_request: {} # Perform static analysis together with build workflow. Build triggers of "build" workflow do not need to be repeated here.
workflows:
- build
types:
- requested
jobs: jobs:
PVS-Studio: PVS-Studio:
@ -51,7 +55,7 @@ jobs:
discord-webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} discord-webhook: ${{ secrets.DISCORD_CI_WEBHOOK }}
github-token: ${{ github.token }} github-token: ${{ github.token }}
action-task: discord-jobs action-task: discord-jobs
discord-filter: "'{{ github.branch }}'.match(/master|docking|tables/g) != null && '{{ run.conclusion }}' != '{{ last_run.conclusion }}'" discord-filter: "'{{ github.branch }}'.match(/master|docking/g) != null && '{{ run.conclusion }}' != '{{ last_run.conclusion }}'"
discord-username: GitHub Actions discord-username: GitHub Actions
discord-job-new-failure-message: '' discord-job-new-failure-message: ''
discord-job-fixed-failure-message: '' discord-job-fixed-failure-message: ''

View File

@ -35,6 +35,11 @@ HOW TO UPDATE?
VERSION 1.82 WIP (In Progresss) VERSION 1.82 WIP (In Progresss)
----------------------------------------------------------------------- -----------------------------------------------------------------------
Other Changes:
- CI: Use a dedicated "scheduled" workflow to trigger scheduled builds. Forks may disable this workflow if
scheduled builds builds are not required. [@rokups]
----------------------------------------------------------------------- -----------------------------------------------------------------------
VERSION 1.81 (Released 2021-02-10) VERSION 1.81 (Released 2021-02-10)