-
Notifications
You must be signed in to change notification settings - Fork 16
145 lines (125 loc) · 4.79 KB
/
cli-tests.yml
File metadata and controls
145 lines (125 loc) · 4.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# CLI tests: Check that various Makefile targets behave as expected
# (without going deeper into provisioning and such)
name: CLI tests
on:
push:
branches: [master]
pull_request:
branches:
- '**'
jobs:
run_ci:
runs-on: ${{ matrix.os.image }}
env:
DEVSTACK_WORKSPACE: /tmp
SHALLOW_CLONE: 1
# Don't report metrics as real usage
DEVSTACK_METRICS_TESTING: ci
strategy:
matrix:
os:
- name: linux
image: ubuntu-latest
- name: mac
image: macos-14
python-version:
- '3.11'
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Docker installation - Linux
if: ${{ matrix.os.name == 'linux' }}
run: |
docker version
sudo apt-get update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal test"
sudo apt update
sudo apt install docker-ce containerd.io
docker version
docker compose --version
# Note: we cannot use Docker Desktop because it has not been licensed for use in GithubActions
- name: Install QEMU (macOS, arm64)
if: ${{ matrix.os.name == 'mac' }}
run: |
set -euxo pipefail
# Ensure arm64 Homebrew (avoid Rosetta/x86_64 bottles)
/usr/bin/arch -arm64 /bin/zsh -lc '
export PATH=/opt/homebrew/bin:/opt/homebrew/sbin:$PATH
brew update
brew install qemu
which qemu-img
qemu-img --version
'
- name: Docker installation - Mac
if: ${{ matrix.os.name == 'mac' }}
run: |
set -euxo pipefail
# Ensure we run under arm64 and use the arm64 Homebrew prefix (/opt/homebrew)
/usr/bin/arch -arm64 /bin/zsh -lc '
export PATH=/opt/homebrew/bin:/opt/homebrew/sbin:$PATH
# Install required tools (qemu is mandatory for --vm-type=qemu)
brew update
brew install qemu colima docker docker-compose
# Clean stale state to avoid disk conversion/mount issues
colima stop || true
colima delete -f || true
rm -rf "$HOME/.colima" "$HOME/.lima" || true
# Start Colima with QEMU; allocate decent CPUs/RAM and disk for CI
colima start --vm-type=qemu --cpu 4 --memory 8 --runtime docker
# Point Docker CLI to Colima's socket
echo "DOCKER_HOST=unix://${HOME}/.colima/docker.sock" >> "$GITHUB_ENV"
# Compose v2 plugin (link whatever docker-compose brew installed)
mkdir -p ~/.docker/cli-plugins
ln -sfn "$(command -v docker-compose)" ~/.docker/cli-plugins/docker-compose
# Sanity check
docker version
docker info
docker compose version
'
- name: Install Python dependencies
run: make requirements
# proactively download and extract the image to avoid test timeouts in tests/metrics.py
# this should be moved into a test setup
- name: Pull redis docker image
run: make dev.pull.redis
- name: CLI tests
run: pytest -s ./tests/*.py
- name: Repo setup-remotes tests
run: ./tests/test_repo.sh
- name: Dump Colima hostagent logs on failure
if: ${{ failure()}}
run: |
echo "=== DUMPING DOCKER & COMPOSE INFO ==="
docker version || true
docker info || true
docker ps -a || true
docker images || true
echo "=== DUMPING COLIMA LOGS ==="
LOG="$HOME/.colima/_lima/colima/ha.stderr.log"
if [ -f "$LOG" ]; then
echo "==== ha.stderr.log ===="
sed -n '1,400p' "$LOG"
echo "======================="
else
echo "ha.stderr.log not found at $LOG"
find $HOME/.colima -maxdepth 3 -type f -name '*stderr*' -print
fi
- name: Diagnostics (macOS arch & binaries)
if: ${{ failure() && matrix.os.name == 'mac' }}
run: |
echo "===GATHERING DIAGNOSTIC DATA ==="
set -euxo pipefail
uname -a
uname -m
which brew || true
brew --prefix || true
which colima || true
which limactl || true
if command -v colima >/dev/null; then file "$(which colima)"; fi
if command -v limactl >/dev/null; then file "$(which limactl)"; fi