@@ -68,34 +68,51 @@ jobs:
68
68
**/uv.lock
69
69
enable-cache : true
70
70
- uses : ComPWA/actions/cache-sympy@v2
71
- - name : Determine extras to install
71
+ - id : extra
72
+ if : inputs.additional-extras
73
+ name : Determine extras to install
72
74
run : |
73
- test_extras='--extra test '
74
- for extra in ${{ inputs.specific-pip-packages }}; do
75
+ test_extras=''
76
+ for extra in ${{ inputs.additional-extras }}; do
75
77
test_extras="$test_extras --extra $extra"
76
78
done
77
- echo "TEST_EXTRAS=$test_extras" | tee -a $GITHUB_ENV
78
- - name : Determine pytest flags
79
+ echo "extras=$test_extras" | tee -a $GITHUB_OUTPUT
80
+ - id : with
81
+ if : inputs.specific-pip-packages
82
+ name : Determine additional packages to install
79
83
run : |
80
- pytest_flags='-m "not slow or slow"'
81
- if [[ ! -z '${{ inputs.coverage-target }}' ]]; then
82
- pytest_flags="$pytest_flags --cov-report=xml --cov=${{ matrix.coverage-target }}"
83
- fi
84
- if [[ ! -z '${{ inputs.multithreaded }}' ]]; then
85
- pytest_flags="$pytest_flags --numprocesses=auto"
86
- fi
87
- echo "PYTEST_FLAGS=$pytest_flags" | tee -a $GITHUB_ENV
84
+ additional_packages=''
85
+ for package in ${{ inputs.specific-pip-packages }}; do
86
+ additional_packages="$additional_packages --with $package"
87
+ done
88
+ echo "packages=$additional_packages" | tee -a $GITHUB_OUTPUT
89
+ - id : coverage
90
+ if : matrix.coverage-target
91
+ name : Determine pytest coverage flags
92
+ run : echo "flags=--cov-report=xml --cov=${{ matrix.coverage-target }}" | tee -a $GITHUB_OUTPUT
93
+ - id : multithreaded
94
+ if : inputs.multithreaded
95
+ name : Determine pytest multithreading flags
96
+ run : echo "flags=--numprocesses=auto" | tee -a $GITHUB_OUTPUT
88
97
- env :
89
98
UV_SYSTEM_PYTHON : 1
90
- run : uv run ${{ env.TEST_EXTRAS }} pytest ${{ env.PYTEST_FLAGS }}
91
- - if : matrix.coverage-target != ''
99
+ name : Run tests with pytest
100
+ run : >-
101
+ uv run \
102
+ --extra test \
103
+ ${{ steps.extra.outputs.extras }} \
104
+ ${{ steps.with.outputs.packages }} \
105
+ pytest \
106
+ ${{ steps.coverage.outputs.flags }} \
107
+ ${{ steps.multithreaded.outputs.flags }} \
108
+ -m "not slow or slow"
109
+ - if : matrix.coverage-target
92
110
uses : codecov/codecov-action@v4
93
111
with :
94
112
file : ./coverage.xml
95
113
flags : unittests
96
-
97
114
- uses : actions/upload-artifact@v4
98
- if : inputs.test-output-path != ''
115
+ if : inputs.test-output-path
99
116
with :
100
117
name : test-output-${{ matrix.runs-on }}-${{ matrix.python-version }}
101
118
path : ${{ inputs.test-output-path }}
0 commit comments