]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
ci: move tests to gh actions
authorRiccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Sun, 28 Feb 2021 19:05:24 +0000 (20:05 +0100)
committerRiccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Mon, 1 Mar 2021 10:53:38 +0000 (11:53 +0100)
.github/workflows/tests.yml [new file with mode: 0644]
.travis.yml [deleted file]

diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644 (file)
index 0000000..58e4b72
--- /dev/null
@@ -0,0 +1,75 @@
+name: Tests
+
+on:
+  push:
+    branches: [ master ]
+  pull_request:
+    branches: [ master ]
+
+jobs:
+  tests:
+    name: Tests
+    runs-on: ubuntu-20.04
+
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - postgres: 10
+            python: 3.6
+            toxenv: py36
+            toxdir: psycopg3_c
+            implementation: c
+            # skip tests failing on importing psycopg3_c.pq on subprocess
+            # they only fail on Travis, work ok locally under tox too.
+            pytest_addopts: "-m 'not subprocess'"
+          - postgres: 11
+            python: 3.6
+            toxenv: py36
+            toxdir: psycopg3
+            implementation: python
+          - postgres: 11
+            python: 3.7
+            toxenv: py37
+            toxdir: psycopg3_c
+            implementation: c
+            pytest_addopts: "-m 'not subprocess'"
+          - postgres: 12
+            python: 3.7
+            toxenv: py37
+            toxdir: psycopg3
+            implementation: python
+          - postgres: 12
+            python: 3.8
+            toxenv: py38
+            toxdir: psycopg3_c
+            implementation: c
+            pytest_addopts: "-m 'not subprocess'"
+          - postgres: 12
+            python: 3.8
+            toxenv: py38
+            toxdir: psycopg3
+            implementation: python
+
+    env:
+      PSYCOPG3_TEST_DSN: host=postgresql dbname=psycopg3_test
+      PSYCOPG3_IMPL: ${{ matrix.implementation }}
+      PYTEST_ADDOPTS: ${{ matrix.pytest_addopts }}
+
+    services:
+      postgresql:
+        image: postgres:${{ matrix.postgres }}
+        env:
+          POSTGRES_DB: psycopg3_test
+
+    steps:
+    - uses: actions/checkout@v2
+    - uses: actions/setup-python@v2
+      with:
+        python-version: ${{ matrix.python }}
+    - name: install postgresql client
+      run: sudo apt install postgresql-client-${{ matrix.postgres }}
+    - name: install tox
+      run: pip install tox
+    - name: run tests
+      run: tox -c ${{ matrix.toxdir }} -e ${{ matrix.toxenv }}
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644 (file)
index a0f6ec7..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-# Travis CI configuration for psycopg3
-
-language: python
-
-env:
-  global:
-    - PSYCOPG3_TEST_DSN=dbname=psycopg3_test
-
-matrix:
-  include:
-
-    - python: 3.6
-      addons:
-        postgresql: '10'
-        apt:
-          packages:
-            - postgresql-client-10
-      env:
-        - TOXENV=py36
-        - TOXDIR=psycopg3_c
-        - PGVER=10
-        - PSYCOPG3_IMPL=c
-        - PGPORT=5432
-          # skip tests failing on importing psycopg3_c.pq on subprocess
-          # they only fail on Travis, work ok locally under tox too.
-        - PYTEST_ADDOPTS="-m 'not subprocess'"
-
-    - python: 3.6
-      addons:
-        postgresql: '11'
-        apt:
-          packages:
-            - postgresql-11
-            - postgresql-client-11
-      env:
-        - TOXENV=py36
-        - TOXDIR=psycopg3
-        - PGVER=11
-        - PSYCOPG3_IMPL=python
-        - PGPORT=5433
-
-    - python: 3.7
-      addons:
-        postgresql: '11'
-        apt:
-          packages:
-            - postgresql-11
-            - postgresql-client-11
-      env:
-        - TOXENV=py37
-        - TOXDIR=psycopg3_c
-        - PGVER=11
-        - PSYCOPG3_IMPL=c
-        - PGPORT=5433
-        - PYTEST_ADDOPTS="-m 'not subprocess'"
-
-    - python: 3.7
-      addons:
-        postgresql: '12'
-        apt:
-          packages:
-            - postgresql-12
-            - postgresql-client-12
-      env:
-        - TOXENV=py37
-        - TOXDIR=psycopg3
-        - PGVER=11
-        - PSYCOPG3_IMPL=python
-        - PGPORT=5433
-
-    - python: 3.8
-      addons:
-        postgresql: '12'
-        apt:
-          packages:
-            - postgresql-12
-            - postgresql-client-12
-      env:
-        - TOXENV=py38
-        - TOXDIR=psycopg3_c
-        - PGVER=12
-        - PSYCOPG3_IMPL=c
-        - PGPORT=5433
-        - PYTEST_ADDOPTS="-m 'not subprocess'"
-
-    - python: 3.8
-      addons:
-        postgresql: '12'
-        apt:
-          packages:
-            - postgresql-12
-            - postgresql-client-12
-      env:
-        - TOXENV=py38
-        - TOXDIR=psycopg3
-        - PGVER=12
-        - PSYCOPG3_IMPL=python
-        - PGPORT=5433
-
-install:
-  - pip install tox
-  - test ${TOXENV:0:2} != py || psql -c 'create database psycopg3_test'
-
-script:
-  - tox -c $TOXDIR