Speedup import and add regression check for import time #1453
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: | |
jobs: | |
tests: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] # windows-latest | |
split: [1, 2, 3, 4] | |
uses: janosh/workflows/.github/workflows/pytest.yml@main | |
with: | |
os: ${{ matrix.os }} | |
python-version: "3.10" | |
test-cmd: | | |
pytest --durations 20 --cov . \ | |
--splits 4 --group ${{ matrix.split }} \ | |
--splitting-algorithm least_duration | |
find-scripts: | |
runs-on: ubuntu-latest | |
outputs: | |
script_list: ${{ steps.set-matrix.outputs.script_list }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Find Python scripts | |
id: set-matrix | |
run: | | |
SCRIPTS=$(find examples/make_assets -name "*.py" | jq -R -s -c 'split("\n")[:-1]') | |
echo "script_list=$SCRIPTS" >> $GITHUB_OUTPUT | |
test-scripts: | |
needs: find-scripts | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
script: ${{fromJson(needs.find-scripts.outputs.script_list)}} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install package and dependencies | |
run: pip install -e .[make-assets] | |
- name: Run script | |
run: python ${{ matrix.script }} |