diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 364af00..4d07567 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,100 +4,68 @@ # - docker:dind # When using dind, it's wise to use the overlayfs driver for # improved performance. - stages: - test - - push - - deploy - - clean - -before_script: - - make -e login + - publish + - check_published -.test: &test_definition - stage: test - script: - - make -e test-$PYTHON_VERSION - except: - - tags # Avoid unnecessary double testing - -test-3.6: - <<: *test_definition +docker: + stage: publish + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] variables: - PYTHON_VERSION: "3.6" - -test-3.7: - <<: *test_definition - allow_failure: true - variables: - PYTHON_VERSION: "3.7" - -push: - stage: push + PYTHON_VERSION: "3.10" + tags: + - docker script: - - make -e push + - sed "s/{{PYVERSION}}/$PYTHON_VERSION/" Dockerfile.template > Dockerfile + - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"},\"https://index.docker.io/v1\":{\"auth\":\"$HUB_AUTH\"}}" > /kaniko/.docker/config.json + # The skip-tls-verify flag is there because our registry certificate is self signed + - /kaniko/executor --context $CI_PROJECT_DIR --skip-tls-verify --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG --destination $HUB_REPO:$CI_COMMIT_TAG only: - tags - - triggers - - fix-makefiles -push-latest: - stage: push +testpy37: + tags: + - docker + image: python:3.7 + stage: test script: - - make -e push-latest - only: - - master - - triggers - - fix-makefiles + - pip install -r requirements.txt -r test-requirements.txt + - python setup.py test -push-github: - stage: deploy +testpy310: + tags: + - docker + image: python:3.10 + stage: test script: - - make -e push-github - only: - - master - - triggers - - fix-makefiles + - pip install -r requirements.txt -r test-requirements.txt + - python setup.py test -deploy_pypi: - stage: deploy - script: # Configure the PyPI credentials, then push the package, and cleanup the creds. - - echo "[server-login]" >> ~/.pypirc - - echo "repository=https://upload.pypi.org/legacy/" >> ~/.pypirc - - echo "username=" ${PYPI_USER} >> ~/.pypirc - - echo "password=" ${PYPI_PASSWORD} >> ~/.pypirc - - make pip_upload - - echo "" > ~/.pypirc && rm ~/.pypirc # If the above fails, this won't run. +push_pypi: only: - - /^v?\d+\.\d+\.\d+([abc]\d*)?$/ # PEP-440 compliant version (tags) - except: - - branches - -deploy: - stage: deploy - environment: test + - tags + tags: + - docker + image: python:3.7 + stage: publish script: - - make -e deploy - only: - - master - - fix-makefiles + - echo $CI_COMMIT_TAG > senpy/VERSION + - pip install twine + - python setup.py sdist bdist_wheel + - TWINE_PASSWORD=$PYPI_PASSWORD TWINE_USERNAME=$PYPI_USERNAME python -m twine upload dist/* -push-github: - stage: deploy - script: - - make -e push-github +check_pypi: only: - - master - - triggers - -clean : - stage: clean + - tags + tags: + - docker + image: python:3.7 + stage: check_published script: - - make -e clean - when: manual - -cleanup_py: - stage: clean - when: always # this is important; run even if preceding stages failed. - script: - - rm -vf ~/.pypirc # we don't want to leave these around, but GitLab may clean up anyway. + - pip install senpy==$CI_COMMIT_TAG + # Allow PYPI to update its index before we try to install + when: delayed + start_in: 10 minutes diff --git a/senpy/blueprints.py b/senpy/blueprints.py index cf9ba50..cff01d8 100644 --- a/senpy/blueprints.py +++ b/senpy/blueprints.py @@ -204,8 +204,8 @@ def basic_api(f): return decorated_function -@api_blueprint.route('/', defaults={'plugins': None}, methods=['POST', 'GET']) -@api_blueprint.route('/', methods=['POST', 'GET']) +@api_blueprint.route('/', defaults={'plugins': None}, methods=['POST', 'GET'], strict_slashes=False) +@api_blueprint.route('/', methods=['POST', 'GET'], strict_slashes=False) @basic_api def api_root(plugins): if plugins: