0.0.2 rev and workflow integration #5
Workflow file for this run
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
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
name: R Package CI | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: 4.1 # You can change this to the R version you need | |
- name: Cache C++ and R dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cache/R | |
~/.local/share/R | |
key: dependencies-${{ runner.os }}-${{ hashFiles('**/DESCRIPTION') }} | |
restore-keys: | | |
dependencies-${{ runner.os }}- | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libudunits2-dev libgdal-dev | |
- name: Install dependencies | |
run: | | |
R -e 'install.packages("remotes")' | |
R -e 'remotes::install_deps()' | |
- name: Install dependencies for covr and testthat | |
run: R -e 'install.packages(c("covr", "testthat"), dependencies = TRUE)' | |
- name: Run tests and calculate coverage | |
run: | | |
echo "Current working directory: $(pwd)" | |
R -e 'library(covr); covr::package_coverage(coverage_file = "coverage.xml")' | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
coverage_reports: ${{ github.workspace }}/coverage.xml | |
working-directory: "./scomps" | |
- name: Cleanup | |
run: | | |
R -e 'remove.packages("remotes")' |