-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
17 changed files
with
328 additions
and
173 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,47 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
R-CMD: | ||
runs-on: ${{ matrix.config.os }} | ||
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- { os: ubuntu-latest, r: 'devel', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"} | ||
|
||
env: | ||
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | ||
GITHUB_PAT: ${{ secrets.GH_RFASSTUI_TOKEN}} | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: r-lib/actions/setup-r@v2-branch | ||
with: | ||
r-version: '3.6' | ||
- uses: r-lib/actions/setup-pandoc@v2-branch | ||
- uses: r-lib/actions/setup-tinytex@v2-branch | ||
|
||
- name: Install libraries | ||
if: startsWith(matrix.config.os, 'ubuntu') | ||
run: | | ||
sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable | ||
sudo apt-get update | ||
sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev libudunits2-dev libgdal-dev libgeos-dev libproj-dev libmagick++-dev libavfilter-dev libharfbuzz-dev libfribidi-dev | ||
- name: Install dependencies | ||
run: | | ||
install.packages(c("remotes","rcmdcheck"), repos = "https://cloud.r-project.org") | ||
remotes::install_deps(dependencies = TRUE) | ||
remotes::install_github("JGCRI/rpackageutils") | ||
shell: Rscript {0} | ||
|
||
- name: Check | ||
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--ignore-vignettes", "--no-build-vignettes"), build_args = c("--no-manual", "--ignore-vignettes", "--no-build-vignettes"), error_on = "error") | ||
shell: Rscript {0} |
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,48 @@ | ||
name: test-coverage | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | ||
GITHUB_PAT: ${{secrets.GH_GCAMREPORT_TOKEN}} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: r-lib/actions/setup-r@v2-branch | ||
with: | ||
r-version: '4.1.0' | ||
- uses: r-lib/actions/setup-pandoc@v2-branch | ||
- uses: r-lib/actions/setup-tinytex@v2-branch | ||
- uses: actions/download-artifact@v2 | ||
|
||
- name: Cache R packages | ||
uses: actions/cache@v1 | ||
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: Ubuntu config | ||
run: | | ||
sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable | ||
sudo apt-get update | ||
sudo apt-get install -y libcurl4-openssl-dev libharfbuzz-dev libfribidi-dev libssl-dev libxml2-dev libudunits2-dev libgdal-dev libgeos-dev libproj-dev libmagick++-dev libavfilter-dev | ||
- name: Install dependencies | ||
run: | | ||
install.packages(c("remotes","rcmdcheck","covr"), repos = "https://cloud.r-project.org") | ||
remotes::install_github("JGCRI/rpackageutils") | ||
remotes::install_deps(dependencies = TRUE) | ||
shell: Rscript {0} | ||
|
||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: bc3LC/rfasstui |
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
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
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,4 @@ | ||
library(testthat) | ||
library(rfasstui) | ||
|
||
test_check("rfasstui") |
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,91 @@ | ||
library(rfasst) | ||
|
||
|
||
context("globals") | ||
|
||
|
||
test_that("globals: color SSP scale", { | ||
|
||
globalSSPColorScales <- get_globalSSPColorScales() | ||
|
||
testthat::expect_equal(globalSSPColorScales, | ||
c("GCAM_SSP1" = "#5DBFDE", "GCAM_SSP2" = "#5CB95C", "GCAM_SSP3" = "#FBAB33", | ||
"GCAM_SSP4" ="#D7534E", "GCAM_SSP5" ="#9E49D1")) | ||
|
||
}) | ||
|
||
test_that("globals: color custom scale", { | ||
|
||
globalCustomColorScales <- get_globalCustomColorScales() | ||
|
||
testthat::expect_equal(globalCustomColorScales, | ||
c("#5DBFDE","#5CB95C","#FBAB33","#D7534E","#9E49D1")) | ||
|
||
}) | ||
|
||
|
||
test_that("globals: get example prj", { | ||
|
||
globalExamplePrj <- get_example_prj() | ||
|
||
testthat::expect_equal(globalExamplePrj, | ||
get(load(file.path(rprojroot::find_root(rprojroot::is_testthat),"test_results","globalExamplePrj.RData")))) | ||
|
||
}) | ||
|
||
test_that("globals: get queries", { | ||
|
||
globalQueries <- get_queries() | ||
|
||
testthat::expect_equal(globalQueries, | ||
get(load(file.path(rprojroot::find_root(rprojroot::is_testthat),"test_results","globalQueries.RData")))) | ||
|
||
}) | ||
|
||
|
||
test_that("globals: global capabilities", { | ||
|
||
globalCapabilities <- get_globalCapabilities() | ||
|
||
expect_equal(globalCapabilities[['emissions_bc']][1], 'emissions_bc') | ||
expect_equal(attributes(globalCapabilities[['emissions_bc']])$longName, 'BC emissions') | ||
|
||
expect_equal(globalCapabilities[['emissions_nh3']][1], 'emissions_nh3') | ||
expect_equal(attributes(globalCapabilities[['emissions_nh3']])$longName, 'NH3 emissions') | ||
|
||
expect_equal(globalCapabilities[['emissions_nmvoc']][1], 'emissions_nmvoc') | ||
expect_equal(attributes(globalCapabilities[['emissions_nmvoc']])$longName, 'NMVOC emissions') | ||
|
||
expect_equal(globalCapabilities[['emissions_nox']][1], 'emissions_nox') | ||
expect_equal(attributes(globalCapabilities[['emissions_nox']])$longName, 'NOx emissions') | ||
|
||
expect_equal(globalCapabilities[['emissions_pom']][1], 'emissions_pom') | ||
expect_equal(attributes(globalCapabilities[['emissions_pom']])$longName, 'POM emissions') | ||
|
||
expect_equal(globalCapabilities[['emissions_so2']][1], 'emissions_so2') | ||
expect_equal(attributes(globalCapabilities[['emissions_so2']])$longName, 'SO2 emissions') | ||
|
||
expect_equal(globalCapabilities[['concentration_pm25']][1], 'concentration_pm25') | ||
expect_equal(attributes(globalCapabilities[['concentration_pm25']])$longName, 'PM25 concentration') | ||
|
||
expect_equal(globalCapabilities[['concentration_o3']][1], 'concentration_o3') | ||
expect_equal(attributes(globalCapabilities[['concentration_o3']])$longName, 'O3 concentration') | ||
|
||
expect_equal(globalCapabilities[['health_deaths_pm25']][1], 'health_deaths_pm25') | ||
expect_equal(attributes(globalCapabilities[['health_deaths_pm25']])$longName, 'Premature deaths due to PM25') | ||
|
||
expect_equal(globalCapabilities[['health_deaths_o3']][1], 'health_deaths_o3') | ||
expect_equal(attributes(globalCapabilities[['health_deaths_o3']])$longName, 'Premature deaths due to O3') | ||
|
||
expect_equal(globalCapabilities[['health_deaths_total']][1], 'health_deaths_total') | ||
expect_equal(attributes(globalCapabilities[['health_deaths_total']])$longName, 'Total premature deaths') | ||
|
||
expect_equal(globalCapabilities[['agriculture_ryl_mi']][1], 'agriculture_ryl_mi') | ||
expect_equal(attributes(globalCapabilities[['agriculture_ryl_mi']])$longName, 'Agriculture relative yield loss') | ||
|
||
expect_equal(globalCapabilities[['agriculture_prod_loss']][1], 'agriculture_prod_loss') | ||
expect_equal(attributes(globalCapabilities[['agriculture_prod_loss']])$longName, 'Agriculture production loss') | ||
|
||
expect_equal(globalCapabilities[['agriculture_rev_loss']][1], 'agriculture_rev_loss') | ||
expect_equal(attributes(globalCapabilities[['agriculture_rev_loss']])$longName, 'Agriculture revenue loss') | ||
}) |
Oops, something went wrong.