Skip to content

Commit ec5c99d

Browse files
committed
ci: Mac CI with self-hosted runner for machine tests
Signed-off-by: Tim Zhou <tizhou@redhat.com>
1 parent 18acc61 commit ec5c99d

3 files changed

Lines changed: 143 additions & 145 deletions

File tree

.github/workflows/mac-pkg.yml

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

.github/workflows/mac.yml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Mac
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- '.github/workflows/mac.yml'
8+
- 'Makefile'
9+
- 'contrib/gha/mac/**'
10+
- 'vendor/**'
11+
- 'test/tools/**'
12+
- 'test/registries*.conf'
13+
- 'hack/**'
14+
- 'version/rawversion/*'
15+
- 'cmd/podman/machine/**'
16+
- 'pkg/machine/**'
17+
- '**/*machine*.go'
18+
19+
permissions:
20+
contents: read
21+
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.ref }}
24+
cancel-in-progress: true
25+
26+
jobs:
27+
build:
28+
name: build (darwin arm64)
29+
runs-on: macos-15
30+
timeout-minutes: 30
31+
steps:
32+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
33+
with:
34+
persist-credentials: false
35+
36+
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
37+
with:
38+
go-version-file: go.mod
39+
cache: true
40+
41+
- name: Cache golangci-lint
42+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
43+
with:
44+
path: ~/Library/Caches/golangci-lint
45+
key: ${{ runner.os }}-golangci-${{ hashFiles('**/go.sum', '**/.golangci.yml') }}
46+
restore-keys: |
47+
${{ runner.os }}-golangci-
48+
49+
- name: Lint
50+
run: make golangci-lint
51+
52+
- name: Build core binaries
53+
run: |
54+
make .install.ginkgo
55+
make podman-remote
56+
make podman-mac-helper
57+
58+
- name: Upload test binaries
59+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
60+
with:
61+
name: podman-bin
62+
path: |
63+
bin/ginkgo
64+
bin/darwin/podman
65+
bin/darwin/podman-mac-helper
66+
if-no-files-found: error
67+
68+
- name: Build .pkg installer
69+
run: |
70+
pushd contrib/pkginstaller
71+
make ARCH=aarch64 NO_CODESIGN=1 pkginstaller
72+
popd
73+
74+
- name: Build release zip
75+
run: make podman-remote-release-darwin_arm64.zip
76+
77+
- name: Upload release artifacts
78+
if: always()
79+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
80+
with:
81+
name: podman-darwin-arm64
82+
path: |
83+
podman-remote-release-darwin_arm64.zip
84+
contrib/pkginstaller/out/podman-installer-macos-*.pkg
85+
if-no-files-found: error
86+
87+
machine:
88+
name: machine (${{ matrix.provider }})
89+
needs: build
90+
runs-on: [self-hosted, macOS, ARM64]
91+
timeout-minutes: 60
92+
strategy:
93+
fail-fast: false
94+
matrix:
95+
provider: [applehv, libkrun]
96+
env:
97+
PROVIDER: ${{ matrix.provider }}
98+
CONTAINERS_MACHINE_PROVIDER: ${{ matrix.provider }}
99+
# machine_test.go rejects TMPDIR >= 22 chars on darwin (socket path budget).
100+
TMPDIR: /private/tmp
101+
102+
steps:
103+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
104+
with:
105+
persist-credentials: false
106+
107+
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
108+
with:
109+
go-version-file: go.mod
110+
cache: true
111+
112+
- name: Pre-clean machine state
113+
run: ./contrib/gha/mac/clean_state.sh
114+
115+
- name: Download test binaries
116+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
117+
with:
118+
name: podman-bin
119+
120+
- name: Restore executable bits
121+
run: chmod +x bin/ginkgo bin/darwin/podman bin/darwin/podman-mac-helper
122+
123+
- name: Run machine e2e
124+
run: make localmachine
125+
126+
- name: Post-run cleanup
127+
if: always()
128+
run: ./contrib/gha/mac/clean_state.sh

contrib/gha/mac/clean_state.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
# Best-effort cleanup of podman machine state and leaked test processes.
3+
4+
set +e
5+
6+
pkill -f vfkit 2>/dev/null || true
7+
pkill -f krunkit 2>/dev/null || true
8+
pkill -f gvproxy 2>/dev/null || true
9+
pkill -f ginkgo 2>/dev/null || true
10+
11+
rm -rf "$HOME/.local/share/containers/podman/machine" 2>/dev/null || true
12+
rm -rf "$HOME/.config/containers/podman" 2>/dev/null || true
13+
rm -rf "${TMPDIR:-/private/tmp}/podman" 2>/dev/null || true
14+
15+
true

0 commit comments

Comments
 (0)