Browse Source

Add workflow_dispatch with Google Test filter and OS selection (#2056)

* Add workflow_dispatch with Google Test filter

Add the workflow_dispatch trigger to the test.yaml workflow. Includes an
input for an optional Google Test filter pattern.

* Add OS selection to workflow_dispatch

* Fix wording
Florian Albrechtskirchinger 10 months ago
parent
commit
748f47b377
1 changed files with 37 additions and 4 deletions
  1. 37 4
      .github/workflows/test.yaml

+ 37 - 4
.github/workflows/test.yaml

@@ -1,11 +1,36 @@
 name: test
 
-on: [push, pull_request]
+on:
+  push:
+  pull_request:
+  workflow_dispatch:
+    inputs:
+      gtest_filter:
+        description: 'Google Test filter'
+      test_linux:
+        description: 'Test on Linux'
+        type: boolean
+        default: true
+      test_macos:
+        description: 'Test on MacOS'
+        type: boolean
+        default: true
+      test_windows:
+        description: 'Test on Windows'
+        type: boolean
+        default: true
+
+env:
+  GTEST_FILTER: ${{ github.event.inputs.gtest_filter || '*' }}
 
 jobs:
   ubuntu:
     runs-on: ubuntu-latest
-    if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
+    if: >
+      (github.event_name == 'push') ||
+      (github.event_name == 'pull_request'  &&
+       github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) ||
+      (github.event_name == 'workflow_dispatch' && github.event.inputs.test_linux == 'true')
     steps:
       - name: checkout
         uses: actions/checkout@v4
@@ -18,7 +43,11 @@ jobs:
 
   macos:
     runs-on: macos-latest
-    if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
+    if: >
+      (github.event_name == 'push') ||
+      (github.event_name == 'pull_request'  &&
+       github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) ||
+      (github.event_name == 'workflow_dispatch' && github.event.inputs.test_macos == 'true')
     steps:
       - name: checkout
         uses: actions/checkout@v4
@@ -29,7 +58,11 @@ jobs:
 
   windows:
     runs-on: windows-latest
-    if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
+    if: >
+      (github.event_name == 'push') ||
+      (github.event_name == 'pull_request'  &&
+       github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) ||
+      (github.event_name == 'workflow_dispatch' && github.event.inputs.test_windows == 'true')
     steps:
     - name: Prepare Git for Checkout on Windows
       run: |