diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0db2903 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,59 @@ +name: Continuous integration + +on: + pull_request: + push: + branches: + - main + - "dev*" + +jobs: + test: + permissions: + contents: read + id-token: write + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + python-version: ["3.10", 3.11, 3.12] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + + - name: Update pip and install the package + run: | + python -m pip install --upgrade pip + python -m pip install ".[test]" + + - name: Run tests + run: | + python -m pytest tests + + - name: Install and run linters + if: | + matrix.python-version == 3.11 + run: | + python -m pip install ".[dev]" + python -m ruff check . + python -m ruff format --check . + + - name: Generate Report + run: | + coverage run -m pytest + coverage xml + + - name: Upload Coverage to Codecov + uses: codecov/codecov-action@v3 + with: + file: ./coverage.xml + flags: unittests + verbose: true + token: ${{secrets.CODECOV_TOKEN}}