Podman Mac CI #214
This file contains 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
name: Podman Mac CI | |
on: | |
schedule: | |
- cron: '0 6 * * * ' # Every day at 6:00AM UTC (~midnight CST pending DST) | |
jobs: | |
tests: | |
name: +testing-gha-podman | |
runs-on: macos-13 # GitHub Actions the latest tag still uses macos-11, which does not have brew installed by default | |
env: | |
FORCE_COLOR: 1 | |
EARTHLY_TOKEN: "${{ secrets.EARTHLY_TOKEN }}" | |
EARTHLY_INSTALL_ID: "earthly-githubactions" | |
BUILT_EARTHLY_PATH: build/darwin/amd64/earthly | |
DOCKERHUB_MIRROR_USERNAME: "${{ secrets.DOCKERHUB_MIRROR_USERNAME }}" | |
DOCKERHUB_MIRROR_PASSWORD: "${{ secrets.DOCKERHUB_MIRROR_PASSWORD }}" | |
# Used in our github action as the token - TODO: look to change it into an input | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# matches hardware specs of macos-12 self-hosted machine | |
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources | |
PODMAN_CPUS: 3 | |
PODMAN_MEMORY_MB: 13000 | |
PODMAN_DISK_SPACE_GB: 13 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: earthly/actions-setup@main | |
- name: Install podman | |
run: brew install podman | |
- name: Podman Mac Helper | |
# the $(ls /usr/local/Cellar/podman) fills in the version number | |
run: sudo /usr/local/Cellar/podman/$(ls /usr/local/Cellar/podman)/bin/podman-mac-helper install \ | |
&& echo "DOCKER_HOST=unix:///Users/runner/.local/share/containers/podman/machine/podman-machine-default/podman.sock" >> $GITHUB_ENV | |
- name: Init and start podman machine | |
run: podman machine init --now --cpus ${{ env.PODMAN_CPUS }} --disk-size ${{ env.PODMAN_DISK_SPACE_GB }} --memory ${{ env.PODMAN_MEMORY_MB }} --rootful=true | |
- name: Podman machine ls | |
run: podman machine ls | |
- name: Podman machine inspect | |
run: podman machine inspect podman-machine-default | |
- name: Podman info | |
run: podman info | |
- name: Podman info debug | |
run: podman info --debug | |
- name: Podman version | |
run: podman version | |
- name: Virtualization check | |
run: sysctl -a | grep machdep.cpu.features | |
- name: Docker mirror login via Podman (Earthly Only) | |
run: podman login registry-1.docker.io.mirror.corp.earthly.dev --username "${{ secrets.DOCKERHUB_MIRROR_USERNAME }}" --password "${{ secrets.DOCKERHUB_MIRROR_PASSWORD }}" | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository | |
- name: Configure Earthly to use mirror (Earthly Only) | |
run: |- | |
earthly config global.buildkit_additional_config "'[registry.\"docker.io\"] | |
mirrors = [\"registry-1.docker.io.mirror.corp.earthly.dev\"]'" | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository | |
- name: Bootstrap Earthly using released earthly | |
run: earthly bootstrap | |
- name: Build latest earthly using released earthly | |
run: earthly -P --use-inline-cache +for-darwin | |
- name: Re-bootstrap Earthly using latest earthly build | |
run: ${{ env.BUILT_EARTHLY_PATH }} bootstrap | |
- name: rebuild earthly using latest earthly build | |
run: ${{ env.BUILT_EARTHLY_PATH }} -P --use-inline-cache +for-darwin | |
- name: Set EARTHLY_VERSION_FLAG_OVERRIDES env | |
run: |- | |
set -euo pipefail | |
EARTHLY_VERSION_FLAG_OVERRIDES="$(tr -d '\n' < .earthly_version_flag_overrides)" | |
echo "EARTHLY_VERSION_FLAG_OVERRIDES=$EARTHLY_VERSION_FLAG_OVERRIDES" >> "$GITHUB_ENV" | |
# Note - we only run the non-qemu tests here because we have not figured out cross-compilation on Mac using Podman yet | |
- name: Execute tests-no-qemu | |
run: ${{env.BUILT_EARTHLY_PATH}} --ci -P +test-no-qemu | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository | |
- name: Execute fail test | |
run: "! ${{ env.BUILT_EARTHLY_PATH }} --ci ./tests/fail+test-fail" | |
- name: Buildkit logs (runs on failure) | |
run: podman logs earthly-buildkitd | |
if: ${{ failure() }} |