setup CI/CD pipeline and enhance package metadata #8
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: [main, devel] | ||
| pull_request: | ||
| branches: [main, devel] | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| lint: | ||
| name: Lint with pre-commit | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
| with: | ||
| enable-cache: true | ||
| - name: Install tox | ||
| run: uv pip install --system tox tox-uv | ||
| - name: Run pre-commit via tox | ||
| run: tox run -e lint | ||
| pkg: | ||
| name: Validate Package Metadata | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
| with: | ||
| enable-cache: true | ||
| - name: Install tox | ||
| run: uv pip install --system tox tox-uv | ||
| - name: Build and check package | ||
| run: tox run -e pkg | ||
| test: | ||
| name: Test with tox (Python ${{ matrix.python-version }}) | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
| with: | ||
| enable-cache: true | ||
| - name: Install tox | ||
| run: uv pip install --system tox tox-uv | ||
| - name: Run tox | ||
| run: tox run -e py$(echo ${{ matrix.python-version }} | tr -d .) | ||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v5 | ||
| with: | ||
| files: .tox/coverage.py${{ replace(matrix.python-version, '.', '') }}.xml | ||
| fail_ci_if_error: false | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||