From b9a0a342943234a9c84388188fc331294dff2954 Mon Sep 17 00:00:00 2001 From: Jan Luca van den Busch Date: Sun, 24 Nov 2024 19:36:47 +0100 Subject: [PATCH] run matrix tests on schedule and master push, coverage on pull --- .github/workflows/python-publish.yml | 6 ++--- .github/workflows/run-coverage.yml | 37 +++++++++++++++++++++++++++ .github/workflows/run-smoke-tests.yml | 28 -------------------- .github/workflows/run-tests.yml | 36 +++++++++++++------------- 4 files changed, 58 insertions(+), 49 deletions(-) create mode 100644 .github/workflows/run-coverage.yml delete mode 100644 .github/workflows/run-smoke-tests.yml diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 8d509e3..466c47a 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -22,9 +22,9 @@ jobs: - name: Install dependencies run: | - python -m pip install -U pip - pip install build - pip install -U . + python -m pip install --upgrade pip + pip install --upgrade build + pip install --upgrade . - name: Build wheel and sdist run: python -m build --sdist --wheel --outdir dist/ diff --git a/.github/workflows/run-coverage.yml b/.github/workflows/run-coverage.yml new file mode 100644 index 0000000..bc48b2b --- /dev/null +++ b/.github/workflows/run-coverage.yml @@ -0,0 +1,37 @@ +name: tests + +on: + push: + branches: + - main + pull_request: + branches: + - "**" + +jobs: + build-n-coverage: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.x + + # --editable seems necessary for codecov + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install --upgrade --editable .[test] + + - name: Run tests and coverage + run: python -m pytest tests --cov=src/ --cov-report=xml + + - name: Upload to Codecov + uses: codecov/codecov-action@v5 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + verbose: true diff --git a/.github/workflows/run-smoke-tests.yml b/.github/workflows/run-smoke-tests.yml deleted file mode 100644 index 5a87088..0000000 --- a/.github/workflows/run-smoke-tests.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: CI - -on: - schedule: - - cron: 0 6 * * 1 - -jobs: - build-n-test: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.10", "3.11", "3.12", "3.13"] - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies on ${{ matrix.python-version }} - run: | - python -m pip install -U pip - pip install -U .[test] - - - name: Run tests on ${{ matrix.python-version }} - run: python -m pytest tests -v diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 62270f0..2ee4c36 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,36 +1,36 @@ -name: tests +name: CI on: + schedule: + - cron: 0 6 * * 1 push: branches: - main - pull_request: - branches: - - "**" jobs: build-n-test: runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - 3.10 + - 3.11 + - 3.12 + - 3.13 + steps: - uses: actions/checkout@v4 - - name: Set up Python + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: - python-version: 3.x + python-version: ${{ matrix.python-version }} - - name: Install dependencies + - name: Install dependencies on ${{ matrix.python-version }} run: | - python -m pip install -U pip - pip install -U -e .[test] - - - name: Run tests and coverage - run: python -m pytest tests --cov=src/ --cov-report=xml + python -m pip install --upgrade pip + pip install --upgrade .[test] - - name: Upload to Codecov - uses: codecov/codecov-action@v5 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: true - verbose: true + - name: Run tests on ${{ matrix.python-version }} + run: python -m pytest tests -v