Explorar el Código

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.
Rokas Kupstys hace 4 años
padre
commit
9576dfd5e7

+ 30 - 22
.github/workflows/build.yml

@@ -3,8 +3,16 @@ name: build
 on:
   push:
   pull_request:
-  schedule:
-    - cron:  '0 9 * * *'
+  workflow_run:
+    # 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:
   Windows:
@@ -98,22 +106,22 @@ jobs:
       - name: Build Win32 example_glfw_opengl3
         shell: cmd
         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
         shell: cmd
         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
         shell: cmd
         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
         shell: cmd
         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
         shell: cmd
@@ -122,7 +130,7 @@ jobs:
       - name: Build Win32 example_sdl_directx11
         shell: cmd
         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
         shell: cmd
@@ -135,12 +143,12 @@ jobs:
       - name: Build Win32 example_win32_directx11
         shell: cmd
         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
         shell: cmd
         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
         shell: cmd
@@ -153,17 +161,17 @@ jobs:
       - name: Build x64 example_sdl_vulkan
         shell: cmd
         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
         shell: cmd
         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
         shell: cmd
         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
         shell: cmd
@@ -172,17 +180,17 @@ jobs:
       - name: Build x64 example_win32_directx9
         shell: cmd
         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
         shell: cmd
         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
         shell: cmd
         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
         shell: cmd
@@ -344,17 +352,17 @@ jobs:
 
     - name: Build 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
       run: make -C examples/example_sdl_opengl2
-      if: github.event_name == 'schedule'
+      if: github.event_name == 'workflow_run'
 
     - name: Build example_sdl_opengl3
       run: make -C examples/example_sdl_opengl3
 
   MacOS:
-    runs-on: macOS-latest
+    runs-on: macos-latest
     steps:
     - uses: actions/checkout@v2
 
@@ -392,7 +400,7 @@ jobs:
 
     - name: Build 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
       run: make -C examples/example_glfw_metal
@@ -402,7 +410,7 @@ jobs:
 
     - name: Build 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
       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
 
   iOS:
-    runs-on: macOS-latest
+    runs-on: macos-latest
     steps:
     - uses: actions/checkout@v2
 
@@ -460,7 +468,7 @@ jobs:
         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-filter: "'{{ github.branch }}'.match(/master|docking/g) != null && '{{ run.conclusion }}' != '{{ last_run.conclusion }}'"
         discord-username: GitHub Actions
         discord-job-new-failure-message: ''
         discord-job-fixed-failure-message: ''

+ 15 - 0
.github/workflows/scheduled.yml

@@ -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

+ 7 - 3
.github/workflows/static-analysis.yml

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

+ 7 - 2
docs/CHANGELOG.txt

@@ -35,6 +35,11 @@ HOW TO UPDATE?
  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)
@@ -68,9 +73,9 @@ Other Changes:
      - Code using (0,0) as a way to signify "upper-left of the host window" should use GetMainViewport()->Pos.
      - Code using io.DisplaySize as a way to signify "size of the host window" should use GetMainViewport()->Size.
   - We are also exposing a work area in ImGuiViewport ('WorkPos', 'WorkSize' vs 'Pos', 'Size' for full area):
-     - For a Platform Window, the work area is generally the full area minus space used by menu-bars. 
+     - For a Platform Window, the work area is generally the full area minus space used by menu-bars.
      - For a Platform Monitor, the work area is generally the full area minus space used by task-bars.
-  - All of this has been the case in 'docking' branch for a long time. What we've done is merely merging 
+  - All of this has been the case in 'docking' branch for a long time. What we've done is merely merging
     a small chunk of the multi-viewport logic into 'master' to standardize some concepts ahead of time.
 - Tables: Fixed PopItemWidth() or multi-components items not restoring per-colum ItemWidth correctly. (#3760)
 - Window: Fixed minor title bar text clipping issue when FramePadding is small/zero and there are no