Skip to content

Commit d3b00e0

Browse files
committed
github action: rework filters
Split filter list out in a extra file like podman has. Then define a new filter for things that should trigger all tests and then the ones that only need to trigger storage, image, common. Then rework the copnditions to use the new filters, also swap github.event_name == 'push' with github.event_name != 'pull_request'. While it should not matter right now I could see us adding a nightly trigger via cron and then we would still want to run all tests. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
1 parent c557c3a commit d3b00e0

2 files changed

Lines changed: 45 additions & 18 deletions

File tree

.github/filters.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
all:
2+
- '.github/workflows/ci.yml'
3+
- '.github/workflows/lima.yml'
4+
- '.github/filters.yaml'
5+
- 'hack/ci/**'
6+
- 'Makefile'
7+
- 'go.work'
8+
- 'go.work.sum'
9+
10+
storage:
11+
- 'storage/**'
12+
13+
image:
14+
- 'image/**'
15+
# image depends on storage, so any storage change must trigger image tests as well
16+
- 'storage/**'
17+
18+
common:
19+
- 'common/**'
20+
# see comment above, common depends on both image and storage
21+
- 'image/**'
22+
- 'storage/**'

.github/workflows/ci.yml

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,26 @@ jobs:
2121
path-filter:
2222
runs-on: ubuntu-24.04
2323
outputs:
24+
all: ${{ steps.filter.outputs.all }}
2425
storage: ${{ steps.filter.outputs.storage }}
2526
image: ${{ steps.filter.outputs.image }}
27+
common: ${{ steps.filter.outputs.common }}
2628
steps:
2729
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2830
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
2931
id: filter
3032
with:
31-
filters: |
32-
storage:
33-
- '.github/workflows/ci.yml'
34-
- 'hack/ci/**'
35-
- 'go.work'
36-
- 'go.work.sum'
37-
- 'storage/**'
38-
image:
39-
- '.github/workflows/ci.yml'
40-
- 'hack/ci/**'
41-
- 'go.work'
42-
- 'go.work.sum'
43-
- 'storage/**'
44-
- 'image/**'
33+
filters: .github/filters.yaml
4534

4635
validate:
4736
uses: ./.github/workflows/validate.yml
4837

4938
storage-test:
5039
needs: [path-filter, validate]
51-
if: github.event_name == 'push' || needs.path-filter.outputs.storage == 'true'
40+
if: |
41+
github.event_name != 'pull_request' ||
42+
needs.path-filter.outputs.all == 'true' ||
43+
needs.path-filter.outputs.storage == 'true'
5244
name: "storage ${{ matrix.distro }} ${{ matrix.driver }}"
5345
strategy:
5446
fail-fast: false
@@ -68,7 +60,10 @@ jobs:
6860

6961
storage-cross:
7062
needs: [path-filter, validate]
71-
if: github.event_name == 'push' || needs.path-filter.outputs.storage == 'true'
63+
if: |
64+
github.event_name != 'pull_request' ||
65+
needs.path-filter.outputs.all == 'true' ||
66+
needs.path-filter.outputs.storage == 'true'
7267
runs-on: ubuntu-24.04
7368
timeout-minutes: 10
7469
name: "Storage: Cross"
@@ -84,7 +79,10 @@ jobs:
8479

8580
image-cross:
8681
needs: [path-filter, validate]
87-
if: github.event_name == 'push' || needs.path-filter.outputs.image == 'true'
82+
if: |
83+
github.event_name != 'pull_request' ||
84+
needs.path-filter.outputs.all == 'true' ||
85+
needs.path-filter.outputs.image == 'true'
8886
runs-on: ubuntu-24.04
8987
timeout-minutes: 10
9088
name: "Image: Cross"
@@ -104,7 +102,10 @@ jobs:
104102

105103
image-test:
106104
needs: [path-filter, validate]
107-
if: github.event_name == 'push' || needs.path-filter.outputs.image == 'true'
105+
if: |
106+
github.event_name != 'pull_request' ||
107+
needs.path-filter.outputs.all == 'true' ||
108+
needs.path-filter.outputs.image == 'true'
108109
name: "${{ matrix.module }} fedora-current ${{ matrix.variant }}"
109110
strategy:
110111
fail-fast: false
@@ -121,6 +122,10 @@ jobs:
121122

122123
common-test:
123124
needs: [path-filter, validate]
125+
if: |
126+
github.event_name != 'pull_request' ||
127+
needs.path-filter.outputs.all == 'true' ||
128+
needs.path-filter.outputs.common == 'true'
124129
name: "common fedora-current"
125130
uses: ./.github/workflows/lima.yml
126131
with:

0 commit comments

Comments
 (0)