diff --git a/.github/workflows/check-python.yml b/.github/workflows/check-python.yml index c729c69..a61b689 100644 --- a/.github/workflows/check-python.yml +++ b/.github/workflows/check-python.yml @@ -88,25 +88,3 @@ jobs: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - - name: Generate coverage report - if: matrix.config.python == '3.10' - run: | - pip install pytest-cov - cd python - pytest --cov=port4me ## output summarize in GitHub logs - pytest --cov=port4me --cov-report=xml:coverage.xml - ## AD HOC: Make reported paths relative to the root of repository - sed -i 's/filename="/filename="python\/port4me\//g' coverage.xml - - - - name: Upload Coverage to Codecov - if: matrix.config.python == '3.10' - uses: codecov/codecov-action@v3 - with: - env_vars: OS,PYTHON - files: python/coverage.xml - fail_ci_if_error: true - flags: python - name: codecov-umbrella-python - verbose: true diff --git a/.github/workflows/check-r.yml b/.github/workflows/check-r.yml index 5c610a2..e9a2224 100644 --- a/.github/workflows/check-r.yml +++ b/.github/workflows/check-r.yml @@ -64,8 +64,7 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: working-directory: r - extra-packages: any::rcmdcheck any::covr any::jsonlite - needs: check coverage + extra-packages: any::rcmdcheck any::jsonlite - name: Install port4me run: | @@ -123,13 +122,3 @@ jobs: with: name: ${{ runner.os }}-r${{ matrix.config.r }}-results path: check - - - name: Test coverage - if: matrix.config.os == 'ubuntu-latest' && matrix.config.r == 'release' - run: | - setwd("r") - ## relative_path = ".." => reported files r/R/*.R, r/src/*.{c,h} - coverage <- covr::package_coverage(relative_path = "..", quiet = FALSE) - print(coverage) - covr::codecov(coverage = coverage, flags = "r", quiet = FALSE) ## Upload to codecov - shell: Rscript {0} diff --git a/.github/workflows/coverage-python.yml b/.github/workflows/coverage-python.yml new file mode 100644 index 0000000..ceb6b38 --- /dev/null +++ b/.github/workflows/coverage-python.yml @@ -0,0 +1,64 @@ +on: + push: + paths: + - 'python/**/*' + - .github/workflows/check-python.yml + pull_request: + paths: + - 'python/**/*' + - .github/workflows/check-python.yml + +name: "Python checks" + +permissions: + contents: read + +jobs: + check: + if: "! contains(github.event.head_commit.message, '[ci skip]')" + + timeout-minutes: 5 + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: 3.10 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + + - name: Install port4me + run: | + cd python/ + pip install . + + - name: Session information + run: | + python -c "import os; print('EUID='+str(os.geteuid()))" + python --version + python -m port4me --version + + - name: Generate coverage report + run: | + pip install pytest-cov + cd python + pytest --cov=port4me ## output summarize in GitHub logs + pytest --cov=port4me --cov-report=xml:coverage.xml + ## AD HOC: Make reported paths relative to the root of repository + sed -i 's/filename="/filename="python\/port4me\//g' coverage.xml + + - name: Upload Coverage to Codecov + uses: codecov/codecov-action@v3 + with: + env_vars: OS,PYTHON + files: python/coverage.xml + fail_ci_if_error: true + flags: python + name: codecov-umbrella-python + verbose: true diff --git a/.github/workflows/coverage-r.yml b/.github/workflows/coverage-r.yml new file mode 100644 index 0000000..06ceb23 --- /dev/null +++ b/.github/workflows/coverage-r.yml @@ -0,0 +1,71 @@ +on: + push: + paths: + - 'r/**/*' + - .github/workflows/check-r.yml + pull_request: + paths: + - 'r/**/*' + - .github/workflows/check-r.yml + +name: "R checks" + +jobs: + check: + if: "! contains(github.event.head_commit.message, '[ci skip]')" + + timeout-minutes: 10 + + runs-on: ubuntu-latest + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + R_REMOTES_NO_ERRORS_FROM_WARNINGS: true + ## R CMD check + _R_CHECK_CRAN_INCOMING_: false + _R_CHECK_MATRIX_DATA_: true + _R_CHECK_SUGGESTS_ONLY_: true + + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-tinytex@v2 + + - name: Install system dependencies (Linux) + if: runner.os == 'Linux' + run: sudo apt-get install -y tidy + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + working-directory: r + extra-packages: any::rcmdcheck any::covr any::jsonlite + needs: check coverage + + - name: Install port4me + run: | + cd r/ + Rscript -e "install.packages('.', repos = NULL, type = 'source')" + + - name: Session info + run: | + options(width = 100) + capabilities() + pkgs <- installed.packages()[, "Package"] + sessioninfo::session_info(pkgs, include_base = TRUE) + shell: Rscript {0} + + - name: Test coverage + run: | + setwd("r") + ## relative_path = ".." => reported files r/R/*.R, r/src/*.{c,h} + coverage <- covr::package_coverage(relative_path = "..", quiet = FALSE) + print(coverage) + covr::codecov(coverage = coverage, flags = "r", quiet = FALSE) ## Upload to codecov + shell: Rscript {0}