.github: Explicitly install Postgres in platform tests #563
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: Tests | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- ci | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
test-platforms: | ||
# NOTE: this matrix is for testing various combinations of Python and OS | ||
# versions on the system-installed PostgreSQL version (which is usually | ||
# fairly recent). For a PostgreSQL version matrix see the test-postgres | ||
# job. | ||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
loop: [asyncio, uvloop] | ||
exclude: | ||
# uvloop does not support windows | ||
- loop: uvloop | ||
os: windows-latest | ||
# No 3.12 release yet | ||
- loop: uvloop | ||
python-version: "3.12" | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
shell: bash | ||
env: | ||
PIP_DISABLE_PIP_VERSION_CHECK: 1 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 50 | ||
submodules: true | ||
- name: Check if release PR. | ||
uses: edgedb/action-release/validate-pr@master | ||
id: release | ||
with: | ||
github_token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} | ||
missing_version_ok: yes | ||
version_file: asyncpg/_version.py | ||
version_line_pattern: | | ||
__version__\s*=\s*(?:['"])([[:PEP440:]])(?:['"]) | ||
- name: Setup PostgreSQL | ||
uses: tj-actions/install-postgresql@2a80e9368dff47cd05fee5bf3cf7d88f68c2f8e9 # v3.1.1 | ||
if: steps.release.outputs.version == 0 && matrix.os == "macos-latest" | ||
Check failure on line 58 in .github/workflows/tests.yml GitHub Actions / TestsInvalid workflow file
|
||
with: | ||
postgresql-version: 16 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
if: steps.release.outputs.version == 0 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install Python Deps | ||
if: steps.release.outputs.version == 0 | ||
run: | | ||
.github/workflows/install-krb5.sh | ||
python -m pip install -U pip setuptools wheel | ||
python -m pip install -e .[test] | ||
- name: Test | ||
if: steps.release.outputs.version == 0 | ||
env: | ||
LOOP_IMPL: ${{ matrix.loop }} | ||
run: | | ||
if [ "${LOOP_IMPL}" = "uvloop" ]; then | ||
env USE_UVLOOP=1 python -m unittest -v tests.suite | ||
else | ||
python -m unittest -v tests.suite | ||
fi | ||
test-postgres: | ||
strategy: | ||
matrix: | ||
postgres-version: ["9.5", "9.6", "10", "11", "12", "13", "14", "15", "16"] | ||
runs-on: ubuntu-latest | ||
env: | ||
PIP_DISABLE_PIP_VERSION_CHECK: 1 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 50 | ||
submodules: true | ||
- name: Check if release PR. | ||
uses: edgedb/action-release/validate-pr@master | ||
id: release | ||
with: | ||
github_token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} | ||
missing_version_ok: yes | ||
version_file: asyncpg/_version.py | ||
version_line_pattern: | | ||
__version__\s*=\s*(?:['"])([[:PEP440:]])(?:['"]) | ||
- name: Set up PostgreSQL | ||
if: steps.release.outputs.version == 0 | ||
env: | ||
PGVERSION: ${{ matrix.postgres-version }} | ||
DISTRO_NAME: focal | ||
run: | | ||
sudo env DISTRO_NAME="${DISTRO_NAME}" PGVERSION="${PGVERSION}" \ | ||
.github/workflows/install-postgres.sh | ||
echo PGINSTALLATION="/usr/lib/postgresql/${PGVERSION}/bin" \ | ||
>> "${GITHUB_ENV}" | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
if: steps.release.outputs.version == 0 | ||
with: | ||
python-version: "3.x" | ||
- name: Install Python Deps | ||
if: steps.release.outputs.version == 0 | ||
run: | | ||
.github/workflows/install-krb5.sh | ||
python -m pip install -U pip setuptools wheel | ||
python -m pip install -e .[test] | ||
- name: Test | ||
if: steps.release.outputs.version == 0 | ||
env: | ||
PGVERSION: ${{ matrix.postgres-version }} | ||
run: | | ||
python -m unittest -v tests.suite | ||
# This job exists solely to act as the test job aggregate to be | ||
# targeted by branch policies. | ||
regression-tests: | ||
name: "Regression Tests" | ||
needs: [test-platforms, test-postgres] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo OK |