From 3499a4b3e4ea61c8e4524f2839721989b3b76d2e Mon Sep 17 00:00:00 2001 From: katzy687 Date: Sun, 9 Jan 2022 19:38:51 +0200 Subject: [PATCH] reset version and change package name --- .github/workflows/lint-test.yml | 27 +++++++++++ .github/workflows/release.yml | 83 +++++++++++++++++++++++++++++++++ requirements.txt | 2 +- setup.cfg | 8 ++-- version.txt | 2 +- 5 files changed, 117 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/lint-test.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.yml new file mode 100644 index 0000000..70e84c9 --- /dev/null +++ b/.github/workflows/lint-test.yml @@ -0,0 +1,27 @@ +name: Lint and Test + +on: + pull_request: + branches: [master] + push: + branches: [master] + +jobs: + lint-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - name: install ALL dependencies + run: | + pip install -U -r requirements-dev.txt + pip install -U -r requirements.txt + pip install . + - name: run pre-commit linters and formatters + uses: pre-commit/action@v2.0.3 + - name: run pytest tests + run: python -m pytest --import-mode=append tests/ --cov + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..baca2f4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,83 @@ +# setup tools guide used as base template - https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ +# wait on check action used to wait for tests to finish - https://github.com/marketplace/actions/wait-on-check +name: Release + +on: + push: + tags: + - 'v*' + +jobs: + build-n-publish: + name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI + runs-on: ubuntu-latest + + steps: + - name: Wait for lint and tests to succeed + uses: lewagon/wait-on-check-action@v0.2 + with: + ref: ${{ github.ref }} + check-name: 'lint-test' + repo-token: ${{ secrets.GITHUB_TOKEN }} + wait-interval: 10 + + - name: Checkout Code + uses: actions/checkout@master + + - name: Validate tag version - compare version.txt to tag + run: | + version=$(cat ./version.txt) + tag=${GITHUB_REF/refs\/tags\//} + tag="${tag:1}" # remove the 'v' prefix from the tag that triggered this action + echo $version + echo $tag + if [ "$tag" == "$version" ] + then + echo "Tag and version are equal" + else + echo "Error: Tag and version are not equal, cannot create a release" + exit 1 + fi + + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Install pypa/build + run: >- + python -m + pip install + build + --user + + - name: Build a binary wheel and a source tarball + run: >- + python -m + build + --sdist + --wheel + --outdir dist/ + . + + - name: Publish distribution 📦 to Test PyPI + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.TEST_PYPI_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + skip_existing: true # skip duplicate uploads to test pypi + + - name: Publish distribution 📦 to Real PyPI + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.PYPI_API_TOKEN }} + + + - name: Create Github Release and Upload Artifacts + uses: softprops/action-gh-release@v1 + with: + files: dist/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 9bcc92b..471039c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ requests>=2,<3 -abstract-http-client \ No newline at end of file +abstract-http-client>=1,<2 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 06172dc..5c6ed9f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [metadata] -name = cloudshell_sandboxapi_wrapper +name = cloudshell-sandbox-rest version = file: version.txt author = QualiLab author_email = support@qualisystems.com @@ -20,8 +20,10 @@ package_dir = = src packages = find: python_requires = >=3.7 -install_requires = - requests>=2 +install_requires =[ + requests>=2, <3 + abstract-http-client>=1,<2 +] [options.packages.find] where = src \ No newline at end of file diff --git a/version.txt b/version.txt index 359a5b9..6c6aa7c 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2.0.0 \ No newline at end of file +0.1.0 \ No newline at end of file