diff --git a/.github/workflows/unit_test.yml b/.github/workflows/unit_test.yml index 4fb73b76..521f7f32 100644 --- a/.github/workflows/unit_test.yml +++ b/.github/workflows/unit_test.yml @@ -81,7 +81,22 @@ jobs: bundler-cache: true - name: Update gems run: bundle update - - name: install podman - run: sudo ./script/install_podman.sh + - name: Start rootless Podman API service + run: | + mkdir -p "${HOME}/var/run" + podman system service unix://${HOME}/var/run/podman.sock --time=0 & + echo $! > $HOME/podman_service.pid + # Wait until the socket is ready + for i in $(seq 1 20); do + if podman --url unix://${HOME}/var/run/podman.sock info >/dev/null 2>&1 ; then + echo "Podman socket ready"; break + fi + echo "Waiting for podman socket…" + sleep 1 + done + - name: Point Docker-API at Podman + run: | + echo "DOCKER_HOST=unix://${HOME}/var/run/podman.sock" >> $GITHUB_ENV + echo "EXPECT_PODMAN=true" >> $GITHUB_ENV - name: spec tests run: bundle exec rake diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8be80cab..8b8d2f50 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,6 +13,17 @@ require 'docker' +# Hard-fail the build if we said we expected Podman but did not get it +if (ENV['EXPECT_PODMAN'] == 'true') && !Docker.podman? + warn <<~MSG + EXPECT_PODMAN=true was set, but Docker.podman? returned false. + Connected engine information: + #{Docker.version} + Make sure the Podman API socket is running and DOCKER_HOST points to it. + MSG + exit 1 +end + ENV['DOCKER_API_USER'] ||= 'debbie_docker' ENV['DOCKER_API_PASS'] ||= '*************' ENV['DOCKER_API_EMAIL'] ||= 'debbie_docker@example.com'