Skip to content

Commit 7f7794d

Browse files
committed
Add parallel testing demo
1 parent 798f3a2 commit 7f7794d

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

.github/workflows/parallel.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,25 @@ jobs:
3939
run: |
4040
from pathlib import Path
4141
from os import environ
42-
test_dirs = set()
42+
matrix = set()
4343
with open("collected.txt", encoding="utf-8") as lines:
4444
for line in lines:
4545
parts = line.strip().partition("::")
46-
test_dirs.add(f"'{Path(parts[0]).parent}'") # Add single-quotes around path
47-
test_dirs = sorted(list(test_dirs))
48-
print(test_dirs)
46+
matrix.add(str(Path(parts[0]).parent))
47+
matrix = sorted(list(matrix))
48+
print(matrix)
4949
with open(environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as f:
50-
print(f"TEST_MATRIX='{test_dirs}'", file=f)
50+
print(f"TEST_MATRIX={matrix}", file=f)
5151
5252
test:
5353
name: Test
5454
runs-on: ubuntu-latest
5555
needs: collect
5656

57-
# strategy:
58-
# matrix:
59-
# os: [ubuntu-latest, macos-latest, windows-latest]
60-
# node: [20, 22]
57+
strategy:
58+
matrix:
59+
test_dir: ["tests", "tests/dir1", "tests/dir2", "tests/dir3"]
60+
# test_dir: "${{ needs.collect.outputs.TEST_MATRIX }}"
6161

6262
steps:
6363
- uses: actions/checkout@v4
@@ -73,6 +73,4 @@ jobs:
7373
uv tree
7474
7575
- name: Run test
76-
run: uv run -- pytest tests/test_basic.py
77-
78-
- run: echo "TEST_MATRIX is '${{ needs.collect.outputs.TEST_MATRIX }}'"
76+
run: uv run -- pytest '${{ matrix.test_dir }}'

0 commit comments

Comments
 (0)