From c0e6553b26ccd432b5b586e5fdedae22c7a8e259 Mon Sep 17 00:00:00 2001 From: JosePizarro3 Date: Thu, 6 Jun 2024 11:14:59 +0200 Subject: [PATCH] Added Ahmed changes to the pipeline for comment on pr from coverage --- .github/workflows/actions.yaml | 77 ++++++++++++++++++---------------- pyproject.toml | 6 +-- 2 files changed, 45 insertions(+), 38 deletions(-) diff --git a/.github/workflows/actions.yaml b/.github/workflows/actions.yaml index 37849864..83efb9a0 100644 --- a/.github/workflows/actions.yaml +++ b/.github/workflows/actions.yaml @@ -1,47 +1,54 @@ name: install-and-test on: [push] + +# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs +# `contents` is for permission to the contents of the repository. +# `pull-requests` is for permission to pull request +permissions: + contents: write + checks: write + pull-requests: write + jobs: install-and-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.9 - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - name: Install dependencies - run: | - pip install --upgrade pip - pip install '.[dev]' --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple - pip install coverage coveralls - - name: mypy - run: | - python -m mypy --ignore-missing-imports --follow-imports=silent --no-strict-optional src/nomad_simulations tests - - name: Test with pytest - run: | - python -m coverage run -m pytest -sv tests - - name: Submit to coveralls - continue-on-error: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - coveralls --service=github + - uses: actions/checkout@v3 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install dependencies + run: | + pip install uv + uv pip install -e '.[dev]' --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple --system + - name: mypy + run: | + python -m mypy --ignore-missing-imports --follow-imports=silent --no-strict-optional src/nomad_simulations tests + - name: Build coverage file + run: | + pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=src tests/ | tee pytest-coverage.txt + - name: Pytest coverage comment + uses: MishaKav/pytest-coverage-comment@main + with: + pytest-coverage-path: pytest-coverage.txt + junitxml-path: pytest.xml build-and-install: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.9 - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - name: Build the package - run: | - pip install --upgrade pip - pip install build - python -m build --sdist - - name: Install the package - run: | - pip install dist/*.tar.gz --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple + - uses: actions/checkout@v3 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Build the package + run: | + pip install --upgrade pip + pip install build + python -m build --sdist + - name: Install the package + run: | + pip install dist/*.tar.gz --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple ruff-linting: runs-on: ubuntu-latest steps: diff --git a/pyproject.toml b/pyproject.toml index d09f6427..3a596817 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,9 +31,9 @@ dependencies = [ [project.optional-dependencies] dev = [ 'mypy==1.0.1', - 'pytest==3.10.0', - 'pytest-timeout==1.4.2', - 'pytest-cov==2.7.1', + 'pytest', + 'pytest-timeout', + 'pytest-cov', 'ruff', "structlog==22.3.0", "lxml_html_clean>=0.1.0",