Merge pull request #160 from StoXProject/codecov #143
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: | ||
- master | ||
name: test-coverage | ||
jobs: | ||
test-coverage: | ||
runs-on: ubuntu-22.04 | ||
env: | ||
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | ||
RSPM: ${{ matrix.config.rspm }} | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: r-lib/actions/setup-r@v2 | ||
id: install-r | ||
with: | ||
r-version: "4.4" | ||
- name: Install 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@v4 | ||
with: | ||
path: ${{ env.R_LIBS_USER }} | ||
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} | ||
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- | ||
- name: Prepare for dependencies on Linux | ||
if: runner.os == 'Linux' | ||
run: | | ||
sudo apt-get install libgdal-dev libproj-dev libgeos-dev libudunits2-dev | ||
shell: bash | ||
- name: Install system dependencies | ||
run: | | ||
while read -r cmd | ||
do | ||
eval sudo $cmd | ||
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') | ||
# | ||
# Install Reca (awlays from prod repo) | ||
# | ||
- name: Install Reca | ||
run: | | ||
remotes::install_cran("Reca", repos = c("https://stoxproject.github.io/repo/", "https://cloud.r-project.org/")) | ||
shell: Rscript {0} | ||
# | ||
# Install StoX dependencies, corresponding to release status (unstable, pre-release or release) | ||
# | ||
- name: Install R package dependencies from the unstableRepo | ||
if: (github.event_name == 'push' && github.ref_name == 'catchLotteryStox4') || (github.event_name == 'pull_request' && github.base_ref == 'catchLotteryStox4') | ||
run: | | ||
remotes::install_deps(dependencies = TRUE, repos = c("https://stoxproject.github.io/unstableRepo/", "https://cloud.r-project.org/")) | ||
shell: Rscript {0} | ||
- name: Install R package dependencies from the unstableRepo | ||
if: (github.event_name == 'push' && github.ref_name == 'develop') || (github.event_name == 'pull_request' && github.base_ref == 'develop') | ||
run: | | ||
remotes::install_deps(dependencies = TRUE, repos = c("https://stoxproject.github.io/unstableRepo/", "https://cloud.r-project.org/")) | ||
shell: Rscript {0} | ||
- name: Install R package dependencies from the testingRepo | ||
if: (github.event_name == 'push' && github.ref_name == 'testing') || (github.event_name == 'pull_request' && github.base_ref == 'testing') | ||
run: | | ||
remotes::install_deps(dependencies = TRUE, repos = c("https://stoxproject.github.io/testingRepo/", "https://cloud.r-project.org/")) | ||
shell: Rscript {0} | ||
- name: Install R package dependencies from the official repo | ||
if: (github.event_name == 'push' && github.ref_name == 'master') || (github.event_name == 'pull_request' && github.base_ref == 'master') | ||
run: | | ||
remotes::install_deps(dependencies = TRUE, repos = c("https://stoxproject.github.io/repo/", "https://cloud.r-project.org/")) | ||
shell: Rscript {0} | ||
- name: Install dependencies | ||
run: | | ||
remotes::install_deps(dependencies = TRUE) | ||
remotes::install_cran("drat") | ||
remotes::install_cran("covr") | ||
shell: Rscript {0} | ||
- name: Test coverage | ||
run: | | ||
R CMD INSTALL . | ||
Rscript -e 'covr::codecov()' | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} |