diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..19f0337 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + groups: + github-actions: + patterns: + - "*" # Group all Actions updates into a single larger pull request + schedule: + interval: weekly diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..77b8c0b --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,48 @@ +name: deploy + +on: + workflow_dispatch: + inputs: + version: + description: 'Release version' + required: true + default: '1.2.3' + +jobs: + + package: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Build and Check Package + uses: hynek/build-and-inspect-python-package@v2.11 + + deploy: + needs: package + runs-on: ubuntu-latest + permissions: + id-token: write # For PyPI trusted publishers. + contents: write # For tag. + + steps: + - uses: actions/checkout@v4 + + - name: Download Package + uses: actions/download-artifact@v4 + with: + name: Packages + path: dist + + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@v1.12.3 + with: + attestations: true + + - name: GitHub Release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create v${{ github.event.inputs.version }} --target=${{ github.ref_name }} --title v${{ github.event.inputs.version }} + gh pr merge ${{ github.ref_name }} --merge diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 92932a4..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: build - -on: [push, pull_request] - -jobs: - build: - - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - python: ["3.8", "3.9", "3.10", "3.11"] - os: [ubuntu-latest, windows-latest] - include: - - python: "3.8" - tox_env: "py38" - - python: "3.9" - tox_env: "py39" - - python: "3.10" - tox_env: "py310,pytest6" - - python: "3.11" - tox_env: "py311" - - steps: - - uses: actions/checkout@v3 - - 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 - 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@v1 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: "3.11" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build - - name: Build package - run: | - python -m build - - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.pypi_token }} - - name: GitHub Release - uses: softprops/action-gh-release@v1 - with: - files: dist/* diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..05d8b9c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,60 @@ +name: Test + +on: + push: + branches: + - main + - "test-me-*" + + pull_request: + branches: + - "*" + +env: + FORCE_COLOR: 1 + +# Cancel running jobs for the same workflow and branch. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + package: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build and Check Package + uses: hynek/build-and-inspect-python-package@v2.11 + + test: + needs: [package] + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11"] + os: [ubuntu-latest, windows-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Download Package + uses: actions/download-artifact@v4 + with: + name: Packages + path: dist + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install tox + run: | + python -m pip install --upgrade pip + python -m pip install --upgrade tox + + - name: Test + shell: bash + run: | + tox run -e py --installpkg `find dist/*.tar.gz` diff --git a/HOWTORELEASE.rst b/HOWTORELEASE.rst index 2f2a7a8..f1b9ff4 100644 --- a/HOWTORELEASE.rst +++ b/HOWTORELEASE.rst @@ -1,10 +1,15 @@ Here are the steps on how to make a new release. -#. Create a ``release-VERSION`` branch from ``upstream/master``. +#. Create a ``release-VERSION`` branch from ``origin/master``. #. Update ``CHANGELOG.rst``. #. Push a branch with the changes. #. Wait for all builds to pass and at least one approval. -#. Push a tag ``VERSION`` to ``upstream``. -#. Merge the PR. +#. Start the ``deploy`` workflow: + + .. code-block:: console + + gh workflow run deploy.yml -R esss/pytest-regressions --ref release-VERSION --field version=VERSION + + The PR will be automatically merged. After this, the package should be published directly to PyPI. After a few hours, it should be picked up by the conda-forge bot, where one of the maintainers need to merge it so the package can be published (another couple of hours after that). diff --git a/setup.py b/setup.py index eb19518..e5bab7e 100644 --- a/setup.py +++ b/setup.py @@ -21,6 +21,7 @@ def read(fname: str) -> str: url="https://github.com/ESSS/pytest-regressions", description="Easy to use fixtures to write regression tests.", long_description=read("README.rst"), + long_description_content_type="text/x-rst", packages=find_packages("src"), package_dir={"": "src"}, python_requires=">=3.8",