Skip to content

Commit 6451c63

Browse files
committed
Add run-tests and setup-pandas actions
1 parent 244f747 commit 6451c63

File tree

5 files changed

+88
-34
lines changed

5 files changed

+88
-34
lines changed

.github/actions/build_pandas/action.yml

+6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ runs:
88
run: |
99
conda info
1010
conda list
11+
# Make sure we have the correct environment activated
12+
conda info | grep -Ei 'environment.+:' | grep -qEiv 'environment.+:.+none'
1113
shell: bash -el {0}
1214

1315
- name: Build Pandas
@@ -18,3 +20,7 @@ runs:
1820
env:
1921
# Cannot use parallel compilation on Windows, see https://github.com/pandas-dev/pandas/issues/30873
2022
N_JOBS: ${{ runner.os == 'Windows' && 1 || 2 }}
23+
24+
- name: Show dependency versions
25+
run: python -c "import pandas; pandas.show_versions()"
26+
shell: bash -el {0}

.github/actions/run-tests/action.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Run tests and report results
2+
description: >-
3+
Runs the test suite and publishes the results and coverage.
4+
5+
Pandas is expected to be installed with pip or Conda in a way that a Python
6+
interpreter run from a login bash will be able to import it, eg.
7+
`bash -lc 'python -c "import pandas"'`.
8+
inputs:
9+
check-pyarrow-version:
10+
description: >-
11+
If set, double-check that the PyArrow version used by the Pandas installation
12+
if identical to this string.
13+
required: false
14+
runs:
15+
using: composite
16+
steps:
17+
- name: Check PyArrow version
18+
run: |
19+
# Double check that we have the expected PyArrow
20+
mamba list -f pyarrow | grep ${{ inputs.check-pyarrow-version }}
21+
shell: bash -el {0}
22+
if: ${{ inputs.check-pyarrow-version }}
23+
24+
- name: Test
25+
run: ci/run_tests.sh
26+
shell: bash -el {0}
27+
28+
- name: Publish test results
29+
uses: actions/upload-artifact@v2
30+
with:
31+
name: Test results
32+
path: test-data.xml
33+
if: failure()
34+
35+
- name: Upload coverage to Codecov
36+
uses: codecov/codecov-action@v2
37+
with:
38+
flags: unittests
39+
name: codecov-pandas
40+
fail_ci_if_error: false
41+
if: failure()
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Set up pandas
2+
description: Runs all the setup steps required to have a built pandas ready to use
3+
inputs:
4+
environment-file:
5+
description: Conda environment file to use.
6+
default: environment.yml
7+
pyarrow-version:
8+
description: If set, overrides the PyArrow version in the Conda environment to the given string.
9+
required: false
10+
runs:
11+
using: composite
12+
steps:
13+
- name: Set Arrow version in ${{ inputs.environment-file }} to ${{ inputs.pyarrow-version }}
14+
run: |
15+
grep -q ' - pyarrow' ${{ inputs.environment-file }}
16+
sed -i"" -e "s/ - pyarrow/ - pyarrow=${{ inputs.pyarrow-version }}/" ${{ inputs.environment-file }}
17+
cat ${{ inputs.environment-file }}
18+
shell: bash
19+
if: ${{ inputs.pyarrow-version }}
20+
21+
- name: Pin setuptools (GH#44980)
22+
run: |
23+
echo ' - setuptools <60' >> ${{ inputs.environment-file }}
24+
shell: bash
25+
26+
- name: Install ${{ inputs.environment-file }}
27+
uses: conda-incubator/setup-miniconda@v2
28+
with:
29+
environment-file: ${{ inputs.environment-file }}
30+
channel-priority: ${{ runner.os == 'macOS' && 'flexible' || 'strict' }}
31+
channels: conda-forge
32+
mamba-version: "0.23"
33+
use-mamba: true

.github/workflows/macos-windows.yml

+7-33
Original file line numberDiff line numberDiff line change
@@ -43,42 +43,16 @@ jobs:
4343
with:
4444
fetch-depth: 0
4545

46-
- name: Install Dependencies
47-
uses: conda-incubator/setup-[email protected]
46+
- name: Set up Conda (${{ matrix.env_file }}, Arrow ${{ matrix.pyarrow_version}})
47+
uses: ./.github/actions/setup-pandas
4848
with:
49-
mamba-version: "*"
50-
channels: conda-forge
51-
activate-environment: pandas-dev
52-
channel-priority: ${{ matrix.os == 'macos-latest' && 'flexible' || 'strict' }}
5349
environment-file: ci/deps/${{ matrix.env_file }}
54-
use-only-tar-bz2: true
50+
pyarrow-version: ${{ matrix.os == 'macos-latest' && '6' || '' }}
5551

56-
# ImportError: 2): Library not loaded: @rpath/libssl.1.1.dylib
57-
# Referenced from: /Users/runner/miniconda3/envs/pandas-dev/lib/libthrift.0.13.0.dylib
58-
# Reason: image not found
59-
- name: Upgrade pyarrow on MacOS
60-
run: conda install -n pandas-dev -c conda-forge --no-update-deps pyarrow=6
61-
if: ${{ matrix.os == 'macos-latest' }}
62-
63-
- name: Build Pandas
52+
- name: Build pandas
6453
uses: ./.github/actions/build_pandas
6554

66-
- name: Test
67-
run: ci/run_tests.sh
68-
69-
- name: Build Version
70-
run: conda list
71-
72-
- name: Publish test results
73-
uses: actions/upload-artifact@v3
74-
with:
75-
name: Test results
76-
path: test-data.xml
77-
if: failure()
78-
79-
- name: Upload coverage to Codecov
80-
uses: codecov/codecov-action@v2
55+
- name: Run tests
56+
uses: ./.github/actions/run-tests
8157
with:
82-
flags: unittests
83-
name: codecov-pandas
84-
fail_ci_if_error: false
58+
check-pyarrow-version: ${{ matrix.pyarrow_version }}

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ def run(self):
333333
extra_compile_args.append("/Z7")
334334
extra_link_args.append("/DEBUG")
335335
else:
336-
# PANDAS_CI=1 is set by ci/setup_env.sh
336+
# PANDAS_CI=1 is set in CI
337337
if os.environ.get("PANDAS_CI", "0") == "1":
338338
extra_compile_args.append("-Werror")
339339
if debugging_symbols_requested:

0 commit comments

Comments
 (0)