Migrate to setup-python
in GitHub Actions (and enable 3.13 tox builds).
#90
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Tox Tests | |
on: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- "*" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] | |
pandas-presence: ['with_pandas', 'without_pandas'] | |
env: | |
PYTHON_VERSION: ${{ matrix.python-version }} | |
PANDAS_PRESENCE: ${{ matrix.pandas-presence }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
id: gha_python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
continue-on-error: true | |
- name: Install PyEnv | |
if: job.steps.gha_python.status == failure() | |
run: | | |
curl https://pyenv.run | bash | |
PYENV_ROOT="$HOME/.pyenv" | |
echo "$PYENV_ROOT/bin" >> $GITHUB_PATH | |
echo "$PYENV_ROOT/shims" >> $GITHUB_PATH | |
echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV | |
- name: Install Python ${{ matrix.python-version }} using PyEnv | |
if: job.steps.gha_python.status == failure() | |
run: | | |
pyenv install "${{ matrix.python-version }}" | |
pyenv local "${{ matrix.python-version }}" | |
pyenv versions | |
- name: Install dependencies | |
run: | | |
pip install -U pip | |
pip install tox tox-gh-actions | |
- name: Test with tox | |
run: | | |
PYTHON_ENV="py$(echo $PYTHON_VERSION | sed 's/\.//;s/\-dev//')" | |
tox -e "${PYTHON_ENV}-${PANDAS_PRESENCE}" | |
- name: Upload coverage to Codecov | |
uses: codecov/[email protected] | |
with: | |
file: ./coverage.xml | |
flags: unittests | |
env_vars: PYTHON_VERSION,PANDAS_PRESENCE |