diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 26a3ec6..37bae47 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,29 +2,24 @@ include: - project: nci-gdc/gitlab-templates - ref: 0.2.0 + ref: 0.2.1 file: - templates/global/full.yaml - templates/python/full.yaml - templates/common/python.yaml tox: - stage: test parallel: matrix: - - PYTHON_VERSION: [ '3.6', '3.7', '3.8', '3.9' ] - image: ${BASE_CONTAINER_REGISTRY}/python${PYTHON_VERSION}-builder + - BUILD_PY_VERSION: [ 'python3.6', 'python3.7', 'python3.8', 'python3.9' ] services: - name: docker.osdc.io/ncigdc/ci-postgres-13:${BASE_CONTAINER_VERSION} alias: postgres - tags: - - dind variables: - BASE_CONTAINER_VERSION: 2.3.1 # these are for postgres docker POSTGRES_DB: automated_test - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres + POSTGRES_USER: gdc_test + POSTGRES_PASSWORD: gdc_test POSTGRES_HOST_AUTH_METHOD: trust PG_HOST: postgres before_script: @@ -34,15 +29,9 @@ tox: - tox -r -e py -# used by release -.python_versions: +release: parallel: matrix: - - BUILD_PY_VERSION: [python3.6] - - RELEASE_PY_VERSION: [python3.6] - -release: + - RELEASE_PY_VERSION: [ python3.6 ] before_script: - git fetch --unshallow || true - variables: - LEGACY_BASE_CONTAINER_VERSION: 2.3.0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d83550b..abc2115 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,10 +1,10 @@ repos: + - repo: https://github.com/psf/black + rev: 22.3.0 + hooks: + - id: black - repo: git@github.com:Yelp/detect-secrets rev: v1.4.0 hooks: - id: detect-secrets args: ['--baseline', '.secrets.baseline'] - - repo: https://github.com/psf/black - rev: 22.3.0 - hooks: - - id: black diff --git a/.secrets.baseline b/.secrets.baseline index 2490387..10614b4 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -122,9 +122,9 @@ { "type": "Secret Keyword", "filename": ".gitlab-ci.yml", - "hashed_secret": "afc848c316af1a89d49826c5ae9d00ed769415f3", + "hashed_secret": "58106e026393e6fedebefcdb423192d32cd7210a", "is_verified": false, - "line_number": 27, + "line_number": 22, "is_secret": false } ], @@ -157,17 +157,7 @@ "line_number": 13, "is_secret": false } - ], - "psql-users.sh": [ - { - "type": "Secret Keyword", - "filename": "psql-users.sh", - "hashed_secret": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3", - "is_verified": false, - "line_number": 1, - "is_secret": true - } ] }, - "generated_at": "2023-07-19T23:58:43Z" + "generated_at": "2023-08-25T14:30:18Z" } diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3234a86..0000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -language: python -dist: focal - -python: - - "3.6" - - "3.7" - - "3.8" - - "3.9" - -addons: - postgresql: "13" - apt: - sources: - - sourceline: deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main 13 - key_url: https://www.postgresql.org/media/keys/ACCC4CF8.asc - packages: - - postgresql-13 - - postgresql-client-13 - -before_install: - # Copy custom configs from the repo because PG-13 isn't set up to run like - # it normally does on Travis out of the box. - - sudo cp travis/postgresql.conf /etc/postgresql/13/main/postgresql.conf - - sudo cp travis/pg_hba.conf /etc/postgresql/13/main/pg_hba.conf - - sudo pg_ctlcluster 13 main restart - -install: "pip install tox-travis" - -before_script: - - psql -c 'create database automated_test;' -U postgres - -script: "tox" diff --git a/dev-requirements.txt b/dev-requirements.txt deleted file mode 100644 index 3fa2972..0000000 --- a/dev-requirements.txt +++ /dev/null @@ -1,84 +0,0 @@ -# -# This file is autogenerated by pip-compile with python 3.6 -# To update, run: -# -# pip-compile --extra=dev --output-file=dev-requirements.txt -# -attrs==22.2.0 - # via pytest -cdisutils @ git+https://git@github.com/NCI-GDC/cdisutils.git@1.3.0 - # via gdc-ng-models (setup.py) -cffi==1.15.1 - # via cryptography -coverage[toml]==6.2 - # via pytest-cov -cryptography==3.4.8 - # via - # gdc-ng-models (setup.py) - # pyopenssl -et-xmlfile==1.1.0 - # via openpyxl -flake8==5.0.4 - # via gdc-ng-models (setup.py) -importlib-metadata==4.2.0 - # via - # flake8 - # pluggy - # pytest -iniconfig==1.1.1 - # via pytest -jdcal==1.4.1 - # via openpyxl -mccabe==0.7.0 - # via flake8 -ndg-httpsclient==0.4.3 - # via cdisutils -openpyxl==2.4.0 - # via cdisutils -packaging==21.3 - # via pytest -pluggy==1.0.0 - # via pytest -psycopg2==2.9.6 - # via gdc-ng-models (setup.py) -py==1.11.0 - # via pytest -pyasn1==0.5.0 - # via ndg-httpsclient -pycodestyle==2.9.1 - # via flake8 -pycparser==2.21 - # via cffi -pyflakes==2.5.0 - # via flake8 -pyopenssl==16.2.0 - # via - # cdisutils - # ndg-httpsclient -pyparsing==3.0.9 - # via packaging -pytest==7.0.1 - # via - # gdc-ng-models (setup.py) - # pytest-cov -pytest-cov==4.0.0 - # via gdc-ng-models (setup.py) -pytz==2020.5 - # via gdc-ng-models (setup.py) -six==1.16.0 - # via pyopenssl -sqlalchemy==1.3.24 - # via gdc-ng-models (setup.py) -tomli==1.2.3 - # via - # coverage - # pytest -typing-extensions==4.1.1 - # via importlib-metadata -xmltodict==0.9.2 - # via cdisutils -zipp==3.6.0 - # via importlib-metadata - -# The following packages are considered to be unsafe in a requirements file: -# setuptools diff --git a/gdc_ng_models/snacks/database.py b/gdc_ng_models/snacks/database.py index f8d737b..8e7ef35 100644 --- a/gdc_ng_models/snacks/database.py +++ b/gdc_ng_models/snacks/database.py @@ -15,8 +15,8 @@ def get_configs(): return { "host": os.environ.get("PG_HOST", "localhost"), "database": os.environ.get("PG_NAME", "automated_test"), - "admin_user": os.environ.get("PG_USER", "postgres"), - "admin_password": os.environ.get("PG_PASS", "postgres"), + "admin_user": os.environ.get("PG_USER", "gdc_test"), + "admin_password": os.environ.get("PG_PASS", "gdc_test"), } diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 34131cd..0000000 --- a/requirements.txt +++ /dev/null @@ -1,18 +0,0 @@ -# -# This file is autogenerated by pip-compile with python 3.6 -# To update, run: -# -# pip-compile -# -cffi==1.15.1 - # via cryptography -cryptography==3.4.8 - # via gdc-ng-models (setup.py) -psycopg2==2.9.6 - # via gdc-ng-models (setup.py) -pycparser==2.21 - # via cffi -pytz==2020.5 - # via gdc-ng-models (setup.py) -sqlalchemy==1.3.24 - # via gdc-ng-models (setup.py) diff --git a/service_wrapper.sh b/service_wrapper.sh deleted file mode 100755 index a6fa7c0..0000000 --- a/service_wrapper.sh +++ /dev/null @@ -1,13 +0,0 @@ -#! /usr/bin/env bash - -export PG_HOST=localhost -export PG_NAME=automated_test -export PG_USER=gdc_test -export PG_PASS=gdc_test - -export PG_ADMIN_USER=postgres -export PG_ADMIN_PASS=postgres - -# To use: -# ./service_wrapper.sh pytest -$@ \ No newline at end of file diff --git a/setup.py b/setup.py index 1070ddf..a08a5b4 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ "flake8", "pytest", "pytest-cov", - "cdisutils @ git+https://git@github.com/NCI-GDC/cdisutils.git@1.3.0#egg=cdisutils", + "cdisutils", ], "alembic": ["alembic~=1.4"], }, diff --git a/tox.ini b/tox.ini index fa9f6f9..203bf31 100644 --- a/tox.ini +++ b/tox.ini @@ -8,7 +8,7 @@ setenv = NO_PROXY=localhost,postgres no_proxy=localhost,postgres deps= - -rdev-requirements.txt + .[dev] commands= pytest -vvs --cov gdc_ng_models --cov-report xml --cov-report html --junit-xml test-reports/results.xml {posargs} diff --git a/travis/pg_hba.conf b/travis/pg_hba.conf deleted file mode 100644 index ace2091..0000000 --- a/travis/pg_hba.conf +++ /dev/null @@ -1,10 +0,0 @@ -# This config file will be used for the Travis test run. -# -# The new PostgreSQL 13 changes some settings from what they originally were -# in Travis, so we'll set them back. In particular we want to enable -# passwordless authentication for connections to PostgreSQL. - -local all postgres trust -local all all trust -host all all 127.0.0.1/32 trust -host all all ::1/128 trust diff --git a/travis/postgresql.conf b/travis/postgresql.conf deleted file mode 100644 index 0a07292..0000000 --- a/travis/postgresql.conf +++ /dev/null @@ -1,32 +0,0 @@ -# This config file will be used for PostgreSQL 13 because Travis doesn't -# have configurations set up for it yet. The most important part will be the -# ramfs storage location change. It also defaults to port 5433 so we need to -# change that back, too. - -data_directory = '/var/ramfs/postgresql/13/main' -hba_file = '/etc/postgresql/13/main/pg_hba.conf' -ident_file = '/etc/postgresql/13/main/pg_ident.conf' -external_pid_file = '/var/run/postgresql/13-main.pid' -port = 5432 -max_connections = 255 -unix_socket_directories = '/var/run/postgresql' -ssl = on -ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem' -ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key' -shared_buffers = 128MB -dynamic_shared_memory_type = posix -max_wal_size = 256MB -min_wal_size = 80MB -log_line_prefix = '%t ' -log_timezone = 'UTC' -cluster_name = '13/main' -stats_temp_directory = '/var/run/postgresql/13-main.pg_stat_tmp' -datestyle = 'iso, mdy' -timezone = 'UTC' -lc_messages = 'en_US.UTF-8' -lc_monetary = 'en_US.UTF-8' -lc_numeric = 'en_US.UTF-8' -lc_time = 'en_US.UTF-8' -default_text_search_config = 'pg_catalog.english' -include_dir = 'conf.d' -fsync = false