Skip to content

Commit

Permalink
ci: speed up testing (#93)
Browse files Browse the repository at this point in the history
* ci: speed up testing

Signed-off-by: Henry Schreiner <[email protected]>

* chore: remove pkg job with faster/better check in CI already

* Update .github/workflows/test.yml

---------

Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii authored Oct 22, 2024
1 parent 55b2d6d commit 500c53c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 34 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
name: deploy

on:
workflow_dispatch:
pull_request:
push:
branches:
- main
tags:
- v*

jobs:
deploy:
dist:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v4
- uses: hynek/build-and-inspect-python-package@v2

- name: Set up Python
uses: actions/setup-python@v5
deploy:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
python-version: '3.11'

- name: Install dependencies for build
run: pip install --upgrade setuptools build

- name: Build
run: python -m build
name: Packages
path: dist

- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
16 changes: 10 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install test dependencies
run: pip install tox tox-gh-actions
- uses: astral-sh/setup-uv@v3

- name: Test packaging
run: tox -e pkg
- name: Install tox
run: uv tool install --with tox-gh-actions --with tox-uv tox

- name: Run tests with PyTest 6
run: tox
Expand All @@ -57,7 +56,12 @@ jobs:

post-test:
name: All tests passed
if: always()
needs: [test]
runs-on: ubuntu-latest
needs: test
timeout-minutes: 2
steps:
- run: echo ok
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
15 changes: 0 additions & 15 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[tox]
envlist =
py{38,39,310,311,312}-pytest{6,7,8}
pkg

[gh-actions]
python =
Expand All @@ -25,17 +24,3 @@ deps =
pytest8: pytest>=8.0.0,<9.0.0

commands = {envpython} -m pytest {posargs}

[testenv:pkg]
skip_install = true
deps =
twine
build
commands =
{envpython} -c 'import os.path, shutil, sys; \
dist_dir = os.path.join("{toxinidir}", "dist"); \
os.path.isdir(dist_dir) or sys.exit(0); \
print("Removing \{!s\} contents...".format(dist_dir), file=sys.stderr); \
shutil.rmtree(dist_dir)'
{envpython} -m build --outdir {toxinidir}/dist/ {toxinidir}
{envpython} -m twine check --strict dist/*

0 comments on commit 500c53c

Please sign in to comment.