R-CMD-check #3584
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. | |
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions | |
on: | |
push: | |
branches: | |
- main | |
- fix/* | |
pull_request: | |
branches: | |
- main | |
- fix/* | |
schedule: | |
- cron: '0 2 * * *' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.sha }}-${{ github.base_ref || '' }} | |
cancel-in-progress: true | |
name: R-CMD-check | |
jobs: | |
build_src_package: | |
runs-on: ubuntu-22.04 | |
name: Build source R package | |
env: | |
RSPM: https://packagemanager.rstudio.com/cran/__linux__/jammy/latest | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
- name: apt update | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libarpack2-dev | |
shell: bash | |
- name: Cache Python virtualenv | |
uses: actions/cache@v2 | |
with: | |
path: .venv | |
key: Python-venv-jammy-${{ runner.os }}-${{ hashFiles('tools/build-requirements.txt') }} | |
- name: Install R dependencies | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
needs: build | |
pak-version: devel | |
- name: Create R source package | |
run: | | |
make igraph | |
shell: bash | |
- name: Commit changes | |
if: ${{ env.GITHUB_ACTOR == env.GITHUB_REPOSITORY_OWNER }} | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
git config --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
git fetch | |
if [ -n "${GITHUB_HEAD_REF}" ]; then | |
git add . | |
git stash save | |
git switch ${GITHUB_HEAD_REF} | |
git stash pop | |
fi | |
git add . | |
git commit -m "Automated changes" | |
git push | |
fi | |
shell: bash | |
- name: Package validation | |
if: ${{ env.GITHUB_ACTOR != env.GITHUB_REPOSITORY_OWNER }} | |
run: | | |
git status --porcelain | |
if [ -n "$(git status --porcelain)" ]; then | |
git add . | |
git diff --cached | |
/bin/false | |
fi | |
shell: bash | |
- name: Smoke test | |
run: | | |
make test | |
shell: bash | |
- name: Upload R source package | |
uses: actions/upload-artifact@v2 | |
with: | |
name: rigraph | |
path: igraph_*.tar.gz | |
retention-days: 5 | |
R-CMD-check: | |
runs-on: ${{ matrix.config.os }} | |
needs: build_src_package | |
name: Check ${{ matrix.config.os }} (${{ matrix.config.r }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {os: windows-latest, r: 'release'} | |
# - {os: macOS-latest, r: 'release'} | |
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} | |
# - {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} | |
- {os: ubuntu-20.04, r: 'oldrel-1', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} | |
- {os: ubuntu-20.04, r: 'oldrel-2', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} | |
- {os: ubuntu-20.04, r: 'oldrel-3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} | |
- {os: ubuntu-20.04, r: 'oldrel-4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} | |
env: | |
RSPM: ${{ matrix.config.rspm }} | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
RGL_USE_NULL: true # Ensure that rgl functions correctly on macOS | |
MAKEFLAGS: -j2 | |
_R_CHECK_PKG_SIZES_: FALSE | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Install ccache | |
uses: hendrikmuhs/ccache-action@v1.2.10 | |
with: | |
max-size: 10G | |
verbose: 1 | |
save: false | |
restore: false | |
- name: apt update | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libarpack2-dev | |
shell: bash | |
- name: apt update | |
if: runner.os == 'macOS' | |
run: | | |
brew install glpk | |
shell: bash | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.config.r }} | |
- name: Setup Pandoc | |
uses: r-lib/actions/setup-pandoc@v2 | |
- name: Install R dependencies | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: any::rcmdcheck | |
needs: check | |
- name: Check R package | |
uses: r-lib/actions/check-r-package@v2 | |
with: | |
error-on: '"note"' | |
coverage: | |
runs-on: ubuntu-20.04 | |
needs: build_src_package | |
name: Coverage | |
env: | |
RSPM: https://packagemanager.rstudio.com/cran/__linux__/focal/latest | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
MAKEFLAGS: -j2 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: apt update | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libarpack2-dev | |
shell: bash | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
- name: Setup Pandoc | |
uses: r-lib/actions/setup-pandoc@v2 | |
- name: Install R dependencies | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
needs: coverage | |
pak-version: devel | |
- name: Run coverage | |
run: | | |
line_exclusions <- fs::dir_ls(c("src/vendor"), type = "file", recurse = TRUE) | |
cov <- covr::package_coverage( | |
type = c("tests", "examples"), | |
line_exclusions = as.list(names(line_exclusions)), | |
quiet = FALSE, | |
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") | |
) | |
covr::to_cobertura(cov) | |
shell: Rscript {0} | |
- uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }} | |
file: ./cobertura.xml | |
plugin: noop | |
disable_search: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
sanitizer: | |
runs-on: ubuntu-22.04 | |
needs: build_src_package | |
name: Sanitizer | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: apt update | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libarpack2-dev | |
shell: bash | |
- name: run sanitizer | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: ghcr.io/krlmlr/rigraph-san:main | |
options: --rm --platform linux/amd64 -v ${{ github.workspace }}:/rigraph | |
run: | | |
set -e | |
printenv | |
cd rigraph | |
RDcsan CMD INSTALL . --no-byte-compile | |
TESTTHAT_PARALLEL=false CI=true RDcsan -q -e 'testthat::test_local(reporter = c("location", "summary"), load_package = "installed")' |