--- name: CI # yamllint disable-line rule:truthy on: push: branches: - main pull_request: workflow_dispatch: jobs: pre-commit: name: pre-commit runs-on: ubuntu-latest env: PRE_COMMIT_HOME: /tmp/pre-commit-cache steps: - name: โคต๏ธ Check out code from GitHub uses: actions/checkout@v4 - name: ๐Ÿ— Set up uv uses: astral-sh/setup-uv@v5 with: enable-cache: true - name: ๐Ÿ— Set up Python run: uv python install - name: ๐Ÿ— Set pre-commit cache uses: actions/cache@v4 with: path: ${{ env.PRE_COMMIT_HOME }} key: ${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml','.python-version') }} - name: ๐Ÿš€ Run pre-commit env: # Skipping branch check and pytest as pytest is run in a separate job SKIP: no-commit-to-branch,pytest run: uv run --frozen pre-commit run -a pytest: name: pytest runs-on: ubuntu-latest strategy: fail-fast: false matrix: python: ["3.13", "3.14"] env: # Force uv to use the matrix interpreter rather than the version # pinned in .python-version. UV_PYTHON: ${{ matrix.python }} steps: - name: โคต๏ธ Check out code from GitHub uses: actions/checkout@v4 - name: ๐Ÿ— Set up uv uses: astral-sh/setup-uv@v5 with: enable-cache: true - name: ๐Ÿ— Set up Python ${{ matrix.python }} run: uv python install ${{ matrix.python }} - name: ๐Ÿ— Install dependencies run: uv sync --frozen --dev - name: ๐Ÿš€ Run pytest run: uv run pytest tests - name: โฌ†๏ธ Upload coverage artifact uses: actions/upload-artifact@v4 with: include-hidden-files: true name: coverage-${{ matrix.python }} path: .coverage coverage: runs-on: ubuntu-latest needs: pytest steps: - name: โคต๏ธ Check out code from GitHub uses: actions/checkout@v4 with: fetch-depth: 0 - name: โฌ‡๏ธ Download coverage data uses: actions/download-artifact@v4 - name: ๐Ÿ— Set up uv uses: astral-sh/setup-uv@v5 with: enable-cache: true - name: ๐Ÿ— Set up Python run: uv python install - name: ๐Ÿ— Install dependencies run: uv sync --frozen --dev - name: ๐Ÿš€ Process coverage results run: | uv run --frozen coverage combine coverage*/.coverage* uv run --frozen coverage xml -i - name: โฌ†๏ธ Upload coverage report uses: codecov/codecov-action@v5 with: fail_ci_if_error: false build: name: build runs-on: ubuntu-latest steps: - name: โคต๏ธ Check out code from GitHub uses: actions/checkout@v4 - name: ๐Ÿ— Set up uv uses: astral-sh/setup-uv@v5 with: enable-cache: true - name: ๐Ÿ— Set up Python run: uv python install - name: ๐Ÿš€ Build sdist and wheel run: uv build - name: ๐Ÿงช Install built wheel and import package run: | uv venv /tmp/install-test uv pip install --python /tmp/install-test/bin/python dist/*.whl /tmp/install-test/bin/python -c "import iotawattpy; print(iotawattpy.__file__)" - name: โฌ†๏ธ Upload build artifacts uses: actions/upload-artifact@v4 with: name: dist path: dist/