-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Insang Song
authored
Oct 3, 2023
1 parent
9bcbe81
commit 9997ad3
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
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
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")' |