1
1
mirror of https://github.com/yandex/pgmigrate.git synced 2024-09-19 16:17:24 +03:00

Upgrade test environment

1) Upgrade actions to use non-deprecated versions
2) Move docker to jammy
3) Move actions and docker to python 3.11
4) Upgrade yapf and apply it to pgmigrate.py
5) Pin flake8-isort version
This commit is contained in:
secwall 2022-11-19 12:20:32 +03:00
parent 3792a974c7
commit 89cab36e43
4 changed files with 23 additions and 17 deletions

View File

@ -12,19 +12,19 @@ jobs:
name: Run tests and linters name: Run tests and linters
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Set up Python 2.7 - name: Set up Python 2.7
uses: actions/setup-python@v1 uses: actions/setup-python@v4
with: with:
python-version: 2.7 python-version: 2.7
- name: Set up Python 3.8 - name: Set up Python 3.11
uses: actions/setup-python@v1 uses: actions/setup-python@v4
with: with:
python-version: 3.8 python-version: 3.11
- name: Install tox - name: Install tox
run: | run: |
python3.8 -m pip install --upgrade pip python3.11 -m pip install --upgrade pip
python3.8 -m pip install tox python3.11 -m pip install tox
- name: Start PostgreSQL - name: Start PostgreSQL
run: sudo service postgresql start run: sudo service postgresql start
- name: Create PostgreSQL test env - name: Create PostgreSQL test env

View File

@ -1,11 +1,11 @@
# vim:set ft=dockerfile: # vim:set ft=dockerfile:
FROM ubuntu:focal FROM ubuntu:jammy
# explicitly set user/group IDs # explicitly set user/group IDs
RUN groupadd -r postgres --gid=999 && useradd -r -d /var/lib/postgresql -g postgres --uid=999 postgres RUN groupadd -r postgres --gid=999 && useradd -r -d /var/lib/postgresql -g postgres --uid=999 postgres
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default # make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
RUN apt-get update && apt-get install -y software-properties-common locales && \ RUN apt-get update && apt-get install -y ca-certificates locales && \
rm -rf /var/lib/apt/lists/* && \ rm -rf /var/lib/apt/lists/* && \
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.utf8 ENV LANG en_US.utf8
@ -13,7 +13,8 @@ ENV DEBIAN_FRONTEND noninteractive
ENV PG_MAJOR 15 ENV PG_MAJOR 15
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
RUN echo 'deb https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu/ jammy main' > /etc/apt/sources.list.d/deadsnakes-ubuntu-ppa.list
RUN apt-get -o Acquire::AllowInsecureRepositories=true \ RUN apt-get -o Acquire::AllowInsecureRepositories=true \
-o Acquire::AllowDowngradeToInsecureRepositories=true update \ -o Acquire::AllowDowngradeToInsecureRepositories=true update \
@ -24,12 +25,16 @@ RUN apt-get -o Acquire::AllowInsecureRepositories=true \
install -y postgresql-common \ install -y postgresql-common \
sudo \ sudo \
libpq-dev \ libpq-dev \
python3-pip \
python2.7-dev \ python2.7-dev \
python3.8-dev \ python3.11-dev \
python3.11-lib2to3 \
build-essential \
curl \
postgresql-$PG_MAJOR \ postgresql-$PG_MAJOR \
postgresql-contrib-$PG_MAJOR \ postgresql-contrib-$PG_MAJOR \
&& pip3 install tox && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
&& python3.11 get-pip.py \
&& pip3.11 install tox
COPY ./ /dist COPY ./ /dist

View File

@ -97,6 +97,7 @@ class ConflictTerminator(threading.Thread):
""" """
Kills conflicting pids (only on postgresql > 9.6) Kills conflicting pids (only on postgresql > 9.6)
""" """
def __init__(self, conn_str, interval): def __init__(self, conn_str, interval):
threading.Thread.__init__(self, name='terminator') threading.Thread.__init__(self, name='terminator')
self.daemon = True self.daemon = True

View File

@ -4,7 +4,7 @@
# and then run "tox" from this directory. # and then run "tox" from this directory.
[tox] [tox]
envlist = py27, py38, flake8, pylint, yapf envlist = py27, py311, flake8, pylint, yapf
[testenv:py27] [testenv:py27]
whitelist_externals = rm whitelist_externals = rm
@ -19,7 +19,7 @@ deps = behave
coverage coverage
func_timeout func_timeout
[testenv:py38] [testenv:py311]
whitelist_externals = rm whitelist_externals = rm
commands = rm -rf htmlcov commands = rm -rf htmlcov
coverage erase coverage erase
@ -35,7 +35,7 @@ deps = behave
commands = flake8 pgmigrate.py setup.py commands = flake8 pgmigrate.py setup.py
deps = flake8 deps = flake8
flake8-string-format flake8-string-format
flake8-isort>=4.0.0 flake8-isort==5.0.0
flake8-commas flake8-commas
flake8-quotes flake8-quotes
flake8-copyright flake8-copyright
@ -47,7 +47,7 @@ deps = pylint
[testenv:yapf] [testenv:yapf]
commands = yapf -pd pgmigrate.py commands = yapf -pd pgmigrate.py
deps = yapf==0.29.0 deps = yapf==0.32.0
[flake8] [flake8]
copyright-check = True copyright-check = True