]> git.phdru.name Git - sqlconvert.git/commitdiff
Merge branch 'github-actions'
authorOleg Broytman <phd@phdru.name>
Thu, 16 Sep 2021 17:49:43 +0000 (20:49 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 16 Sep 2021 17:49:43 +0000 (20:49 +0300)
.github/workflows/run-tests.yaml [new file with mode: 0644]
.travis.yml [deleted file]
appveyor.yml [deleted file]
devscripts/requirements/requirements_tests.txt
docs/news.rst
tox.ini

diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml
new file mode 100644 (file)
index 0000000..22d05e6
--- /dev/null
@@ -0,0 +1,70 @@
+name: Run tests
+
+on: [push, pull_request]
+
+jobs:
+  run-tests:
+
+    strategy:
+      matrix:
+        os: [ubuntu-latest, windows-latest]
+        python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
+        include:
+        - os: ubuntu-latest
+          os-name: Linux
+          pip-cache-path: ~/.cache/pip
+        - os: windows-latest
+          os-name: w32
+          pip-cache-path: ~\AppData\Local\pip\Cache
+
+    name: Python ${{ matrix.python-version }} @ ${{ matrix.os-name }}
+    runs-on: ${{ matrix.os }}
+
+    steps:
+
+      - uses: ankane/setup-postgres@v1
+      - name: Setup Postgres user
+        run: |
+          sudo -u postgres psql --command="ALTER USER runner CREATEDB PASSWORD 'test'"
+        if: ${{ runner.os == 'Linux' }}
+      - name: Setup Postgres user
+        run: |
+          psql --command="CREATE USER runner CREATEDB PASSWORD 'test'"
+        if: ${{ runner.os == 'Windows' }}
+
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+        with:
+          python-version: ${{ matrix.python-version }}
+      - name: Cache pip
+        uses: actions/cache@v2
+        with:
+          path: ${{ matrix.pip-cache-path }}
+          key: ${{ runner.os }}-pip
+      - name: Install dependencies
+        run: |
+          python --version
+          python -m pip install --upgrade "pip<21.0" "setuptools<45" wheel
+          pip --version
+          pip install --upgrade virtualenv tox
+      - name: Set TOXENV
+        run: |
+          import os, sys
+          pyver = '%d%d' % tuple(sys.version_info[:2])
+          toxenv = 'py%s' % pyver
+          toxenv += ',py%s-sqlite' % pyver
+          if os.name == 'nt':
+            toxenv += '-w32'
+          toxenv += ',py%s-postgres' % pyver
+          if os.name == 'posix':
+            toxenv += ',py%s-flake8' % pyver
+          elif os.name == 'nt':
+            toxenv += '-w32'
+          with open(os.environ['GITHUB_ENV'], 'a') as f:
+            f.write('TOXENV=' + toxenv + '\n')
+            f.write('PGPASSWORD=test\n')
+        shell: python
+      - name: Run tox
+        run: |
+          python -c "import os; print(os.environ['TOXENV'])"
+          tox
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644 (file)
index 3a81d9c..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-os: linux
-
-dist: xenial
-
-language: python
-
-python:
-  - "2.7"
-
-cache: pip
-
-addons:
-  apt:
-    packages:
-      - python-psycopg2
-      - python3-psycopg2
-  postgresql: "9.4"
-
-matrix:
-  include:
-  - python: "2.7"
-    env: TOXENV=py27
-  - python: "3.5"
-    env: TOXENV=py35
-  - python: "3.6"
-    env: TOXENV=py36
-  - python: "3.7"
-    env: TOXENV=py37
-  - python: "3.8"
-    env: TOXENV=py38
-  - python: "3.9"
-    env: TOXENV=py39
-  - python: "2.7"
-    env: TOXENV=py27-postgres
-  - python: "3.5"
-    env: TOXENV=py35-postgres
-  - python: "3.6"
-    env: TOXENV=py36-postgres
-  - python: "3.7"
-    env: TOXENV=py37-postgres
-  - python: "3.8"
-    env: TOXENV=py38-postgres
-  - python: "3.9"
-    env: TOXENV=py39-postgres
-  - python: "2.7"
-    env: TOXENV=py27-sqlite
-  - python: "3.5"
-    env: TOXENV=py35-sqlite
-  - python: "3.6"
-    env: TOXENV=py36-sqlite
-  - python: "3.7"
-    env: TOXENV=py37-sqlite
-  - python: "3.8"
-    env: TOXENV=py38-sqlite
-  - python: "3.9"
-    env: TOXENV=py39-sqlite
-  - python: "2.7"
-    env: TOXENV=py27-flake8
-  - python: "3.9"
-    env: TOXENV=py39-flake8
-
-install:
-  - travis_retry pip install --upgrade "pip<21" "setuptools<44" "tox>=3.15" ppu
-
-script:
-  - tox
-
-before_cache:
-  - remove-old-files.py -o 180 ~/.cache/pip
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644 (file)
index 420ed1d..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-# Test on windows
-# Heavily inspired by Oliver Grisel's appveyor-demo (https://github.com/ogrisel/python-appveyor-demo)
-version: '{branch}-{build}'
-
-cache:
-  - '%LOCALAPPDATA%\pip\Cache'
-
-# Match travis
-clone_depth: 50
-
-services:
-  - postgresql
-
-environment:
-  PGUSER: "postgres"
-  PGPASSWORD: "Password12!"
-
-  matrix:
-    - TOXENV: "py27"
-      PYTHON_VERSION: "2.7"
-      PYTHON_ARCH: "32"
-      PYTHON_HOME: "C:\\Python27"
-    - TOXENV: "py37"
-      PYTHON_VERSION: "3.7"
-      PYTHON_ARCH: "64"
-      PYTHON_HOME: "C:\\Python37-x64"
-    - TOXENV: "py38"
-      PYTHON_VERSION: "3.8"
-      PYTHON_ARCH: "64"
-      PYTHON_HOME: "C:\\Python38-x64"
-    - TOXENV: "py39"
-      PYTHON_VERSION: "3.9"
-      PYTHON_ARCH: "32"
-      PYTHON_HOME: "C:\\Python39"
-      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
-    - TOXENV: "py39"
-      PYTHON_VERSION: "3.9"
-      PYTHON_ARCH: "64"
-      PYTHON_HOME: "C:\\Python39-x64"
-      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
-    - TOXENV: "py27-postgres-w32"
-      PYTHON_VERSION: "2.7"
-      PYTHON_ARCH: "32"
-      PYTHON_HOME: "C:\\Python27"
-      db: postgresql
-    - TOXENV: "py37-postgres-w32"
-      PYTHON_VERSION: "3.7"
-      PYTHON_ARCH: "64"
-      PYTHON_HOME: "C:\\Python37-x64"
-      db: postgresql
-    - TOXENV: "py38-postgres-w32"
-      PYTHON_VERSION: "3.8"
-      PYTHON_ARCH: "64"
-      PYTHON_HOME: "C:\\Python38-x64"
-      db: postgresql
-    - TOXENV: "py39-postgres-w32"
-      PYTHON_VERSION: "3.9"
-      PYTHON_ARCH: "32"
-      PYTHON_HOME: "C:\\Python39"
-      db: postgresql
-      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
-    - TOXENV: "py39-postgres-w32"
-      PYTHON_VERSION: "3.9"
-      PYTHON_ARCH: "64"
-      PYTHON_HOME: "C:\\Python39-x64"
-      db: postgresql
-      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
-    - TOXENV: "py27-sqlite-w32"
-      PYTHON_VERSION: "2.7"
-      PYTHON_ARCH: "32"
-      PYTHON_HOME: "C:\\Python27"
-    - TOXENV: "py37-sqlite-w32"
-      PYTHON_VERSION: "3.7"
-      PYTHON_ARCH: "64"
-      PYTHON_HOME: "C:\\Python37-x64"
-    - TOXENV: "py38-sqlite-w32"
-      PYTHON_VERSION: "3.8"
-      PYTHON_ARCH: "64"
-      PYTHON_HOME: "C:\\Python38-x64"
-    - TOXENV: "py39-sqlite-w32"
-      PYTHON_VERSION: "3.9"
-      PYTHON_ARCH: "32"
-      PYTHON_HOME: "C:\\Python39"
-      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
-    - TOXENV: "py39-sqlite-w32"
-      PYTHON_VERSION: "3.9"
-      PYTHON_ARCH: "64"
-      PYTHON_HOME: "C:\\Python39-x64"
-      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
-    - TOXENV: "py27-flake8"
-      PYTHON_VERSION: "2.7"
-      PYTHON_ARCH: "32"
-      PYTHON_HOME: "C:\\Python27"
-    - TOXENV: "py39-flake8"
-      PYTHON_VERSION: "3.9"
-      PYTHON_ARCH: "64"
-      PYTHON_HOME: "C:\\Python39-x64"
-
-install:
-  # Ensure we use the right python version
-  - "SET PATH=%PYTHON_HOME%;%PYTHON_HOME%\\Scripts;C:\\Program Files\\PostgreSQL\\9.5\\bin;%PATH%"
-  - "SET TOXPYTHON=%PYTHON_HOME%\\python.exe"
-  - "python --version"
-  - "python -c \"import struct; print(struct.calcsize('P') * 8)\""
-  - "python -m pip install --upgrade \"pip<21\" \"setuptools<44\""
-  - "pip install --upgrade \"tox>=3.15\" ppu"
-  - "pip --version"
-
-# No build step - we don't have C extensions
-build: false
-
-test_script:
-  - "tox"
-
-after_test:
-  - "remove-old-files.py -o 180 %LOCALAPPDATA%\\pip\\Cache"
index 973ffbaca0ae703070c4568c68c0ab24b50e9f0d..935cc0875c25ddc8c5b2804e762063cbdb8ed6da 100644 (file)
@@ -2,5 +2,4 @@
 
 pytest < 5.0; python_version == '2.7' or python_version == '3.4'
 pytest; python_version >= '3.5'
-pytest-cov
 ppu
index 736d41abdd681cfcd99879a9e469cca45008990d..5f23551fb621153bcc583ce2efd1b1c7d0584e98 100644 (file)
@@ -6,6 +6,10 @@ Version 0.3.0 (2021-??-??)
 
 * Python 3.8, Python 3.9.
 
+* GitHub Actions.
+
+* Stop testing at Travis CI.
+
 Version 0.2.3 (2019-02-01)
 --------------------------
 
diff --git a/tox.ini b/tox.ini
index c318bdb3732af16be2514f48599877b750666285..6ba46d0f4aeb5867e4301ababbd92e175769f08f 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -23,17 +23,16 @@ deps =
 passenv = PGPASSWORD
 setenv =
     VIRTUALENV_PIP = 19.1.1
-platform = linux
+platform = linux|win32
 # Don't fail or warn on uninstalled commands
 whitelist_externals =
     createdb
     dropdb
 
 [testenv:{py27,py34,py35,py36,py37,py38,py39}]
-platform = linux|win32
 commands =
     {[testenv]commands}
-    {envpython} -m pytest --cov=sqlconvert
+    {envpython} -m pytest
     {envpython} {envbindir}/mysql2sql -P demo/demo.sql test.out
     cmp.py -i tests/mysql2sql/test.out test.out
     rm.py -f test.out
@@ -42,37 +41,27 @@ commands =
 commands =
     {[testenv]commands}
     -rm.py -f /tmp/test.sqdb
-    {envpython} -m pytest --cov=sqlconvert -D sqlite:///tmp/test.sqdb
+    {envpython} -m pytest -D sqlite:///tmp/test.sqdb
     rm.py -f /tmp/test.sqdb
 
 [testenv:{py27,py34,py35,py36,py37,py38,py39}-sqlite-w32]
 platform = win32
 commands =
     {[testenv]commands}
-    -rm.py -f C:/projects/sqlconvert/test.sqdb
-    pytest --cov=sqlconvert -D sqlite:/C:/projects/sqlconvert/test.sqdb?debug=1
-    rm.py -f C:/projects/sqlconvert/test.sqdb
+    -rm.py -f {env:TEMP}/test.sqdb
+    pytest -D sqlite:/{env:TEMP}/test.sqdb?debug=1
+    rm.py -f {env:TEMP}/test.sqdb
 
-[testenv:{py27,py34,py35,py36,py37,py38,py39}-postgres]
+[testenv:{py27,py34,py35,py36,py37,py38,py39}-postgres{,-w32}]
 commands =
     {[testenv]commands}
-    -dropdb -U postgres -w test
-    createdb -U postgres -w test
-    {envpython} -m pytest --cov=sqlconvert -D postgres://postgres:@localhost/test
-    dropdb -U postgres -w test
-
-[testenv:{py27,py34,py35,py36,py37,py38,py39}-postgres-w32]
-platform = win32
-commands =
-    {[testenv]commands}
-    -dropdb -U postgres -w test
-    createdb -U postgres -w test
-    pytest --cov=sqlconvert -D "postgres://postgres:Password12!@localhost/test"
-    dropdb -U postgres -w test
+    -dropdb --username=runner test
+    createdb --username=runner test
+    {envpython} -m pytest -D postgres://runner:test@localhost/test
+    dropdb --username=runner test
 
 # flake8
 [testenv:{py27,py34,py35,py36,py37,py38,py39}-flake8]
-platform = linux|win32
 deps =
     flake8
 commands =