From 266b06c802f277344d586f0d3703cb4c831107cd Mon Sep 17 00:00:00 2001 From: Jonas Haag Date: Tue, 29 Mar 2022 19:23:02 +0200 Subject: [PATCH 1/4] Use setup-python action --- .github/actions/setup-python/action.yml | 65 +++++++++++++++++++++++++ .github/workflows/sdist.yml | 10 ++-- 2 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 .github/actions/setup-python/action.yml diff --git a/.github/actions/setup-python/action.yml b/.github/actions/setup-python/action.yml new file mode 100644 index 0000000000000..3345ff72688dd --- /dev/null +++ b/.github/actions/setup-python/action.yml @@ -0,0 +1,65 @@ +name: Setup Python and install requirements +inputs: + python-version: + required: true + architecture: + default: x64 +runs: + using: composite + steps: + # TODO: GH#44980 https://github.com/pypa/setuptools/issues/2941 + - name: Create temporary requirements.txt + run: | + # Drop cache at least once per month + month_today="$(date '+%Y-%m')" + cat > requirements.txt <=6.2.5 + pytest-xdist + pytest-cov + pytest-asyncio>=0.17 + EOF + shell: bash -el {0} + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: ${{ inputs.python-version }} + architecture: ${{ inputs.architecture }} + cache: pip + + - name: Fix $PATH on macOS + run: | + # On macOS, the Python version we installed above is too late in $PATH + # to be effective if using "bash -l" (which we need for code that works + # with Conda envs). + cat >> ~/.bash_profile < 2**32))') + NPY_DISABLE_SVML=$bits32 pip install -r requirements.txt + pip list + shell: bash -el {0} diff --git a/.github/workflows/sdist.yml b/.github/workflows/sdist.yml index cd19eb7641c8c..8cb1e969c3c22 100644 --- a/.github/workflows/sdist.yml +++ b/.github/workflows/sdist.yml @@ -14,8 +14,8 @@ on: - "doc/**" jobs: - build: - if: ${{ github.event.label.name == 'Build' || contains(github.event.pull_request.labels.*.name, 'Build') || github.event_name == 'push'}} + sdist: + #if: ${{ github.event.label.name == 'Build' || contains(github.event.pull_request.labels.*.name, 'Build') || github.event_name == 'push'}} runs-on: ubuntu-latest timeout-minutes: 60 defaults: @@ -26,6 +26,8 @@ jobs: fail-fast: false matrix: python-version: ["3.8", "3.9", "3.10"] + name: sdist Python ${{ matrix.python-version }} + concurrency: # https://github.community/t/concurrecy-not-work-for-push/183068/7 group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{matrix.python-version}}-sdist @@ -36,8 +38,8 @@ jobs: with: fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v3 + - name: Set up Python ${{ matrix.python-version }} and install dependencies + uses: ./.github/actions/setup-python with: python-version: ${{ matrix.python-version }} From 83481aa3724c44eaa5f7af1988e57664bfcf9a8a Mon Sep 17 00:00:00 2001 From: Jonas Haag Date: Mon, 4 Apr 2022 13:34:56 +0200 Subject: [PATCH 2/4] Move pip reqs to file --- .github/actions/setup-python/action.yml | 24 +----------------------- ci/deps/pip-requirements.txt | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 23 deletions(-) create mode 100644 ci/deps/pip-requirements.txt diff --git a/.github/actions/setup-python/action.yml b/.github/actions/setup-python/action.yml index 3345ff72688dd..2e2dca20f5920 100644 --- a/.github/actions/setup-python/action.yml +++ b/.github/actions/setup-python/action.yml @@ -12,29 +12,7 @@ runs: run: | # Drop cache at least once per month month_today="$(date '+%Y-%m')" - cat > requirements.txt <=6.2.5 - pytest-xdist - pytest-cov - pytest-asyncio>=0.17 - EOF + cat requirements.txt - <<< "# $month_today" shell: bash -el {0} - name: Set up Python diff --git a/ci/deps/pip-requirements.txt b/ci/deps/pip-requirements.txt new file mode 100644 index 0000000000000..71dbddab1d245 --- /dev/null +++ b/ci/deps/pip-requirements.txt @@ -0,0 +1,21 @@ +# Requirements for pip-based CI environments (eg., sdist and python-dev) + +# Python deps +pip +setuptools<60.0.0 +wheel + +# Pandas deps +# GH 39416 +numpy +cython +python-dateutil +pytz + +# Test deps +git+https://github.com/nedbat/coveragepy.git +hypothesis +pytest>=6.2.5 +pytest-xdist +pytest-cov +pytest-asyncio>=0.17 From c522db3417563e403744695dbd79dd940aefd38f Mon Sep 17 00:00:00 2001 From: Jonas Haag Date: Mon, 4 Apr 2022 23:04:51 +0200 Subject: [PATCH 3/4] fix --- .github/actions/setup-python/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-python/action.yml b/.github/actions/setup-python/action.yml index 2e2dca20f5920..e79c9c2ee7081 100644 --- a/.github/actions/setup-python/action.yml +++ b/.github/actions/setup-python/action.yml @@ -12,7 +12,7 @@ runs: run: | # Drop cache at least once per month month_today="$(date '+%Y-%m')" - cat requirements.txt - <<< "# $month_today" + cat > requirements.txt ci/deps/pip-requirements.txt - <<< "# $month_today" shell: bash -el {0} - name: Set up Python From 180e2b8f4b4530e8b5c25219d2d4d321a6e74991 Mon Sep 17 00:00:00 2001 From: Jonas Haag Date: Tue, 5 Apr 2022 09:13:32 +0200 Subject: [PATCH 4/4] review feedback --- .github/actions/setup-python/action.yml | 14 +------------- ci/deps/pip-requirements.txt | 1 + 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/actions/setup-python/action.yml b/.github/actions/setup-python/action.yml index e79c9c2ee7081..4962b88362a3b 100644 --- a/.github/actions/setup-python/action.yml +++ b/.github/actions/setup-python/action.yml @@ -7,20 +7,11 @@ inputs: runs: using: composite steps: - # TODO: GH#44980 https://github.com/pypa/setuptools/issues/2941 - - name: Create temporary requirements.txt - run: | - # Drop cache at least once per month - month_today="$(date '+%Y-%m')" - cat > requirements.txt ci/deps/pip-requirements.txt - <<< "# $month_today" - shell: bash -el {0} - - name: Set up Python uses: actions/setup-python@v3 with: python-version: ${{ inputs.python-version }} architecture: ${{ inputs.architecture }} - cache: pip - name: Fix $PATH on macOS run: | @@ -35,9 +26,6 @@ runs: - name: Install dependencies run: | - cat requirements.txt - # TODO https://github.com/numpy/numpy/issues/21196 - bits32=$(python -c 'import sys; print(int(sys.maxsize > 2**32))') - NPY_DISABLE_SVML=$bits32 pip install -r requirements.txt + pip install -r ci/deps/pip-requirements.txt pip list shell: bash -el {0} diff --git a/ci/deps/pip-requirements.txt b/ci/deps/pip-requirements.txt index 71dbddab1d245..29dd9dd804c90 100644 --- a/ci/deps/pip-requirements.txt +++ b/ci/deps/pip-requirements.txt @@ -2,6 +2,7 @@ # Python deps pip +# TODO: GH#44980 https://github.com/pypa/setuptools/issues/2941 setuptools<60.0.0 wheel