[pre-commit.ci] pre-commit suggestions #1658
This file contains hidden or 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: UnitTests | |
| on: | |
| push: | |
| branches: [main, "release/*"] | |
| pull_request: | |
| branches: [main, "release/*"] | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| pytester: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: ["ubuntu-22.04", "macos-latest", "windows-2022"] | |
| python-version: ["3.9", "3.11", "3.13"] | |
| requires: ["oldest", "latest"] | |
| exclude: | |
| - { requires: "oldest", python-version: "3.13" } | |
| timeout-minutes: 35 | |
| env: | |
| TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html" | |
| steps: | |
| - name: Checkout 🛎 | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| - name: Set up Python 🐍 ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Set oldest dependencies | |
| if: matrix.requires == 'oldest' | |
| timeout-minutes: 20 | |
| run: | | |
| pip install -e '.[cli]' | |
| python -m lightning_utilities.cli requirements set-oldest | |
| - name: Complex 💽 caching | |
| uses: ./.github/actions/cache | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| timeout-minutes: 20 | |
| run: | | |
| set -e | |
| pip install -e ".[cli]" -U -r requirements/_tests.txt -f $TORCH_URL | |
| pip --version | |
| pip list | |
| - name: Print 🖨️ dependencies | |
| uses: ./.github/actions/pip-list | |
| - name: Unittests | |
| working-directory: ./tests | |
| run: python -m pytest unittests --cov=lightning_utilities --durations=50 --timeout=120 | |
| - name: Statistics | |
| working-directory: ./tests | |
| run: | | |
| coverage xml | |
| coverage report | |
| - name: Upload coverage to Codecov | |
| uses: codecov/[email protected] | |
| continue-on-error: true | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| file: ./coverage.xml | |
| flags: unittests | |
| env_vars: OS,PYTHON | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| - name: test CI scripts | |
| working-directory: ./tests | |
| run: python -m pytest scripts --durations=50 --timeout=120 | |
| testing-guardian: | |
| runs-on: ubuntu-latest | |
| needs: pytester | |
| if: always() | |
| steps: | |
| - run: echo "${{ needs.pytester.result }}" | |
| - name: failing... | |
| if: needs.pytester.result == 'failure' | |
| run: exit 1 | |
| - name: cancelled or skipped... | |
| if: contains(fromJSON('["cancelled", "skipped"]'), needs.pytester.result) | |
| timeout-minutes: 1 | |
| run: sleep 90 |