Skip to content

Commit 8075fc1

Browse files
committed
Get CI working for the new tests.
1 parent 886a2d3 commit 8075fc1

File tree

4 files changed

+25
-127
lines changed

4 files changed

+25
-127
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Wheels
1+
name: Build
22

33
on:
44
push:
@@ -23,79 +23,42 @@ env:
2323
PYAWAITABLE_OPTIMIZED: 1
2424

2525
jobs:
26-
binary-wheels-standard:
27-
name: Binary wheels for ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
28-
runs-on: ${{ matrix.os }}
29-
strategy:
30-
fail-fast: false
31-
matrix:
32-
os: [ubuntu-latest, windows-latest, macos-latest]
33-
34-
steps:
35-
- uses: actions/checkout@v2
36-
with:
37-
# Fetch all tags
38-
fetch-depth: 0
39-
40-
- name: Build wheels
41-
uses: pypa/[email protected]
42-
env:
43-
CIBW_ARCHS_MACOS: x86_64
44-
HATCH_BUILD_HOOKS_ENABLE: "true"
45-
46-
- uses: actions/upload-artifact@v3
47-
with:
48-
name: artifacts
49-
path: wheelhouse/*.whl
50-
if-no-files-found: error
51-
52-
binary-wheels-arm:
53-
name: Build Linux wheels for ARM
26+
pure-python-wheel-and-sdist:
27+
name: Build a pure Python wheel and source distribution
5428
runs-on: ubuntu-latest
55-
if: >
56-
github.event_name == 'push'
57-
&&
58-
(github.ref == 'refs/heads/master' || startsWith(github.event.ref, 'refs/tags'))
5929

6030
steps:
61-
- uses: actions/checkout@v2
62-
with:
63-
# Fetch all tags
64-
fetch-depth: 0
31+
- uses: actions/checkout@v3
32+
with:
33+
fetch-depth: 0
6534

66-
- name: Set up QEMU
67-
uses: docker/setup-qemu-action@v1
68-
with:
69-
platforms: arm64
35+
- name: Install build dependencies
36+
run: python -m pip install --upgrade build
7037

71-
- name: Build wheels
72-
uses: pypa/[email protected]
73-
env:
74-
CIBW_ARCHS_LINUX: aarch64
75-
HATCH_BUILD_HOOKS_ENABLE: "true"
38+
- name: Build
39+
run: python -m build
7640

77-
- uses: actions/upload-artifact@v3
78-
with:
79-
name: artifacts
80-
path: wheelhouse/*.whl
81-
if-no-files-found: error
41+
- uses: actions/upload-artifact@v4
42+
with:
43+
name: artifacts
44+
path: dist/*
45+
if-no-files-found: error
8246

8347
publish:
8448
name: Publish release
8549
needs:
86-
- binary-wheels-standard
87-
- binary-wheels-arm
50+
- pure-python-wheel-and-sdist
8851
runs-on: ubuntu-latest
8952
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
9053

9154
steps:
92-
- uses: actions/download-artifact@v3
55+
- uses: actions/download-artifact@v4
9356
with:
9457
name: artifacts
9558
path: dist
9659

9760
- name: Push build artifacts to PyPI
98-
uses: pypa/gh-action-pypi-publish@v1.10.3
61+
uses: pypa/gh-action-pypi-publish@v1.12.4
9962
with:
10063
skip_existing: true
10164
user: __token__

.github/workflows/tests.yml

Lines changed: 5 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ jobs:
3535
filters: |
3636
source:
3737
- 'src/**'
38-
csource:
39-
- 'src/_pyawaitable/**'
4038
4139
run-tests:
4240
needs: changes
@@ -56,60 +54,14 @@ jobs:
5654
with:
5755
python-version: ${{ matrix.python-version }}
5856

59-
- name: Install Hatch
60-
uses: pypa/hatch@install
57+
- name: Build PyAwaitable
58+
run: pip install .
6159

62-
- name: Run tests
63-
run: hatch test
64-
65-
memory-errors:
66-
needs:
67-
- changes
68-
- run-tests
69-
if: ${{ needs.changes.outputs.csource == 'true' }}
70-
name: Check for memory errors
71-
runs-on: ubuntu-latest
72-
env:
73-
PYTHONMALLOC: malloc
74-
steps:
75-
- uses: actions/checkout@v2
76-
77-
- name: Set up Python 3.12
78-
uses: actions/setup-python@v2
79-
with:
80-
python-version: 3.12
81-
82-
- name: Install Valgrind
83-
run: sudo apt-get update && sudo apt-get -y install valgrind
84-
85-
- name: Install Hatch
86-
uses: pypa/hatch@install
60+
- name: Build PyAwaitable Test Package
61+
run: pip install ./tests
8762

8863
- name: Run tests
89-
run: valgrind --suppressions=valgrind-python.supp --exit-errorcode=1 hatch test
90-
91-
memory-leaks:
92-
needs:
93-
- changes
94-
- memory-errors
95-
if: ${{ needs.changes.outputs.csource == 'true' }}
96-
name: Check for memory leaks
97-
runs-on: ubuntu-latest
98-
env:
99-
PYTHONMALLOC: malloc
100-
steps:
101-
- uses: actions/checkout@v2
102-
103-
- name: Set up Python 3.12
104-
uses: actions/setup-python@v2
105-
with:
106-
python-version: 3.12
107-
108-
- name: Install Hatch
109-
uses: pypa/hatch@install
110-
111-
- name: Run tests with Memray tracking
112-
run: hatch test --enable-leak-tracking
64+
run: python -W error -m unittest tests/main.py --verbose
11365

11466
tests-pass:
11567
runs-on: ubuntu-latest
@@ -118,8 +70,6 @@ jobs:
11870

11971
needs:
12072
- run-tests
121-
- memory-errors
122-
- memory-leaks
12373

12474
steps:
12575
- name: Check whether all tests passed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Call asynchronous code from an extension module
44

5-
[![Build Wheels](https://github.com/ZeroIntensity/pyawaitable/actions/workflows/build.yml/badge.svg)](https://github.com/ZeroIntensity/pyawaitable/actions/workflows/build.yml)
5+
[![Build](https://github.com/ZeroIntensity/pyawaitable/actions/workflows/build.yml/badge.svg)](https://github.com/ZeroIntensity/pyawaitable/actions/workflows/build.yml)
66
![Tests](https://github.com/ZeroIntensity/pyawaitable/actions/workflows/tests.yml/badge.svg)
77

88
- [Docs](https://awaitable.zintensity.dev)

hatch.toml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,4 @@ os.environ['PYAWAITABLE_INCLUDE'] = pyawaitable.include(suppress_error=True)
1717
"""
1818

1919
[build.hooks.custom]
20-
enable-by-default = true
21-
22-
[envs.hatch-test]
23-
extra-dependencies = [
24-
"pytest-asyncio",
25-
"pytest-memray"
26-
]
27-
28-
[envs.hatch-test.overrides.platform.windows]
29-
extra-dependencies = ["pytest-asyncio"]
30-
31-
[[envs.hatch-test.matrix]]
32-
python = ["3.9", "3.10", "3.11", "3.12", "3.13"]
33-
34-
[envs.hatch-test.scripts]
35-
run = "pytest{env:HATCH_TEST_ARGS:} {args} -x -vv"
20+
enable-by-default = true

0 commit comments

Comments
 (0)