Skip to content

Commit d095e4c

Browse files
Backport PR #38344: CI: Move sql builds from Travis to Github actions (#38734)
Co-authored-by: Fangchen Li <[email protected]>
1 parent be91ad1 commit d095e4c

File tree

9 files changed

+204
-32
lines changed

9 files changed

+204
-32
lines changed

.github/workflows/database.yml

+180
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
name: Database
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches:
8+
- master
9+
- 1.2.x
10+
11+
env:
12+
PYTEST_WORKERS: "auto"
13+
PANDAS_CI: 1
14+
PATTERN: ((not slow and not network and not clipboard) or (single and db))
15+
16+
jobs:
17+
Linux_py37_locale:
18+
runs-on: ubuntu-latest
19+
defaults:
20+
run:
21+
shell: bash -l {0}
22+
23+
env:
24+
ENV_FILE: ci/deps/actions-37-locale.yaml
25+
LOCALE_OVERRIDE: zh_CN.UTF-8
26+
27+
services:
28+
mysql:
29+
image: mysql
30+
env:
31+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
32+
MYSQL_DATABASE: pandas
33+
options: >-
34+
--health-cmd "mysqladmin ping"
35+
--health-interval 10s
36+
--health-timeout 5s
37+
--health-retries 5
38+
ports:
39+
- 3306:3306
40+
41+
postgres:
42+
image: postgres
43+
env:
44+
POSTGRES_USER: postgres
45+
POSTGRES_PASSWORD: postgres
46+
POSTGRES_DB: pandas
47+
options: >-
48+
--health-cmd pg_isready
49+
--health-interval 10s
50+
--health-timeout 5s
51+
--health-retries 5
52+
ports:
53+
- 5432:5432
54+
55+
steps:
56+
- name: Checkout
57+
uses: actions/checkout@v1
58+
59+
- name: Cache conda
60+
uses: actions/cache@v1
61+
env:
62+
CACHE_NUMBER: 0
63+
with:
64+
path: ~/conda_pkgs_dir
65+
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
66+
hashFiles('${{ env.ENV_FILE }}') }}
67+
68+
- uses: conda-incubator/setup-miniconda@v2
69+
with:
70+
activate-environment: pandas-dev
71+
channel-priority: strict
72+
environment-file: ${{ env.ENV_FILE }}
73+
use-only-tar-bz2: true
74+
75+
- name: Environment Detail
76+
run: |
77+
conda info
78+
conda list
79+
80+
- name: Build Pandas
81+
run: |
82+
python setup.py build_ext -j 2
83+
python -m pip install -e . --no-build-isolation --no-use-pep517
84+
85+
- name: Test
86+
run: ci/run_tests.sh
87+
if: always()
88+
89+
- name: Publish test results
90+
uses: actions/upload-artifact@master
91+
with:
92+
name: Test results
93+
path: test-data.xml
94+
if: failure()
95+
96+
- name: Print skipped tests
97+
run: python ci/print_skipped.py
98+
99+
Linux_py37_cov:
100+
runs-on: ubuntu-latest
101+
defaults:
102+
run:
103+
shell: bash -l {0}
104+
105+
env:
106+
ENV_FILE: ci/deps/actions-37-cov.yaml
107+
PANDAS_TESTING_MODE: deprecate
108+
COVERAGE: true
109+
110+
services:
111+
mysql:
112+
image: mysql
113+
env:
114+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
115+
MYSQL_DATABASE: pandas
116+
options: >-
117+
--health-cmd "mysqladmin ping"
118+
--health-interval 10s
119+
--health-timeout 5s
120+
--health-retries 5
121+
ports:
122+
- 3306:3306
123+
124+
postgres:
125+
image: postgres
126+
env:
127+
POSTGRES_USER: postgres
128+
POSTGRES_PASSWORD: postgres
129+
POSTGRES_DB: pandas
130+
options: >-
131+
--health-cmd pg_isready
132+
--health-interval 10s
133+
--health-timeout 5s
134+
--health-retries 5
135+
ports:
136+
- 5432:5432
137+
138+
steps:
139+
- name: Checkout
140+
uses: actions/checkout@v1
141+
142+
- name: Cache conda
143+
uses: actions/cache@v1
144+
env:
145+
CACHE_NUMBER: 0
146+
with:
147+
path: ~/conda_pkgs_dir
148+
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
149+
hashFiles('${{ env.ENV_FILE }}') }}
150+
151+
- uses: conda-incubator/setup-miniconda@v2
152+
with:
153+
activate-environment: pandas-dev
154+
channel-priority: strict
155+
environment-file: ${{ env.ENV_FILE }}
156+
use-only-tar-bz2: true
157+
158+
- name: Environment Detail
159+
run: |
160+
conda info
161+
conda list
162+
163+
- name: Build Pandas
164+
run: |
165+
python setup.py build_ext -j 2
166+
python -m pip install -e . --no-build-isolation --no-use-pep517
167+
168+
- name: Test
169+
run: ci/run_tests.sh
170+
if: always()
171+
172+
- name: Publish test results
173+
uses: actions/upload-artifact@master
174+
with:
175+
name: Test results
176+
path: test-data.xml
177+
if: failure()
178+
179+
- name: Print skipped tests
180+
run: python ci/print_skipped.py

.travis.yml

+1-16
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ services:
1616
# travis cache --delete inside the project directory from the travis command line client
1717
# The cache directories will be deleted if anything in ci/ changes in a commit
1818
cache:
19+
apt: true
1920
ccache: true
2021
directories:
2122
- $HOME/.cache # cython cache
2223

2324
env:
2425
global:
25-
- PYTEST_WORKERS="auto"
2626
# create a github personal access token
2727
# cd pandas-dev/pandas
2828
# travis encrypt 'PANDAS_GH_TOKEN=personal_access_token' -r pandas-dev/pandas
@@ -35,25 +35,10 @@ matrix:
3535
fast_finish: true
3636

3737
include:
38-
- env:
39-
- JOB="3.7, locale" ENV_FILE="ci/deps/travis-37-locale.yaml" PATTERN="((not slow and not network and not clipboard) or (single and db))" LOCALE_OVERRIDE="zh_CN.UTF-8" SQL="1"
40-
services:
41-
- mysql
42-
- postgresql
43-
4438
- arch: arm64
4539
env:
4640
- JOB="3.7, arm64" PYTEST_WORKERS=1 ENV_FILE="ci/deps/travis-37-arm64.yaml" PATTERN="(not slow and not network and not clipboard and not arm_slow)"
4741

48-
- env:
49-
# Enabling Deprecations when running tests
50-
# PANDAS_TESTING_MODE="deprecate" causes DeprecationWarning messages to be displayed in the logs
51-
# See pandas/_testing.py for more details.
52-
- JOB="3.7, coverage" ENV_FILE="ci/deps/travis-37-cov.yaml" PATTERN="((not slow and not network and not clipboard) or (single and db))" PANDAS_TESTING_MODE="deprecate" COVERAGE=true SQL="1"
53-
services:
54-
- mysql
55-
- postgresql
56-
5742
allow_failures:
5843
# Moved to allowed_failures 2020-09-29 due to timeouts https://github.com/pandas-dev/pandas/issues/36719
5944
- arch: arm64

ci/deps/travis-37-cov.yaml renamed to ci/deps/actions-37-cov.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies:
1515
- beautifulsoup4
1616
- botocore>=1.11
1717
- dask
18-
- fastparquet>=0.3.2
18+
- fastparquet>=0.4.0
1919
- fsspec>=0.7.4
2020
- gcsfs>=0.6.0
2121
- geopandas

ci/deps/travis-37-locale.yaml renamed to ci/deps/actions-37-locale.yaml

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: pandas-dev
22
channels:
3-
- defaults
43
- conda-forge
54
dependencies:
65
- python=3.7.*
@@ -18,9 +17,9 @@ dependencies:
1817

1918
# optional
2019
- beautifulsoup4
21-
- blosc=1.15.0
20+
- blosc=1.17.0
2221
- python-blosc
23-
- fastparquet=0.3.2
22+
- fastparquet=0.4.0
2423
- html5lib
2524
- ipython
2625
- jinja2
@@ -43,5 +42,5 @@ dependencies:
4342

4443
# sql
4544
- psycopg2=2.7
46-
- pymysql=0.7.11
45+
- pymysql=0.8.1
4746
- sqlalchemy=1.3.0

ci/deps/azure-38-slow.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: pandas-dev
22
channels:
3-
- defaults
43
- conda-forge
54
dependencies:
65
- python=3.8.*

ci/deps/azure-windows-38.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies:
1515
# pandas dependencies
1616
- blosc
1717
- bottleneck
18-
- fastparquet>=0.3.2
18+
- fastparquet>=0.4.0
1919
- flask
2020
- fsspec>=0.8.0
2121
- matplotlib=3.1.3

doc/source/getting_started/install.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,12 @@ Jinja2 2.10 Conditional formatting with DataFra
263263
PyQt4 Clipboard I/O
264264
PyQt5 Clipboard I/O
265265
PyTables 3.5.1 HDF5-based reading / writing
266-
SQLAlchemy 1.2.8 SQL support for databases other than sqlite
266+
SQLAlchemy 1.3.0 SQL support for databases other than sqlite
267267
SciPy 1.12.0 Miscellaneous statistical functions
268268
xlsxwriter 1.0.2 Excel writing
269-
blosc 1.15.0 Compression for HDF5
269+
blosc 1.17.0 Compression for HDF5
270270
fsspec 0.7.4 Handling files aside from local and HTTP
271-
fastparquet 0.3.2 Parquet reading / writing
271+
fastparquet 0.4.0 Parquet reading / writing
272272
gcsfs 0.6.0 Google Cloud Storage access
273273
html5lib 1.0.1 HTML parser for read_html (see :ref:`note <optional_html>`)
274274
lxml 4.3.0 HTML parser for read_html (see :ref:`note <optional_html>`)
@@ -278,7 +278,7 @@ openpyxl 2.6.0 Reading / writing for xlsx files
278278
pandas-gbq 0.12.0 Google Big Query access
279279
psycopg2 2.7 PostgreSQL engine for sqlalchemy
280280
pyarrow 0.15.0 Parquet, ORC, and feather reading / writing
281-
pymysql 0.7.11 MySQL engine for sqlalchemy
281+
pymysql 0.8.1 MySQL engine for sqlalchemy
282282
pyreadstat SPSS files (.sav) reading
283283
pyxlsb 1.0.6 Reading for xlsb files
284284
qtpy Clipboard I/O

doc/source/whatsnew/v1.2.1.rst

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ Fixed regressions
2323

2424
Bug fixes
2525
~~~~~~~~~
26+
27+
I/O
28+
^^^
29+
30+
- Bumped minimum fastparquet version to 0.4.0 to avoid ``AttributeError`` from numba (:issue:`38344`)
31+
- Bumped minimum pymysql version to 0.8.1 to avoid test failures (:issue:`38344`)
32+
2633
-
2734
-
2835

pandas/tests/io/test_sql.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ def test_sql_open_close(self):
11941194

11951195
@pytest.mark.skipif(SQLALCHEMY_INSTALLED, reason="SQLAlchemy is installed")
11961196
def test_con_string_import_error(self):
1197-
conn = "mysql://root@localhost/pandas_nosetest"
1197+
conn = "mysql://root@localhost/pandas"
11981198
msg = "Using URI string without sqlalchemy installed"
11991199
with pytest.raises(ImportError, match=msg):
12001200
sql.read_sql("SELECT * FROM iris", conn)
@@ -1931,11 +1931,12 @@ class _TestMySQLAlchemy:
19311931
"""
19321932

19331933
flavor = "mysql"
1934+
port = 3306
19341935

19351936
@classmethod
19361937
def connect(cls):
19371938
return sqlalchemy.create_engine(
1938-
f"mysql+{cls.driver}://root@localhost/pandas_nosetest",
1939+
f"mysql+{cls.driver}://root@localhost:{cls.port}/pandas",
19391940
connect_args=cls.connect_args,
19401941
)
19411942

@@ -2000,11 +2001,12 @@ class _TestPostgreSQLAlchemy:
20002001
"""
20012002

20022003
flavor = "postgresql"
2004+
port = 5432
20032005

20042006
@classmethod
20052007
def connect(cls):
20062008
return sqlalchemy.create_engine(
2007-
f"postgresql+{cls.driver}://postgres@localhost/pandas_nosetest"
2009+
f"postgresql+{cls.driver}://postgres:postgres@localhost:{cls.port}/pandas"
20082010
)
20092011

20102012
@classmethod
@@ -2620,7 +2622,7 @@ class TestXMySQL(MySQLMixIn):
26202622
@pytest.fixture(autouse=True, scope="class")
26212623
def setup_class(cls):
26222624
pymysql = pytest.importorskip("pymysql")
2623-
pymysql.connect(host="localhost", user="root", passwd="", db="pandas_nosetest")
2625+
pymysql.connect(host="localhost", user="root", passwd="", db="pandas")
26242626
try:
26252627
pymysql.connect(read_default_group="pandas")
26262628
except pymysql.ProgrammingError as err:
@@ -2640,7 +2642,7 @@ def setup_class(cls):
26402642
@pytest.fixture(autouse=True)
26412643
def setup_method(self, request, datapath):
26422644
pymysql = pytest.importorskip("pymysql")
2643-
pymysql.connect(host="localhost", user="root", passwd="", db="pandas_nosetest")
2645+
pymysql.connect(host="localhost", user="root", passwd="", db="pandas")
26442646
try:
26452647
pymysql.connect(read_default_group="pandas")
26462648
except pymysql.ProgrammingError as err:

0 commit comments

Comments
 (0)