Merge pull request #94 from ClimateImpactLab/add_doi #181
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: "Test Python Package" | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| pull_request: | |
| branches: | |
| - "main" | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| matrix: | |
| python-version: | |
| - "3.12" | |
| - "3.13" | |
| - "3.14" | |
| steps: | |
| - uses: actions/checkout@v7.0.1 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2 | |
| with: | |
| version: "0.11.10" | |
| enable-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| - uses: actions/setup-python@v7.0.0 | |
| with: | |
| python-version-file: ".python-version" | |
| - name: Install the project | |
| run: uv sync --locked --all-extras --dev | |
| - name: Format check with ruff | |
| run: uv run ruff format . --diff | |
| - name: Lint check with ruff | |
| run: uv run ruff check . --output-format=github | |
| - name: Type check with ty | |
| run: uv run ty check | |
| - name: Test with pytest | |
| run: uv run pytest -vv --cov-report term-missing --cov-report xml --cov isku | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v7 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| package-smoke-test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7.0.1 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2 | |
| with: | |
| version: "0.11.10" | |
| enable-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| - uses: actions/setup-python@v7.0.0 | |
| with: | |
| python-version-file: ".python-version" | |
| - name: Build | |
| run: uv build | |
| # Check that basic features work and we didn't miss to include crucial files | |
| - name: Smoke test (wheel) | |
| run: uv run --isolated --no-project --with dist/*.whl tests/smoke_test.py | |
| - name: Smoke test (source distribution) | |
| run: uv run --isolated --no-project --with dist/*.tar.gz tests/smoke_test.py |