Skip to content

Commit 748f47b

Browse files
Add workflow_dispatch with Google Test filter and OS selection (yhirose#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
1 parent 4cb8ff9 commit 748f47b

File tree

1 file changed

+37
-4
lines changed

1 file changed

+37
-4
lines changed

.github/workflows/test.yaml

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,36 @@
11
name: test
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
inputs:
8+
gtest_filter:
9+
description: 'Google Test filter'
10+
test_linux:
11+
description: 'Test on Linux'
12+
type: boolean
13+
default: true
14+
test_macos:
15+
description: 'Test on MacOS'
16+
type: boolean
17+
default: true
18+
test_windows:
19+
description: 'Test on Windows'
20+
type: boolean
21+
default: true
22+
23+
env:
24+
GTEST_FILTER: ${{ github.event.inputs.gtest_filter || '*' }}
425

526
jobs:
627
ubuntu:
728
runs-on: ubuntu-latest
8-
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
29+
if: >
30+
(github.event_name == 'push') ||
31+
(github.event_name == 'pull_request' &&
32+
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) ||
33+
(github.event_name == 'workflow_dispatch' && github.event.inputs.test_linux == 'true')
934
steps:
1035
- name: checkout
1136
uses: actions/checkout@v4
@@ -18,7 +43,11 @@ jobs:
1843

1944
macos:
2045
runs-on: macos-latest
21-
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
46+
if: >
47+
(github.event_name == 'push') ||
48+
(github.event_name == 'pull_request' &&
49+
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) ||
50+
(github.event_name == 'workflow_dispatch' && github.event.inputs.test_macos == 'true')
2251
steps:
2352
- name: checkout
2453
uses: actions/checkout@v4
@@ -29,7 +58,11 @@ jobs:
2958

3059
windows:
3160
runs-on: windows-latest
32-
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
61+
if: >
62+
(github.event_name == 'push') ||
63+
(github.event_name == 'pull_request' &&
64+
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) ||
65+
(github.event_name == 'workflow_dispatch' && github.event.inputs.test_windows == 'true')
3366
steps:
3467
- name: Prepare Git for Checkout on Windows
3568
run: |

0 commit comments

Comments
 (0)