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 9ddfbc9 commit 23236c6
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 9 deletions.
25 changes: 25 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
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

- run: python3 -m build
shell: bash

- run: twine check dist/*.*
shell: bash

- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/*.*
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on:
push:
tags: ["incremental-*"]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-24.04

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
15 changes: 13 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ defaults:


jobs:
build:
name: Build
uses: ./.github/actions/build

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 +60,20 @@ jobs:
python-version: ${{ matrix.python-version }}

- uses: twisted/python-info-action@v1

- name: Install dependencies
run: |
python -m pip install --upgrade pip tox
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 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 23236c6

Please sign in to comment.