Skip to content

Commit 266b06c

Browse files
committed
Use setup-python action
1 parent 3cb70a5 commit 266b06c

File tree

2 files changed

+71
-4
lines changed

2 files changed

+71
-4
lines changed
+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Setup Python and install requirements
2+
inputs:
3+
python-version:
4+
required: true
5+
architecture:
6+
default: x64
7+
runs:
8+
using: composite
9+
steps:
10+
# TODO: GH#44980 https://github.com/pypa/setuptools/issues/2941
11+
- name: Create temporary requirements.txt
12+
run: |
13+
# Drop cache at least once per month
14+
month_today="$(date '+%Y-%m')"
15+
cat > requirements.txt <<EOF
16+
# $month_today
17+
18+
# Python deps
19+
pip
20+
setuptools<60.0.0
21+
wheel
22+
23+
# Pandas deps
24+
# GH 39416
25+
numpy
26+
cython
27+
python-dateutil
28+
pytz
29+
30+
# Test deps
31+
git+https://github.com/nedbat/coveragepy.git
32+
hypothesis
33+
pytest>=6.2.5
34+
pytest-xdist
35+
pytest-cov
36+
pytest-asyncio>=0.17
37+
EOF
38+
shell: bash -el {0}
39+
40+
- name: Set up Python
41+
uses: actions/setup-python@v3
42+
with:
43+
python-version: ${{ inputs.python-version }}
44+
architecture: ${{ inputs.architecture }}
45+
cache: pip
46+
47+
- name: Fix $PATH on macOS
48+
run: |
49+
# On macOS, the Python version we installed above is too late in $PATH
50+
# to be effective if using "bash -l" (which we need for code that works
51+
# with Conda envs).
52+
cat >> ~/.bash_profile <<EOF
53+
export PATH="\$(echo "\$PATH" | grep -Eio '[^:]+hostedtoolcache/python[^:]+bin'):\$PATH" \
54+
EOF
55+
shell: bash -el {0}
56+
if: ${{ runner.os == 'macOS' }}
57+
58+
- name: Install dependencies
59+
run: |
60+
cat requirements.txt
61+
# TODO https://github.com/numpy/numpy/issues/21196
62+
bits32=$(python -c 'import sys; print(int(sys.maxsize > 2**32))')
63+
NPY_DISABLE_SVML=$bits32 pip install -r requirements.txt
64+
pip list
65+
shell: bash -el {0}

.github/workflows/sdist.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ on:
1414
- "doc/**"
1515

1616
jobs:
17-
build:
18-
if: ${{ github.event.label.name == 'Build' || contains(github.event.pull_request.labels.*.name, 'Build') || github.event_name == 'push'}}
17+
sdist:
18+
#if: ${{ github.event.label.name == 'Build' || contains(github.event.pull_request.labels.*.name, 'Build') || github.event_name == 'push'}}
1919
runs-on: ubuntu-latest
2020
timeout-minutes: 60
2121
defaults:
@@ -26,6 +26,8 @@ jobs:
2626
fail-fast: false
2727
matrix:
2828
python-version: ["3.8", "3.9", "3.10"]
29+
name: sdist Python ${{ matrix.python-version }}
30+
2931
concurrency:
3032
# https://github.community/t/concurrecy-not-work-for-push/183068/7
3133
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{matrix.python-version}}-sdist
@@ -36,8 +38,8 @@ jobs:
3638
with:
3739
fetch-depth: 0
3840

39-
- name: Set up Python
40-
uses: actions/setup-python@v3
41+
- name: Set up Python ${{ matrix.python-version }} and install dependencies
42+
uses: ./.github/actions/setup-python
4143
with:
4244
python-version: ${{ matrix.python-version }}
4345

0 commit comments

Comments
 (0)