Skip to content

Commit

Permalink
Actions refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
twm committed Jul 7, 2024
1 parent 2a50e4c commit 24fc0c9
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 9 deletions.
26 changes: 26 additions & 0 deletions .github/actions/build-dist/action.yml
Original file line number Diff line number Diff line change
@@ -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/*.*
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
17 changes: 15 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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')
Expand All @@ -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:
Expand Down
13 changes: 6 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 24fc0c9

Please sign in to comment.