CI #2453
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: CI | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| schedule: | |
| - cron: '1 0 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Setup Python | |
| uses: astral-sh/[email protected] | |
| with: | |
| python-version: '3.14' | |
| enable-cache: false | |
| - run: uv build | |
| unyt-module-test-function: | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Setup Python | |
| uses: astral-sh/[email protected] | |
| with: | |
| python-version: '3.14' | |
| enable-cache: false | |
| - run: uv run --group test python -c "import unyt ; unyt.test()" | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| needs: [build] | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest] | |
| python-version: | |
| - '3.10' | |
| - '3.11' | |
| - '3.12' | |
| - '3.13' | |
| - '3.14' | |
| sync-args: [null] | |
| pytest-args: [null] | |
| label: [null] | |
| # Test all on ubuntu, test ends on macos and windows | |
| include: | |
| - os: macos-latest | |
| python-version: '3.10' | |
| sync-args: null | |
| pytest-args: null | |
| label: null | |
| - os: windows-latest | |
| python-version: '3.10' | |
| sync-args: null | |
| pytest-args: null | |
| label: null | |
| - os: macos-latest | |
| python-version: '3.14' | |
| sync-args: null | |
| pytest-args: null | |
| - os: windows-latest | |
| python-version: '3.14' | |
| sync-args: null | |
| pytest-args: null | |
| label: null | |
| # with integration deps | |
| - os: ubuntu-latest | |
| python-version: '3.13' | |
| sync-args: --group integration | |
| pytest-args: null | |
| label: integration | |
| # with lowest direct dependencies | |
| - os: ubuntu-22.04 | |
| python-version: '3.10.0' | |
| sync-args: --resolution=lowest-direct --group integration | |
| pytest-args: null | |
| label: oldestdeps | |
| # with doctests | |
| - os: ubuntu-latest | |
| python-version: '3.10' | |
| sync-args: --group doc | |
| pytest-args: --doctest-modules --doctest-plus | |
| label: doctests | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Setup Python | |
| uses: astral-sh/[email protected] | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| enable-cache: false | |
| - name: Install test env | |
| run: uv sync --group covcheck ${{ matrix.sync-args }} | |
| - name: Run tests | |
| shell: bash # for windows compat | |
| run: | | |
| uv run --no-sync coverage run --parallel-mode -m \ | |
| pytest --color=yes ${{ matrix.pytest-args }} | |
| - name: Upload coverage data | |
| # only using reports from ubuntu because | |
| # combining reports from multiple platforms is tricky | |
| if: startsWith( matrix.os , 'ubuntu' ) | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: unyt_coverage_data-${{matrix.os}}-${{matrix.python-version}}-${{matrix.label}} | |
| path: .coverage.* | |
| if-no-files-found: ignore | |
| include-hidden-files: true | |
| coverage: | |
| name: Combine & check coverage. | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - uses: astral-sh/setup-uv@0d20755a2389f8ddbd3ad4f8a536309a4db22de9 # v6.8.0 | |
| with: | |
| python-version: '3.14' | |
| enable-cache: false | |
| - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 | |
| with: | |
| pattern: unyt_coverage_data-* | |
| merge-multiple: true | |
| - name: Check coverage | |
| run: | | |
| uv tool install coverage | |
| coverage combine | |
| coverage html --skip-covered --skip-empty | |
| coverage report --skip-covered --format=markdown >> "$GITHUB_STEP_SUMMARY" | |
| coverage report --fail-under=99 | |
| - name: Upload HTML report | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: unyt_coverage_report | |
| path: htmlcov | |
| docs: | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Setup Python | |
| uses: astral-sh/[email protected] | |
| with: | |
| python-version: '3.10' | |
| enable-cache: false | |
| - run: uv sync --group doc --group test | |
| - name: Build docs | |
| run: | | |
| uv run --no-sync --directory=docs \ | |
| python -m sphinx -M html "." "_build" -W | |
| - name: Upload build | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: unyt_docs | |
| path: docs/_build/html | |
| if-no-files-found: error |