Skip to content

incl rgdal

incl rgdal #259

on: [push, pull_request]
name: test-coverage
jobs:
test-coverage:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
- { os: windows-latest, r: "4.2" }
- {
os: ubuntu-20.04,
r: "4.1",
rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest",
}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.config.os }}-${{ matrix.config.r }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
- uses: r-lib/actions/setup-pandoc@v2
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
shell: Rscript {0}
- name: Cache R packages
uses: actions/cache@v3
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ matrix.config.os }}-r-${{ matrix.config.r }}-3-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ matrix.config.os }}-r-${{ matrix.config.r }}-3-
- name: Install system dependencies
if: runner.os == 'Linux'
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
sudo apt install libgtk2.0-dev xorg-dev libxml2-dev libnlopt-dev libcurl4-openssl-dev libudunits2-dev libcgal-dev libglu1-mesa-dev libgdal-dev
- name: Install RGtk2
if: runner.os == 'Windows'
run: ./.github/install_gtk.cmd
shell: bash
- name: Add GTK to PATH
if: runner.os == 'Windows'
run: echo "${{env.R_LIBS_USER}}\RGtk2\gtk\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Check RGtk2
if: runner.os == 'Windows'
run: |
library(RGtk2)
gtkWindowNew()
shell: Rscript {0}
- name: Install dependencies
env:
OS_TYPE: ${{ runner.os }}
uses: GabrielBB/xvfb-action@v1.2
with:
run: Rscript ./.github/install_deps.R
- name: Create iNZightVIT directory
if: runner.os == 'Windows'
run: try(dir.create(file.path("~", "Documents", "iNZightVIT"), recursive = TRUE))
shell: Rscript {0}
- name: Install XVFB
if: runner.os == 'Linux'
run: sudo apt-get install xvfb
- name: Test coverage [linux]
if: runner.os == 'Linux'
uses: nick-invision/retry@v1
with:
timeout_minutes: 10
max_attempts: 3
command: xvfb-run --auto-servernum Rscript -e "covr::codecov()"
- name: Test coverage [win]
if: runner.os != 'Linux'
uses: nick-invision/retry@v1
with:
timeout_minutes: 10
max_attempts: 5
command: Rscript -e "covr::codecov()"
- name: Clean up XVFB
if: runner.os == 'Linux'
run: |
kill_xvfb () {
local xvfb_pids=`ps aux | grep tmp/xvfb-run | grep -v grep | awk '{print $2}'`
if [ "$xvfb_pids" != "" ]; then
echo "Killing the following xvfb processes: $xvfb_pids"
sudo kill $xvfb_pids
else
echo "No xvfb processes to kill"
fi
}
kill_xvfb