diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..bc1ae15 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,55 @@ +name: deploy + +on: + workflow_dispatch: + inputs: + version: + description: 'Release version' + required: true + default: '1.2.3' + +jobs: + + package: + runs-on: ubuntu-latest + env: + SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.version }} + + steps: + - uses: actions/checkout@v3 + + - name: Build and Check Package + uses: hynek/build-and-inspect-python-package@v1.5 + + deploy: + needs: package + runs-on: ubuntu-latest + environment: deploy + permissions: + id-token: write # For PyPI trusted publishers. + contents: write # For tag and release notes. + + steps: + - uses: actions/checkout@v3 + + - name: Download Package + uses: actions/download-artifact@v3 + with: + name: Packages + path: dist + + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@v1.8.5 + + - name: Push tag + run: | + git config user.name "pytest bot" + git config user.email "pytestbot@gmail.com" + git tag --annotate --message=${{ github.event.inputs.version }} ${{ github.event.inputs.version }} ${{ github.sha }} + git push origin ${{ github.event.inputs.version }} + + - name: GitHub Release + uses: softprops/action-gh-release@v1 + with: + files: dist/* + tag_name: ${{ github.event.inputs.version }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 7a6d6d8..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: build - -on: - push: - branches: - - master - paths-ignore: - - 'docs/**' - - '*.md' - - '*.rst' - pull_request: - branches: - - master - paths-ignore: - - 'docs/**' - - '*.md' - - '*.rst' -jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python: [3.7", "3.8", "3.9"] - os: [ubuntu-latest, macos-latest] - include: - - python: "3.7" - tox_env: "py37" - - python: "3.8" - tox_env: "py38" - - python: "3.9" - tox_env: "py39" - - python: "3.8" - tox_env: "pre" - - python: "3.8" - tox_env: "linting" - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python }} - - name: Install tox - run: | - python -m pip install --upgrade pip - pip install tox - - name: Test - run: | - tox -e ${{ matrix.tox_env }} - deploy: - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') - runs-on: ubuntu-latest - needs: build - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.8" - - name: Install wheel - run: | - python -m pip install --upgrade pip - pip install --upgrade wheel setuptools - - name: Build package - run: | - python setup.py sdist bdist_wheel - - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.pypi_token }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..7ddf9e5 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,59 @@ +name: test + +on: + push: + branches: + - main + - "test-me-*" + + pull_request: + + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + + package: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build and Check Package + uses: hynek/build-and-inspect-python-package@v1.5 + + test: + + needs: [package] + + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + python: ["3.7", "3.8", "3.9"] + os: [ubuntu-latest, windows-latest] + + steps: + - uses: actions/checkout@v3 + + - name: Download Package + uses: actions/download-artifact@v3 + with: + name: Packages + path: dist + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + + - name: Install tox + run: | + python -m pip install --upgrade pip + pip install tox + + - name: Test + shell: bash + run: | + tox run -e py --installpkg `find dist/*.tar.gz` diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aa5cd4c..8c4af08 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,7 +27,7 @@ repos: - id: rst name: rst entry: rst-lint --encoding utf-8 - files: ^(HOWTORELEASE.rst|README.rst)$ + files: ^(RELEASING.rst|README.rst)$ language: python additional_dependencies: [pygments, restructuredtext_lint] - repo: https://github.com/myint/autoflake.git diff --git a/HOWTORELEASE.rst b/HOWTORELEASE.rst deleted file mode 100644 index 25bf2a7..0000000 --- a/HOWTORELEASE.rst +++ /dev/null @@ -1,29 +0,0 @@ -======================= -Releasing pytest-flask -======================= - -This document describes the steps to make a new ``pytest-flask`` release. - -Version -------- - -``master`` should always be green and a potential release candidate. ``pytest-flask`` follows -semantic versioning, so given that the current version is ``X.Y.Z``, to find the next version number -one needs to look at the ``docs/changelog.rst`` file. - -Steps ------ - -#. Create a new branch named ``release-X.Y.Z`` from the latest ``master``. - -#. After making the necessary changes, commit and push the branch for review. - -#. Once PR is **green** and **approved**, create and push a tag:: - - $ export VERSION=X.Y.Z - $ git tag $VERSION release-$VERSION - $ git push git@github.com:pytest-dev/pytest-flask.git $VERSION - - That will build the package and publish it on ``PyPI`` automatically. - -#. Merge ``release-X.Y.Z`` branch into master. diff --git a/RELEASING.rst b/RELEASING.rst new file mode 100644 index 0000000..8db6e7c --- /dev/null +++ b/RELEASING.rst @@ -0,0 +1,7 @@ +Here are the steps on how to make a new release. + +1. Create a ``release-VERSION`` branch from ``upstream/main``. +2. Update ``CHANGELOG.rst``. +3. Push the branch to ``upstream``. +4. Once all tests pass, start the ``deploy`` workflow manually. +5. Merge the PR. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..68d829b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,9 @@ +[build-system] +requires = [ + "setuptools", + "setuptools-scm[toml]", +] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +write_to = "pytest_flask/_version.py" diff --git a/requirements/main.txt b/requirements/main.txt index f62409f..17ab14e 100644 --- a/requirements/main.txt +++ b/requirements/main.txt @@ -1,3 +1,3 @@ pytest>=5.2 -Flask +Flask <3.0 Werkzeug>=0.7 diff --git a/setup.cfg b/setup.cfg index 1d13009..963e0b5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,6 +7,7 @@ keywords = pytest, flask, testing author_email = vital.kudzelka@gmail.com url = https://github.com/pytest-dev/pytest-flask long_description = file: README.rst, docs/changelog.rst, LICENSE +long_description_content_type = text/x-rst description = A set of py.test fixtures to test Flask applications. project_urls = Source = https://github.com/pytest-dev/pytest-flask diff --git a/tox.ini b/tox.ini index cd65a9c..1003554 100644 --- a/tox.ini +++ b/tox.ini @@ -26,8 +26,6 @@ deps = -rrequirements/main.txt -rrequirements/test.txt -passenv = HOME LANG LC_ALL - commands = coverage run -m pytest {posargs:tests} coverage combine