Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: speed up testing #93

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/*