File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323 PACKAGES=$(find . -name pyproject.toml -exec dirname {} \; | sed 's/^\.\///' | jq -R -s -c 'split("\n")[:-1]')
2424 echo "packages=$PACKAGES" >> $GITHUB_OUTPUT
2525
26- build :
26+ test :
2727 needs : [detect-packages]
28+ strategy :
29+ matrix :
30+ package : ${{ fromJson(needs.detect-packages.outputs.packages) }}
31+ name : Test ${{ matrix.package }}
32+ runs-on : ubuntu-latest
33+ steps :
34+ - uses : actions/checkout@v4
35+
36+ - name : Install uv
37+ uses : astral-sh/setup-uv@v3
38+
39+ - name : Set up Python
40+ uses : actions/setup-python@v5
41+ with :
42+ python-version-file : " src/${{ matrix.package }}/.python-version"
43+
44+ - name : Install dependencies
45+ working-directory : src/${{ matrix.package }}
46+ run : uv sync --frozen --all-extras --dev
47+
48+ - name : Check if tests exist
49+ id : check-tests
50+ working-directory : src/${{ matrix.package }}
51+ run : |
52+ if [ -d "tests" ] || [ -d "test" ] || grep -q "pytest" pyproject.toml; then
53+ echo "has-tests=true" >> $GITHUB_OUTPUT
54+ else
55+ echo "has-tests=false" >> $GITHUB_OUTPUT
56+ fi
57+
58+ - name : Run tests
59+ if : steps.check-tests.outputs.has-tests == 'true'
60+ working-directory : src/${{ matrix.package }}
61+ run : uv run pytest
62+
63+ build :
64+ needs : [detect-packages, test]
2865 strategy :
2966 matrix :
3067 package : ${{ fromJson(needs.detect-packages.outputs.packages) }}
You can’t perform that action at this time.
0 commit comments