cluster_compositions
enhancements
#1799
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
release: | |
types: [published] | |
workflow_dispatch: | |
workflow_call: | |
env: | |
MPLBACKEND: Agg # non-interactive backend for matplotlib | |
jobs: | |
tests: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
split: [1, 2, 3, 4] | |
uses: janosh/workflows/.github/workflows/pytest.yml@main | |
secrets: inherit | |
with: | |
os: ${{ matrix.os }} | |
python-version: "3.10" | |
install-cmd: uv pip install -e '.[test,brillouin]' --system | |
# pytest-split distributes work load so parallel jobs finish in similar time | |
# update durations file with `pytest --store-durations --durations-path tests/files/.pytest-split-durations` | |
test-cmd: pytest --durations 20 --cov-branch --cov-report=xml --cov pymatviz --splits 4 --group ${{ matrix.split }} --splitting-algorithm least_duration | |
upload-coverage: strict | |
find-example-scripts: | |
runs-on: ubuntu-latest | |
outputs: | |
example_scripts: ${{ steps.set-matrix.outputs.example_scripts }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Find Python scripts | |
id: set-matrix | |
run: | | |
SCRIPTS=$(find assets/scripts -name "*.py" | jq -R -s -c 'split("\n")[:-1]') | |
echo "example_scripts=$SCRIPTS" >> $GITHUB_OUTPUT | |
test-example-scripts: | |
needs: find-example-scripts | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
example_script: ${{fromJson(needs.find-example-scripts.outputs.example_scripts)}} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Set up uv | |
uses: astral-sh/setup-uv@v2 | |
- name: Run script | |
run: uv run --with-editable .[make-assets] ${{ matrix.example_script }} |