diff --git a/.github/actions/build-dist/action.yml b/.github/actions/build-dist/action.yml new file mode 100644 index 0000000..8210603 --- /dev/null +++ b/.github/actions/build-dist/action.yml @@ -0,0 +1,26 @@ +name: Build incremental +description: Build and upload sdist and wheel + +runs: + using: "composite" + steps: + + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - run: pip install build twine + shell: bash + + - run: python3 -m build + shell: bash + + - run: twine check dist/*.* + shell: bash + + - uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/*.* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9fb0461 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Release + +on: + push: + tags: ["incremental-*"] + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-24.04 + + steps: + - uses: ./.github/actions/build-dist + + pypi-publish: + runs-on: ubuntu-24.04 + if: startsWith(github.ref, 'refs/tags/incremental-') + needs: [build] + + environment: + name: release + url: https://pypi.org/p/incremental + + permissions: + id-token: write + + steps: + + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index db25f29..f0f90f7 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -25,8 +25,15 @@ defaults: jobs: + build: + runs-on: ubuntu-24.04 + + steps: + - uses: ./.github/actions/build-dist + testing: runs-on: ubuntu-24.04 + needs: [build] env: TOXENV: "${{ matrix.tox-env }}" name: ${{ matrix.python-version }}-${{ matrix.tox-env }} @@ -55,14 +62,20 @@ jobs: python-version: ${{ matrix.python-version }} - uses: twisted/python-info-action@v1 + - name: Install dependencies run: | python -m pip install --upgrade pip tox + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + - name: Run job via tox run: | # GitHub Actions VM have 2 CPUs. - TOX_PARALLEL_NO_SPINNER=1 tox --parallel 2 + TOX_PARALLEL_NO_SPINNER=1 tox --parallel 2 --installpkg dist/*.whl - name: Prepare GitHub Pages if: contains(matrix['tox-env'], 'apidocs') @@ -73,7 +86,7 @@ jobs: - name: Publish documentation for push on trunk # Since we don't have a separate job for apidocs gh-pages updating - # hijack the normal apidoc test and publish the resulting files. + # hijack the normal apidoc test and publish the resulting files. if: contains(matrix['tox-env'], 'apidocs') && github.event_name == 'push' uses: peaceiris/actions-gh-pages@v3 with: diff --git a/.gitignore b/.gitignore index c92c7ea..d5a7e37 100644 --- a/.gitignore +++ b/.gitignore @@ -5,16 +5,15 @@ _trial_temp*/ build/ dropin.cache -doc/ -docs/_build/ -dist/ -venv/ -htmlcov/ +/doc/ +/docs/_build/ +/dist/ +/htmlcov/ .coverage .coverage.* *~ *.lock apidocs/ -.tox/ -.DS_Store +/.tox/ +.DS_Store/ coverage.xml