Skip to content

Commit

Permalink
GA: Split out package-check job from coverage jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed Jan 15, 2024
1 parent 642a35e commit 73d2218
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 34 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/check-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 1 addition & 12 deletions .github/workflows/check-r.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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}
64 changes: 64 additions & 0 deletions .github/workflows/coverage-python.yml
Original file line number Diff line number Diff line change
@@ -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
71 changes: 71 additions & 0 deletions .github/workflows/coverage-r.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
on:

Check failure on line 1 in .github/workflows/coverage-r.yml

View workflow job for this annotation

GitHub Actions / check

.github/workflows/coverage-r.yml#L1

This run was manually canceled.
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}

0 comments on commit 73d2218

Please sign in to comment.