diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index b9acf5d..4baee8b 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -1,56 +1,54 @@ name: Python test -on: [push] +on: + push: + branches: + - main + pull_request: + branches: + - main jobs: build: - runs-on: ubuntu-latest + strategy: + matrix: + os: ["ubuntu-latest", "macos-latest"] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] + mpi: [ "openmpi" ] # "mpich", "intelmpi" +# exclude: +# - os: "macos-latest" +# mpi: "intelmpi" + + runs-on: ${{ matrix.os }} + steps: - - uses: actions/checkout@v4 - - name: Set up MPI - uses: mpi4py/setup-mpi@v1 - with: - mpi: 'openmpi' - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.9' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install ."[test]" - - name: Lint with ruff - run: | - # Stop the build if there are Python syntax errors or undefined names. - ruff check --output-format=github --select=E9,F63,F7,F82 --target-version=py39 . - # Default set of ruff rules with GitHub Annotations - ruff check --output-format=github --target-version=py39 . - - name: Test with pytest and measure coverage - run: | - coverage run --rcfile=./pyproject.toml -m pytest - mpirun -n 8 coverage run --rcfile=./pyproject.toml -m mpi4py -m pytest --with-mpi - coverage combine - coverage report -m - coverage xml - genbadge coverage -i coverage.xml -o coverage.svg - - name: Verify Changed files - uses: tj-actions/verify-changed-files@v19 - id: verify-changed-files - with: - files: coverage.svg - - - name: Commit files - if: steps.verify-changed-files.outputs.files_changed == 'true' - run: | - git config --local user.email "github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git diff - git add coverage.svg - git commit -m "update coverage badge" - - - name: Push changes - if: steps.verify-changed-files.outputs.files_changed == 'true' - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.github_token }} - branch: ${{ github.ref }} + - name: Check out repository + uses: actions/checkout@v4 + + - name: Setup MPI ${{ matrix.mpi }} + uses: mpi4py/setup-mpi@v1 + with: + mpi: ${{ matrix.mpi }} + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ."[test]" + + - name: Test with pytest and measure coverage + run: | + coverage run --rcfile=./pyproject.toml -m pytest + mpirun -n 8 coverage run --rcfile=./pyproject.toml -m mpi4py -m pytest --with-mpi + coverage combine + coverage report -m + coverage xml + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/README.md b/README.md index da03bea..b9cd846 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,7 @@ [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/7785/badge)](https://www.bestpractices.dev/projects/7785) [![](https://img.shields.io/badge/Contact-propulate%40lists.kit.edu-orange)](mailto:propulate@lists.kit.edu) [![Documentation Status](https://readthedocs.org/projects/propulate/badge/?version=latest)](https://propulate.readthedocs.io/en/latest/?badge=latest) -![](./coverage.svg) -[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Helmholtz-AI-Energy/propulate/main.svg)](https://results.pre-commit.ci/latest/github/Helmholtz-AI-Energy/propulate/main) +[![codecov](https://codecov.io/gh/Helmholtz-AI-Energy/propulate/graph/badge.svg?token=ZG6PEXJOIO)](https://codecov.io/gh/Helmholtz-AI-Energy/propulate)[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Helmholtz-AI-Energy/propulate/main.svg)](https://results.pre-commit.ci/latest/github/Helmholtz-AI-Energy/propulate/main) # **Click [here](https://www.scc.kit.edu/en/aboutus/16956.php) to watch our 3 min introduction video!** diff --git a/pyproject.toml b/pyproject.toml index f83b219..e3c1495 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,8 +49,6 @@ dev = [ test = [ "coverage", - "genbadge[coverage]", - "ruff", "pytest", "pytest-cov", "pytest-mpi",