Skip to content

Commit b371c42

Browse files
authored
Merge pull request #1907 from dbcli/RW/set-up-wsl-ci
CI tests for WSL
2 parents a8abf67 + f00d83d commit b371c42

3 files changed

Lines changed: 73 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,83 @@ jobs:
135135
mysql-version: '9.7'
136136
root-password: root
137137

138-
- name: Pytest / behave
138+
- name: Run pytest
139139
env:
140140
PYTEST_PASSWORD: root
141141
PYTEST_HOST: 127.0.0.1
142142
run: |
143143
uv run -- coverage run -m pytest
144144
uv run -- coverage report -m --sort=Miss --skip-covered --skip-empty
145145
146+
tests-wsl:
147+
name: Tests WSL
148+
runs-on: windows-latest
149+
150+
steps:
151+
- uses: vampire/setup-wsl@d1da7f2c0322a5ee4f24975344f67fc0f5baf364 # v7.0.0
152+
with:
153+
distribution: Ubuntu-24.04
154+
update: 'true'
155+
additional-packages: |
156+
curl
157+
git
158+
mysql-server
159+
pkg-config
160+
build-essential
161+
python3-pip
162+
163+
- name: Create working directory
164+
shell: wsl-bash {0}
165+
run: |
166+
mkdir -p /root/mycli
167+
168+
- uses: ubuntu/wsl/.github/actions/wsl-checkout@86f464de45987910a3d1aa9d1237ac244a32f811
169+
with:
170+
distro: Ubuntu-24.04
171+
working-dir: /root/mycli
172+
173+
- name: Install uv
174+
shell: wsl-bash {0}
175+
run: |
176+
export PATH="$HOME/.local/bin:$PATH"
177+
env PYTHONPATH=/usr/local/lib/python3.14/site-packages pip install --upgrade --break-system-packages --prefix=/usr uv
178+
179+
- name: Install dependencies
180+
shell: wsl-bash {0}
181+
run: |
182+
export PATH="$HOME/.local/bin:$PATH"
183+
cd /root/mycli
184+
uv sync --all-extras --python 3.14
185+
186+
- name: Start MySQL in WSL
187+
shell: wsl-bash {0}
188+
run: |
189+
sudo service mysql start
190+
191+
- name: Wait for MySQL connection
192+
shell: wsl-bash {0}
193+
run: |
194+
while ! mysqladmin ping --host=localhost --port=3306 --user=root --silent; do
195+
sleep 5
196+
done
197+
198+
- name: Set up MySQL
199+
shell: wsl-bash {0}
200+
run: |
201+
mysqladmin -u root password root
202+
203+
- name: Run pytest
204+
shell: wsl-bash {0}
205+
env:
206+
PYTEST_HOST: 127.0.0.1
207+
PYTEST_USER: root
208+
PYTEST_PASSWORD: root
209+
run: |
210+
export PATH="$HOME/.local/bin:$PATH"
211+
cd /root/mycli
212+
uv run --python 3.14 -- coverage run -m pytest
213+
uv run --python 3.14 -- coverage report -m --sort=Miss --skip-covered --skip-empty
214+
146215
test-no-extras:
147216
name: Tests Without Extras
148217
runs-on: ubuntu-latest

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Internal
88
* Update Python versions used in CI.
99
* Add CI on macOS.
1010
* Add limited CI on Windows.
11+
* Add limited CI on Windows WSL.
1112

1213

1314
1.73.1 (2026/05/29)

test/pytests/test_special_iocommands.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import builtins
44
import os
55
from pathlib import Path
6+
import platform
67
import stat
78
import subprocess
89
import tempfile
@@ -224,6 +225,7 @@ def test_tee_command():
224225
print(f"An error occurred while attempting to delete the file: {e}")
225226

226227

228+
@pytest.mark.skipif('wsl2' in platform.uname().release.lower(), reason='todo: unknown')
227229
def test_tee_command_error():
228230
with pytest.raises(TypeError):
229231
mycli.packages.special.execute(None, "tee")

0 commit comments

Comments
 (0)