GitHub Actions: trigger tests also for pull requests and schedule a w… #34
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 | |
on: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- main | |
schedule: | |
# Run tests weekly on Sundays at 5:47 UTC. | |
# This might help us us detecting unexpected breakage due to changes in | |
# 3rd-party dependencies. GitHub only triggers this for the default branch. | |
- cron: '47 5 * * 0' | |
jobs: | |
tests_old_env: | |
# "ubuntu-latest" does not have Python 3.6 | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.6, 3.7, "pypy-2.7"] | |
sqlalchemy-version: [1.2, 1.3, 1.4] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install "SQLAlchemy == ${{ matrix.sqlalchemy-version }}.*" | |
pip install -e .[testing] | |
- name: Run test suite | |
run: | | |
pytest | |
# GitHub Actions does not support Python 2 anymore via "actions/setup-python" since May 2023: | |
# https://github.com/actions/setup-python/issues/672 | |
# As a workaround use a Python 2.7 container which should have everything pre-installed. | |
tests_old_env_py2: | |
runs-on: ubuntu-20.04 | |
container: | |
image: python:2.7.18-buster | |
strategy: | |
fail-fast: false | |
matrix: | |
sqlalchemy-version: [1.2, 1.3, 1.4] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
pip install "SQLAlchemy == ${{ matrix.sqlalchemy-version }}.*" | |
pip install -e .[testing] | |
- name: Run test suite | |
run: | | |
pytest | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.8, 3.9, "3.10", "3.11", "3.12", "3.13", "pypy-3.9"] | |
sqlalchemy-version: [1.4, 2.0] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install "SQLAlchemy == ${{ matrix.sqlalchemy-version }}.*" | |
pip install -e .[testing] | |
- name: Run test suite | |
run: | | |
pytest |