Skip to content

Commit d17eb8f

Browse files
authored
CI: Add testing for Musl Linux (#52953)
* CI: Add testing for Musl Linux * Install locale * Add loc path * set tz too * Skip one test for musl, use more standard tz for musl * Correct skips for MUSL * Do less stuff during install * syntax error
1 parent f990ab0 commit d17eb8f

File tree

5 files changed

+71
-2
lines changed

5 files changed

+71
-2
lines changed

Diff for: .github/workflows/unit-tests.yml

+43
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,49 @@ jobs:
241241
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-32bit
242242
cancel-in-progress: true
243243

244+
Linux-Musl:
245+
runs-on: ubuntu-22.04
246+
container:
247+
image: quay.io/pypa/musllinux_1_1_x86_64
248+
steps:
249+
- name: Checkout pandas Repo
250+
# actions/checkout does not work since it requires node
251+
run: |
252+
git config --global --add safe.directory $PWD
253+
254+
if [ $GITHUB_EVENT_NAME != pull_request ]; then
255+
git clone --recursive --branch=$GITHUB_REF_NAME https://github.com/${GITHUB_REPOSITORY}.git $GITHUB_WORKSPACE
256+
git reset --hard $GITHUB_SHA
257+
else
258+
git clone --recursive https://github.com/${GITHUB_REPOSITORY}.git $GITHUB_WORKSPACE
259+
git fetch origin $GITHUB_REF:my_ref_name
260+
git checkout $GITHUB_BASE_REF
261+
git -c user.email="[email protected]" merge --no-commit my_ref_name
262+
fi
263+
- name: Configure System Packages
264+
run: |
265+
apk update
266+
apk add musl-locales
267+
- name: Build environment
268+
run: |
269+
/opt/python/cp39-cp39/bin/python -m venv ~/virtualenvs/pandas-dev
270+
. ~/virtualenvs/pandas-dev/bin/activate
271+
python -m pip install --no-cache-dir --no-deps -U pip wheel setuptools
272+
python -m pip install --no-cache-dir versioneer[toml] cython numpy python-dateutil pytz pytest>=7.0.0 pytest-xdist>=2.2.0 pytest-asyncio>=0.17 hypothesis>=6.46.1
273+
python setup.py build_ext -q -j$(nproc)
274+
python -m pip install --no-cache-dir --no-build-isolation --no-use-pep517 -e .
275+
python -m pip list --no-cache-dir
276+
277+
- name: Run Tests
278+
run: |
279+
. ~/virtualenvs/pandas-dev/bin/activate
280+
export PANDAS_CI=1
281+
python -m pytest -m 'not slow and not network and not clipboard and not single_cpu' pandas --junitxml=test-data.xml
282+
concurrency:
283+
# https://github.community/t/concurrecy-not-work-for-push/183068/7
284+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-musl
285+
cancel-in-progress: true
286+
244287
python-dev:
245288
# This job may or may not run depending on the state of the next
246289
# unreleased Python version. DO NOT DELETE IT.

Diff for: pandas/compat/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
from pandas.compat._constants import (
1818
IS64,
19+
ISMUSL,
1920
PY310,
2021
PY311,
2122
PYPY,
@@ -160,6 +161,7 @@ def get_lzma_file() -> type[pandas.compat.compressors.LZMAFile]:
160161
"pa_version_under9p0",
161162
"pa_version_under11p0",
162163
"IS64",
164+
"ISMUSL",
163165
"PY310",
164166
"PY311",
165167
"PYPY",

Diff for: pandas/compat/_constants.py

+3
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,19 @@
99

1010
import platform
1111
import sys
12+
import sysconfig
1213

1314
IS64 = sys.maxsize > 2**32
1415

1516
PY310 = sys.version_info >= (3, 10)
1617
PY311 = sys.version_info >= (3, 11)
1718
PYPY = platform.python_implementation() == "PyPy"
19+
ISMUSL = "musl" in (sysconfig.get_config_var("HOST_GNU_TYPE") or "")
1820

1921

2022
__all__ = [
2123
"IS64",
24+
"ISMUSL",
2225
"PY310",
2326
"PY311",
2427
"PYPY",

Diff for: pandas/tests/config/test_localization.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
set_locale,
1111
)
1212

13+
from pandas.compat import ISMUSL
14+
1315
import pandas as pd
1416

1517
_all_locales = get_locales()
@@ -46,7 +48,19 @@ def test_can_set_locale_valid_set(lc_var):
4648
assert before_locale == after_locale
4749

4850

49-
@pytest.mark.parametrize("lc_var", (locale.LC_ALL, locale.LC_CTYPE, locale.LC_TIME))
51+
@pytest.mark.parametrize(
52+
"lc_var",
53+
(
54+
locale.LC_ALL,
55+
locale.LC_CTYPE,
56+
pytest.param(
57+
locale.LC_TIME,
58+
marks=pytest.mark.skipif(
59+
ISMUSL, reason="MUSL allows setting invalid LC_TIME."
60+
),
61+
),
62+
),
63+
)
5064
def test_can_set_locale_invalid_set(lc_var):
5165
# Cannot set an invalid locale.
5266
before_locale = _get_current_locale(lc_var)

Diff for: pandas/tests/tslibs/test_parsing.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,19 @@
1414
strptime,
1515
)
1616
from pandas._libs.tslibs.parsing import parse_datetime_string_with_reso
17+
from pandas.compat import (
18+
ISMUSL,
19+
is_platform_windows,
20+
)
1721
import pandas.util._test_decorators as td
1822

1923
import pandas._testing as tm
2024

2125

22-
@td.skip_if_windows
26+
@pytest.mark.skipif(
27+
is_platform_windows() or ISMUSL,
28+
reason="TZ setting incorrect on Windows and MUSL Linux",
29+
)
2330
def test_parsing_tzlocal_deprecated():
2431
# GH#50791
2532
msg = "Pass the 'tz' keyword or call tz_localize after construction instead"

0 commit comments

Comments
 (0)