Skip to content

Commit bd01a5e

Browse files
committed
Add parallel testing demo
1 parent 7531739 commit bd01a5e

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

.github/workflows/parallel.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
name: Collect
1212
runs-on: ubuntu-latest
1313
outputs:
14-
TEST_MATRIX: "${{ steps.matrix.outputs.TEST_MATRIX }}"
14+
TEST_DIRS: "${{ steps.generate.outputs.TEST_DIRS }}"
1515

1616
steps:
1717
- uses: actions/checkout@v4
@@ -34,29 +34,29 @@ jobs:
3434
echo '::endgroup::'
3535
3636
- name: Generate matrix
37-
id: matrix
37+
id: generate
3838
shell: uv run -- python {0}
3939
run: |
4040
from pathlib import Path
4141
from os import environ
42-
matrix = set()
42+
test_dirs = set()
4343
with open("collected.txt", encoding="utf-8") as lines:
4444
for line in lines:
4545
parts = line.strip().partition("::")
46-
matrix.add(str(Path(parts[0]).parent))
47-
matrix = sorted(list(matrix))
48-
print(matrix)
46+
test_dirs.add(str(Path(parts[0]).parent))
47+
test_dirs = { "test_dirs": sorted(list(test_dirs)) }
48+
print(test_dirs)
4949
with open(environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as f:
50-
print(f"TEST_MATRIX={matrix}", file=f)
50+
print(f"TEST_DIRS={test_dirs}", file=f)
5151
5252
test:
5353
name: Test
5454
runs-on: ubuntu-latest
5555
needs: collect
5656

57-
strategy:
58-
matrix:
59-
test_dir: ${{ needs.collect.outputs.TEST_MATRIX }}
57+
# strategy:
58+
# matrix:
59+
# test_dirs: ${{ needs.collect.outputs.TEST_DIRS }}
6060
# test_dir: ["tests", "tests/dir1", "tests/dir2", "tests/dir3"]
6161

6262
steps:
@@ -72,7 +72,7 @@ jobs:
7272
uv sync --locked; echo
7373
uv tree
7474
75-
- name: Run test
76-
run: uv run -- pytest '${{ matrix.test_dir }}'
75+
# - name: Run test
76+
# run: uv run -- pytest '${{ matrix.test_dir }}'
7777

78-
- run: echo "TEST_MATRIX is '${{ needs.collect.outputs.TEST_MATRIX }}'"
78+
- run: echo "TEST_DIRS is '${{ needs.collect.outputs.TEST_DIRS }}'"

0 commit comments

Comments
 (0)