Skip to content

Commit

Permalink
Create codecov.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
Insang Song authored Oct 3, 2023
1 parent 9bcbe81 commit 9997ad3
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: R Package CI

#on:
# push:
# branches:
# - main
# pull_request:
# branches:
# - main

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

- name: Cleanup
run: |
R -e 'remove.packages("remotes")'

0 comments on commit 9997ad3

Please sign in to comment.