Skip to content

Commit f48af42

Browse files
committed
split test on podam and docker into 2 separate jobs
1 parent 95fd5b3 commit f48af42

File tree

1 file changed

+44
-32
lines changed

1 file changed

+44
-32
lines changed

.github/workflows/tests.yml

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
name: Run tests
22

3-
on: ["push", "pull_request"]
3+
on: [push, pull_request]
44

55
jobs:
6-
test:
6+
docker-tests:
77
strategy:
88
matrix:
99
os: [ubuntu-latest, macos-latest]
1010
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
11-
runtime: ["docker", "podman"]
1211
runs-on: ${{ matrix.os }}
12+
name: Docker / ${{ matrix.os }} / Python ${{ matrix.python-version }}
1313

1414
steps:
1515
- uses: actions/checkout@v3
1616

17-
- name: Set up Python ${{ matrix.python-version }}
17+
- name: Set up Python
1818
uses: actions/setup-python@v3
1919
with:
2020
python-version: ${{ matrix.python-version }}
@@ -24,10 +24,9 @@ jobs:
2424
python -m pip install --upgrade pip
2525
pip install hatch
2626
27-
- name: Install and run Docker (Ubuntu only)
27+
- name: Install Docker CE (Ubuntu)
2828
if: matrix.os == 'ubuntu-latest'
2929
run: |
30-
# Install Docker
3130
sudo apt-get update
3231
sudo apt-get install -y \
3332
ca-certificates \
@@ -43,50 +42,63 @@ jobs:
4342
sudo apt-get update
4443
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
4544
sudo systemctl start docker
46-
sudo usermod -aG docker $USER
4745
docker --version
4846
49-
- name: Install and run Docker (macOS only)
47+
- name: Install Docker (macOS)
5048
if: matrix.os == 'macos-latest'
5149
run: |
5250
brew install --cask docker
53-
open /Applications/Docker.app
54-
sleep 30 # Wait for Docker to start
55-
until docker info; do
56-
echo "Waiting for Docker to start..."
57-
sleep 5
58-
done
51+
open --background -a Docker
52+
echo "Waiting for Docker to start..."
53+
while ! docker system info > /dev/null 2>&1; do sleep 2; done
54+
docker --version
55+
56+
- name: Run tests (Docker)
57+
run: |
58+
hatch run ci
59+
60+
podman-tests:
61+
needs: docker-tests
62+
strategy:
63+
matrix:
64+
os: [ubuntu-latest, macos-latest]
65+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
66+
runs-on: ${{ matrix.os }}
67+
name: Podman / ${{ matrix.os }} / Python ${{ matrix.python-version }}
68+
69+
steps:
70+
- uses: actions/checkout@v3
71+
72+
- name: Set up Python
73+
uses: actions/setup-python@v3
74+
with:
75+
python-version: ${{ matrix.python-version }}
76+
77+
- name: Install dependencies
78+
run: |
79+
python -m pip install --upgrade pip
80+
pip install hatch
5981
60-
- name: Install and run Podman (Ubuntu only)
82+
- name: Install Podman (Ubuntu)
6183
if: matrix.os == 'ubuntu-latest'
6284
run: |
6385
sudo apt-get update
6486
sudo apt-get install -y podman
65-
podman system migrate
66-
# Ensure rootless Podman is running
67-
# This is a workaround for the GitHub Actions environment
68-
# to ensure Podman can run without root privileges
69-
if ! podman info --format '{{.Host.RemoteSocket.Path}}' | grep -q '/run/user/0/podman/podman.sock'; then
70-
echo "Starting Podman in rootless mode..."
71-
podman system service -t 0 &
72-
sleep 5 # Wait for Podman to start
73-
fi
87+
echo "Waiting for Podman socket..."
88+
until podman info > /dev/null 2>&1; do sleep 2; done
7489
podman --version
7590
76-
- name: Install and run Podman (macOS only)
91+
- name: Install Podman (macOS)
7792
if: matrix.os == 'macos-latest'
7893
run: |
7994
brew install podman
8095
podman machine init || true
8196
podman machine start
97+
echo "Waiting for Podman to start..."
98+
until podman info > /dev/null 2>&1; do sleep 2; done
8299
podman --version
83100
84-
- name: Run tests
101+
- name: Run tests (Podman)
85102
run: |
86-
if [ "${{ matrix.runtime }}" == "podman" ]; then
87-
echo "Using Podman for testing"
88-
export DBTESTTOOLS_USE_PODMAN=1
89-
else
90-
echo "Using Docker for testing"
91-
fi
103+
export DBTESTTOOLS_USE_PODMAN=1
92104
hatch run ci

0 commit comments

Comments
 (0)