-
Notifications
You must be signed in to change notification settings - Fork 1
ci: Mac CI with self-hosted runner for machine tests #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
timcoding1988
wants to merge
3
commits into
main
Choose a base branch
from
ci/mac-dedicated
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| name: Mac | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| pull_request: | ||
| paths: | ||
| - '.github/workflows/mac.yml' | ||
| - 'Makefile' | ||
| - 'contrib/gha/mac/**' | ||
| - 'vendor/**' | ||
| - 'test/tools/**' | ||
| - 'test/registries*.conf' | ||
| - 'hack/**' | ||
| - 'version/rawversion/*' | ||
| - 'cmd/podman/machine/**' | ||
| - 'pkg/machine/**' | ||
| - '**/*machine*.go' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| name: build (darwin arm64) | ||
| runs-on: macos-15 | ||
| timeout-minutes: 30 | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | ||
| with: | ||
| go-version-file: go.mod | ||
| cache: true | ||
|
|
||
| - name: Cache golangci-lint | ||
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | ||
| with: | ||
| path: ~/Library/Caches/golangci-lint | ||
| key: ${{ runner.os }}-golangci-${{ hashFiles('**/go.sum', '**/.golangci.yml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-golangci- | ||
|
|
||
| - name: Lint | ||
| run: make golangci-lint | ||
|
|
||
| - name: Build core binaries | ||
| run: | | ||
| make .install.ginkgo | ||
| make podman-remote | ||
| make podman-mac-helper | ||
|
|
||
| - name: Upload test binaries | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: podman-bin | ||
| # Single path keeps the `bin/` prefix; a path list would trigger LCA | ||
| # stripping and lose it, breaking chmod in the machine job. | ||
| path: bin | ||
| if-no-files-found: error | ||
|
|
||
| - name: Build .pkg installer | ||
| run: | | ||
| pushd contrib/pkginstaller | ||
| make ARCH=aarch64 NO_CODESIGN=1 pkginstaller | ||
| popd | ||
|
|
||
| - name: Build release zip | ||
| run: make podman-remote-release-darwin_arm64.zip | ||
|
|
||
| - name: Upload release artifacts | ||
| if: always() | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: podman-darwin-arm64 | ||
| path: | | ||
| podman-remote-release-darwin_arm64.zip | ||
| contrib/pkginstaller/out/podman-installer-macos-*.pkg | ||
| if-no-files-found: error | ||
|
|
||
| machine: | ||
| name: machine (${{ matrix.provider }}) | ||
| needs: build | ||
| runs-on: | ||
| group: mac-pool | ||
| timeout-minutes: 60 | ||
| strategy: | ||
| fail-fast: false | ||
| max-parallel: 1 | ||
| matrix: | ||
| provider: [applehv, libkrun] | ||
| env: | ||
| PROVIDER: ${{ matrix.provider }} | ||
| CONTAINERS_MACHINE_PROVIDER: ${{ matrix.provider }} | ||
| # machine_test.go rejects TMPDIR >= 22 chars on darwin (socket path budget). | ||
| TMPDIR: /private/tmp | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | ||
| with: | ||
| go-version-file: go.mod | ||
| cache: true | ||
|
|
||
| - name: Pre-clean machine state | ||
| run: ./contrib/gha/mac/clean_state.sh | ||
|
|
||
| - name: Download test binaries | ||
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | ||
| with: | ||
| name: podman-bin | ||
| # `path: bin` on upload sent the *contents* of bin/ (no prefix). | ||
| # Extract into bin/ to restore the layout. | ||
| path: bin | ||
|
|
||
| - name: Restore executable bits | ||
| run: chmod +x bin/ginkgo bin/darwin/podman bin/darwin/podman-mac-helper | ||
|
|
||
| - name: Run machine e2e | ||
| run: make localmachine | ||
|
|
||
| - name: Post-run cleanup | ||
| if: always() | ||
| run: ./contrib/gha/mac/clean_state.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #!/usr/bin/env bash | ||
| # Best-effort cleanup of podman machine state and leaked test processes. | ||
|
|
||
| set +e | ||
|
|
||
| pkill -f vfkit 2>/dev/null || true | ||
| pkill -f krunkit 2>/dev/null || true | ||
| pkill -f gvproxy 2>/dev/null || true | ||
| pkill -f ginkgo 2>/dev/null || true | ||
|
|
||
| rm -rf "$HOME/.local/share/containers/podman/machine" 2>/dev/null || true | ||
| rm -rf "$HOME/.config/containers/podman" 2>/dev/null || true | ||
| rm -rf "${TMPDIR:-/private/tmp}/podman" 2>/dev/null || true | ||
|
|
||
| true | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can leave this for now, but I think once we set up the github runner, there are pre-and post run hooks we can specify to clean the vm after runs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct. think we can remove this