From 8fad439e3644f93e586750297bedc9f999ab678b Mon Sep 17 00:00:00 2001 From: Edward-Jackson-ONS Date: Thu, 15 Aug 2024 12:30:26 +0100 Subject: [PATCH] ci: initial setup --- .github/workflows/ci.yml | 59 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/ci.yml 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}}