Skip to content

Commit d2d26a4

Browse files
authored
Merge pull request #934 from Luap99/ci
CI: various small improvements
2 parents e5b18b5 + d3b00e0 commit d2d26a4

8 files changed

Lines changed: 222 additions & 153 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: 66 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,38 @@ on:
1010
- main
1111
- podman-*
1212

13-
permissions: read-all
13+
permissions:
14+
contents: read
1415

1516
concurrency:
1617
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1718
cancel-in-progress: true
1819

19-
env:
20-
LIMA_VERSION: "v2.1.1"
21-
2220
jobs:
2321
path-filter:
2422
runs-on: ubuntu-24.04
2523
outputs:
24+
all: ${{ steps.filter.outputs.all }}
2625
storage: ${{ steps.filter.outputs.storage }}
2726
image: ${{ steps.filter.outputs.image }}
27+
common: ${{ steps.filter.outputs.common }}
2828
steps:
29-
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
29+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
3030
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
3131
id: filter
3232
with:
33-
filters: |
34-
storage:
35-
- '.github/workflows/ci.yml'
36-
- 'hack/ci/**'
37-
- 'go.work'
38-
- 'go.work.sum'
39-
- 'storage/**'
40-
image:
41-
- '.github/workflows/ci.yml'
42-
- 'hack/ci/**'
43-
- 'go.work'
44-
- 'go.work.sum'
45-
- 'storage/**'
46-
- 'image/**'
33+
filters: .github/filters.yaml
34+
35+
validate:
36+
uses: ./.github/workflows/validate.yml
4737

4838
storage-test:
49-
needs: path-filter
50-
if: github.event_name == 'push' || needs.path-filter.outputs.storage == 'true'
51-
runs-on: cncf-ubuntu-8-32-x86
52-
timeout-minutes: 30
39+
needs: [path-filter, validate]
40+
if: |
41+
github.event_name != 'pull_request' ||
42+
needs.path-filter.outputs.all == 'true' ||
43+
needs.path-filter.outputs.storage == 'true'
44+
name: "storage ${{ matrix.distro }} ${{ matrix.driver }}"
5345
strategy:
5446
fail-fast: false
5547
matrix:
@@ -58,36 +50,26 @@ jobs:
5850
exclude:
5951
- distro: debian-sid
6052
driver: overlay-transient
61-
name: "Storage: ${{ matrix.distro }} ${{ matrix.driver }}"
62-
steps:
63-
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
64-
with:
65-
persist-credentials: false
66-
- uses: lima-vm/lima-actions/setup@55627e31b78637bf254a8b2a14da8ea7d12564e5 # v1.1.0
67-
with:
68-
version: ${{ env.LIMA_VERSION }}
69-
- name: Run tests
70-
run: ./hack/ci/ci.sh storage ${{ matrix.distro }} ${{ matrix.driver }}
71-
- name: Upload logs
72-
if: always()
73-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
74-
with:
75-
name: "logs-storage-${{ matrix.distro }}-${{ matrix.driver }}"
76-
path: |
77-
./hack/ci/journal.log
78-
./hack/ci/audit.log
79-
./hack/ci/df.log
80-
if-no-files-found: ignore
53+
uses: ./.github/workflows/lima.yml
54+
with:
55+
runner: cncf-ubuntu-2-8-x86
56+
module: storage
57+
distro: ${{ matrix.distro }}
58+
variant: ${{ matrix.driver }}
59+
timeout: 20
8160

8261
storage-cross:
83-
needs: path-filter
84-
if: github.event_name == 'push' || needs.path-filter.outputs.storage == 'true'
62+
needs: [path-filter, validate]
63+
if: |
64+
github.event_name != 'pull_request' ||
65+
needs.path-filter.outputs.all == 'true' ||
66+
needs.path-filter.outputs.storage == 'true'
8567
runs-on: ubuntu-24.04
86-
timeout-minutes: 15
68+
timeout-minutes: 10
8769
name: "Storage: Cross"
8870
steps:
89-
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
90-
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
71+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
72+
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
9173
with:
9274
go-version: stable
9375
cache-dependency-path: "./storage/go.sum"
@@ -96,14 +78,17 @@ jobs:
9678
run: make cross
9779

9880
image-cross:
99-
needs: path-filter
100-
if: github.event_name == 'push' || needs.path-filter.outputs.image == 'true'
81+
needs: [path-filter, validate]
82+
if: |
83+
github.event_name != 'pull_request' ||
84+
needs.path-filter.outputs.all == 'true' ||
85+
needs.path-filter.outputs.image == 'true'
10186
runs-on: ubuntu-24.04
102-
timeout-minutes: 15
87+
timeout-minutes: 10
10388
name: "Image: Cross"
10489
steps:
105-
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
106-
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
90+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
91+
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
10792
with:
10893
go-version: stable
10994
cache-dependency-path: "./image/go.sum"
@@ -116,99 +101,50 @@ jobs:
116101
run: make cross
117102

118103
image-test:
119-
needs: path-filter
120-
if: github.event_name == 'push' || needs.path-filter.outputs.image == 'true'
121-
runs-on: cncf-ubuntu-8-32-x86
122-
timeout-minutes: 30
104+
needs: [path-filter, validate]
105+
if: |
106+
github.event_name != 'pull_request' ||
107+
needs.path-filter.outputs.all == 'true' ||
108+
needs.path-filter.outputs.image == 'true'
109+
name: "${{ matrix.module }} fedora-current ${{ matrix.variant }}"
123110
strategy:
124111
fail-fast: false
125112
matrix:
126113
variant: [default, openpgp, sequoia]
127-
name: "Image: Test ${{ matrix.variant }}"
128-
steps:
129-
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
130-
with:
131-
persist-credentials: false
132-
- uses: lima-vm/lima-actions/setup@55627e31b78637bf254a8b2a14da8ea7d12564e5 # v1.1.0
133-
with:
134-
version: ${{ env.LIMA_VERSION }}
135-
- name: Run tests
136-
run: ./hack/ci/ci.sh image fedora-current ${{ matrix.variant }}
137-
- name: Upload logs
138-
if: always()
139-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
140-
with:
141-
name: "logs-image-${{ matrix.variant }}"
142-
path: |
143-
./hack/ci/journal.log
144-
./hack/ci/audit.log
145-
./hack/ci/df.log
146-
if-no-files-found: ignore
147-
148-
image-test-skopeo:
149-
needs: path-filter
150-
if: github.event_name == 'push' || needs.path-filter.outputs.image == 'true'
151-
runs-on: cncf-ubuntu-8-32-x86
152-
timeout-minutes: 30
153-
strategy:
154-
fail-fast: false
155-
matrix:
156-
variant: [default, openpgp, sequoia]
157-
name: "Image: Skopeo ${{ matrix.variant }}"
158-
steps:
159-
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
160-
with:
161-
persist-credentials: false
162-
- uses: lima-vm/lima-actions/setup@55627e31b78637bf254a8b2a14da8ea7d12564e5 # v1.1.0
163-
with:
164-
version: ${{ env.LIMA_VERSION }}
165-
- name: Run tests
166-
run: ./hack/ci/ci.sh image-skopeo fedora-current ${{ matrix.variant }}
167-
- name: Upload logs
168-
if: always()
169-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
170-
with:
171-
name: "logs-image-skopeo-${{ matrix.variant }}"
172-
path: |
173-
./hack/ci/journal.log
174-
./hack/ci/audit.log
175-
./hack/ci/df.log
176-
if-no-files-found: ignore
114+
module: [image, image-skopeo]
115+
uses: ./.github/workflows/lima.yml
116+
with:
117+
runner: cncf-ubuntu-2-8-x86
118+
module: ${{ matrix.module }}
119+
distro: fedora-current
120+
variant: ${{ matrix.variant }}
121+
timeout: 20
177122

178123
common-test:
179-
runs-on: cncf-ubuntu-8-32-x86
180-
timeout-minutes: 45
181-
name: "Common: Test"
182-
steps:
183-
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
184-
with:
185-
persist-credentials: false
186-
- uses: lima-vm/lima-actions/setup@55627e31b78637bf254a8b2a14da8ea7d12564e5 # v1.1.0
187-
with:
188-
version: ${{ env.LIMA_VERSION }}
189-
- name: Run tests
190-
run: ./hack/ci/ci.sh common fedora-current
191-
- name: Upload logs
192-
if: always()
193-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
194-
with:
195-
name: "logs-common"
196-
path: |
197-
./hack/ci/journal.log
198-
./hack/ci/audit.log
199-
./hack/ci/df.log
200-
if-no-files-found: ignore
124+
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'
129+
name: "common fedora-current"
130+
uses: ./.github/workflows/lima.yml
131+
with:
132+
runner: cncf-ubuntu-2-8-x86
133+
module: common
134+
distro: fedora-current
135+
timeout: 20
201136

202137
# N/B: GitHub merge protection is configured for this exact job name, DO NOT CHANGE IT.
203138
success:
204139
name: "Total Success"
205140
if: always()
206141
needs:
142+
- path-filter
143+
- validate
207144
- storage-test
208145
- storage-cross
209146
- image-cross
210147
- image-test
211-
- image-test-skopeo
212148
- common-test
213149
runs-on: ubuntu-24.04
214150
steps:

.github/workflows/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ jobs:
1010
pull-requests: write
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/labeler@v6
13+
- uses: actions/labeler@f27b608878404679385c85cfa523b85ccb86e213 # v6.1.0

.github/workflows/lima.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: lima
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
module:
7+
required: true
8+
type: string
9+
distro:
10+
required: true
11+
type: string
12+
variant:
13+
required: false
14+
type: string
15+
runner:
16+
required: true
17+
type: string
18+
timeout:
19+
required: false
20+
type: number
21+
22+
permissions:
23+
contents: read
24+
25+
jobs:
26+
lima:
27+
name: lima # main name is set by who spawns this job
28+
runs-on: ${{ inputs.runner }}
29+
timeout-minutes: ${{ inputs.timeout || 20 }} # default to 20m timeout if non specified
30+
steps:
31+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
32+
with:
33+
persist-credentials: false
34+
35+
- uses: lima-vm/lima-actions/setup@55627e31b78637bf254a8b2a14da8ea7d12564e5 # v1.1.0
36+
id: lima
37+
with:
38+
version: v2.1.1
39+
40+
# NOTE, we are not using a cache here as documented in the lima action.
41+
# This is because our VM images are above 5GB and the total github limit is 10 GB which means
42+
# it will clean out the other image basically right away making the cache useless for other tasks.
43+
# Also most importantly while testing it the cache was slower, the VM images are hosted in the
44+
# oracle cloud bucket which is already local to the oracle CI runners unlike the cache which is
45+
# stored by github somewhere else.
46+
47+
- name: Run test on lima
48+
run: | # zizmor: ignore[template-injection]
49+
./hack/ci/ci.sh ${{ inputs.module }} ${{ inputs.distro }} ${{ inputs.variant }}
50+
51+
- name: Upload logs
52+
if: always()
53+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
54+
with:
55+
name: "logs-${{ inputs.module }}-${{ inputs.distro }}-${{ inputs.variant }}"
56+
path: |
57+
./hack/ci/journal.log
58+
./hack/ci/audit.log
59+
./hack/ci/df.log
60+
if-no-files-found: ignore

0 commit comments

Comments
 (0)