Skip to content

Commit 5b1b18e

Browse files
authored
Merge pull request #6884 from timcoding1988/ci/gha-lima
new gha ci with lima
2 parents 5713383 + 9c9519b commit 5b1b18e

17 files changed

Lines changed: 521 additions & 1132 deletions

.cirrus.yml

Lines changed: 0 additions & 415 deletions
This file was deleted.

.github/filters.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
code:
2+
- '**/*.go'
3+
- 'go.mod'
4+
- 'go.sum'
5+
- 'vendor/**'
6+
- 'Makefile'
7+
- '.github/**'
8+
- 'contrib/ci/**'
9+
- 'hack/**'
10+
- 'tests/**'
11+
- '.codespellrc'
12+
- '.golangci.yml'

.github/workflows/check_cirrus_cron.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
name: "ci"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
permissions: {}
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
path-filter:
19+
name: path-filter
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 5
22+
permissions:
23+
pull-requests: read
24+
outputs:
25+
code: ${{ steps.filter.outputs.code }}
26+
steps:
27+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
28+
with:
29+
persist-credentials: false
30+
- id: filter
31+
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
32+
with:
33+
filters: .github/filters.yaml
34+
35+
smoke:
36+
name: smoke
37+
uses: ./.github/workflows/lima.yml
38+
with:
39+
runner: cncf-ubuntu-4-16-x86
40+
test: smoke
41+
distro: fedora-current
42+
timeout: 20
43+
44+
vendor:
45+
name: vendor
46+
uses: ./.github/workflows/lima.yml
47+
with:
48+
runner: cncf-ubuntu-4-16-x86
49+
test: vendor
50+
distro: fedora-current
51+
timeout: 20
52+
53+
cross:
54+
name: cross
55+
runs-on: cncf-ubuntu-8-32-x86
56+
timeout-minutes: 30
57+
steps:
58+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
59+
with:
60+
persist-credentials: false
61+
62+
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
63+
with:
64+
go-version-file: go.mod
65+
cache: true
66+
67+
- name: Build all cross targets
68+
run: make -j4 cross CGO_ENABLED=0
69+
70+
unit:
71+
needs: [smoke, vendor, path-filter]
72+
if: needs.path-filter.outputs.code == 'true' || github.event_name != 'pull_request'
73+
name: unit ${{ matrix.storage }}
74+
strategy:
75+
fail-fast: false
76+
matrix:
77+
storage: [vfs, overlay]
78+
uses: ./.github/workflows/lima.yml
79+
with:
80+
runner: cncf-ubuntu-4-16-x86
81+
test: unit
82+
storage: ${{ matrix.storage }}
83+
priv: root
84+
distro: fedora-current
85+
timeout: 60
86+
87+
conformance:
88+
needs: [smoke, vendor, path-filter]
89+
if: needs.path-filter.outputs.code == 'true' || github.event_name != 'pull_request'
90+
name: conformance ${{ matrix.storage }}
91+
strategy:
92+
fail-fast: false
93+
matrix:
94+
storage: [vfs, overlay]
95+
uses: ./.github/workflows/lima.yml
96+
with:
97+
runner: cncf-ubuntu-8-32-x86
98+
test: conformance
99+
storage: ${{ matrix.storage }}
100+
priv: root
101+
distro: debian-sid
102+
timeout: 40
103+
104+
integration:
105+
needs: [smoke, vendor, path-filter]
106+
if: needs.path-filter.outputs.code == 'true' || github.event_name != 'pull_request'
107+
name: integration ${{ matrix.storage }} ${{ matrix.priv }} ${{ matrix.distro }}
108+
strategy:
109+
fail-fast: false
110+
matrix:
111+
distro: [fedora-current, fedora-prior, debian-sid]
112+
storage: [vfs, overlay]
113+
priv: [root, rootless]
114+
exclude:
115+
- storage: vfs
116+
priv: rootless
117+
- distro: debian-sid
118+
priv: rootless
119+
# Skip rootless+overlay: upstream Cirrus's PASSTHROUGH_ENV_RE drops
120+
# STORAGE_DRIVER through SSH re-exec to rootlessuser, so their
121+
# "Integration rootless ... w/ overlay" task silently tests vfs.
122+
# When we propagate STORAGE_DRIVER properly, we expose a real
123+
# rootless+overlay cleanup bug in buildah's storage code
124+
# ("replacing mount point .../merged: directory not empty").
125+
# Skip these cells until that's fixed upstream.
126+
- storage: overlay
127+
priv: rootless
128+
include:
129+
- storage: overlay
130+
priv: root
131+
distro: fedora-rawhide
132+
uses: ./.github/workflows/lima.yml
133+
with:
134+
runner: cncf-ubuntu-8-32-x86
135+
test: integration
136+
storage: ${{ matrix.storage }}
137+
priv: ${{ matrix.priv }}
138+
distro: ${{ matrix.distro }}
139+
timeout: 60
140+
141+
in_podman:
142+
needs: [smoke, vendor, path-filter]
143+
if: needs.path-filter.outputs.code == 'true' || github.event_name != 'pull_request'
144+
name: in_podman
145+
uses: ./.github/workflows/lima.yml
146+
with:
147+
runner: cncf-ubuntu-8-32-x86
148+
test: in_podman
149+
storage: vfs
150+
priv: root
151+
distro: fedora-current
152+
timeout: 60
153+
154+
mac:
155+
needs: [smoke, vendor]
156+
name: build (darwin)
157+
runs-on: macos-15
158+
timeout-minutes: 30
159+
steps:
160+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
161+
with:
162+
persist-credentials: false
163+
164+
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
165+
with:
166+
go-version-file: go.mod
167+
cache: true
168+
169+
- name: Build darwin/arm64
170+
run: make bin/buildah.darwin.arm64
171+
172+
- name: Build darwin/amd64
173+
run: make bin/buildah.darwin.amd64
174+
175+
- name: Upload artifacts
176+
if: always()
177+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
178+
with:
179+
name: buildah-darwin
180+
path: bin/buildah.darwin.*
181+
if-no-files-found: error
182+
183+
success:
184+
name: "Total Success"
185+
if: always()
186+
needs:
187+
- path-filter
188+
- smoke
189+
- vendor
190+
- cross
191+
- unit
192+
- conformance
193+
- integration
194+
- in_podman
195+
- mac
196+
runs-on: ubuntu-latest
197+
steps:
198+
- name: Check all required jobs
199+
run: |
200+
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]] || \
201+
[[ "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
202+
echo "One or more required jobs failed or were cancelled"
203+
exit 1
204+
fi
205+
echo "All required jobs passed or were skipped"

.github/workflows/lima.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: lima
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
distro:
7+
required: true
8+
type: string
9+
test:
10+
required: true
11+
type: string
12+
priv:
13+
required: false
14+
type: string
15+
storage:
16+
required: false
17+
type: string
18+
runner:
19+
required: true
20+
type: string
21+
timeout:
22+
required: false
23+
type: number
24+
25+
permissions: {}
26+
27+
jobs:
28+
lima:
29+
name: ${{ inputs.test }} ${{ inputs.storage || '' }} ${{ inputs.priv || '' }} ${{ inputs.distro }}
30+
runs-on: ${{ inputs.runner }}
31+
timeout-minutes: ${{ inputs.timeout || 20 }}
32+
permissions: {}
33+
steps:
34+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
35+
with:
36+
persist-credentials: false
37+
fetch-depth: 50
38+
39+
- name: Fetch base ref for merge-base
40+
run: git fetch --depth=50 origin main:refs/remotes/origin/main || true
41+
42+
- uses: lima-vm/lima-actions/setup@55627e31b78637bf254a8b2a14da8ea7d12564e5 # v1.1.0
43+
id: lima
44+
with:
45+
version: v2.1.1
46+
47+
- name: Run test on lima
48+
run: | # zizmor: ignore[template-injection]
49+
./contrib/ci/ci.sh ${{ inputs.test }} ${{ inputs.storage }} ${{ inputs.priv }} ${{ inputs.distro }}
50+
51+
- name: Upload journal as artifact
52+
if: always()
53+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
54+
with:
55+
name: "journal-${{ inputs.test }}-${{ inputs.storage }}-${{ inputs.priv }}-${{ inputs.distro }}.log"
56+
path: "./contrib/ci/journal.log"
57+
if-no-files-found: ignore

contrib/ci/ci.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
3+
set -eo pipefail
4+
5+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" && pwd )
6+
7+
source "$SCRIPT_DIR/lib.sh"
8+
9+
AUTOMATION_RELEASE="${AUTOMATION_RELEASE:-20260520t200858z}"
10+
LIMA_VM_NAME=buildah-ci
11+
12+
REPO_DIR="$SCRIPT_DIR/../.."
13+
14+
parse_args "$@"
15+
16+
IMAGE="$DISTRO_NAME.x86_64.qcow2.zst"
17+
18+
IMAGE_URL_BASE="${IMAGE_URL_BASE:-https://objectstorage.us-ashburn-1.oraclecloud.com/n/id0lmbbwgcdv/b/podman-ci-vm-images/o/releases}"
19+
IMAGE_URL="$IMAGE_URL_BASE/$AUTOMATION_RELEASE/$IMAGE"
20+
21+
trap "limactl delete --force $LIMA_VM_NAME" EXIT
22+
23+
limactl --yes start --plain --name=$LIMA_VM_NAME --cpus $(nproc) --memory 8 --disk 150 --nested-virt \
24+
--set ".images=[{\"location\":\"$IMAGE_URL\", \"arch\": \"x86_64\"}]" \
25+
"$SCRIPT_DIR/template.lima.yml"
26+
27+
limactl copy "$REPO_DIR" $LIMA_VM_NAME:/var/tmp/buildah
28+
29+
set +e
30+
31+
limactl shell --workdir /var/tmp/buildah $LIMA_VM_NAME ./contrib/ci/runner.sh "${@}"
32+
rc=$?
33+
34+
limactl shell --workdir /var/tmp/buildah $LIMA_VM_NAME sudo contrib/ci/logcollector.sh journal &> "$SCRIPT_DIR/journal.log"
35+
36+
exit $rc

0 commit comments

Comments
 (0)