Skip to content

Commit 838c0ac

Browse files
committed
Add test coverage and documentation generation to GH actions.
1 parent 91148a1 commit 838c0ac

File tree

5 files changed

+133
-93
lines changed

5 files changed

+133
-93
lines changed

.github/workflows/pkgdown.yaml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
- master
6+
7+
name: pkgdown
8+
9+
jobs:
10+
pkgdown:
11+
runs-on: macOS-latest
12+
env:
13+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- uses: r-lib/actions/setup-r@v1
18+
19+
- uses: r-lib/actions/setup-pandoc@v1
20+
21+
- name: Query dependencies
22+
run: |
23+
install.packages('remotes')
24+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
25+
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
26+
shell: Rscript {0}
27+
28+
- name: Cache R packages
29+
uses: actions/cache@v2
30+
with:
31+
path: ${{ env.R_LIBS_USER }}
32+
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
33+
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
34+
35+
- name: Install dependencies
36+
run: |
37+
remotes::install_deps(dependencies = TRUE)
38+
install.packages("pkgdown", type = "binary")
39+
shell: Rscript {0}
40+
41+
- name: Install package
42+
run: R CMD INSTALL .
43+
44+
- name: Build site and reports
45+
run: |
46+
Rscript -e 'pkgdown::build_site(preview = FALSE)'
47+
Rscript ./scripts/generate_sample_reports.R
48+
49+
- name: Configure AWS credentials
50+
uses: aws-actions/configure-aws-credentials@v1
51+
with:
52+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
53+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
54+
aws-region: us-west-2
55+
56+
- name: Copy files to the website with the AWS CLI
57+
run: |
58+
aws s3 cp --recursive docs s3://${{ secrets.DEPLOY_BUCKET }}/
59+
#aws s3 sync . s3://my-s3-test-website-bucket
60+
61+
- name: Copy reports to the website with the AWS CLI
62+
run: |
63+
aws s3 cp --recursive reports s3://${{ secrets.DEPLOY_BUCKET }}/reports/
64+
#aws s3 sync . s3://my-s3-test-website-bucket

.github/workflows/test-coverage.yaml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
- master
6+
pull_request:
7+
branches:
8+
- main
9+
- master
10+
11+
name: test-coverage
12+
13+
jobs:
14+
test-coverage:
15+
runs-on: macOS-latest
16+
env:
17+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- uses: r-lib/actions/setup-r@v1
22+
23+
- uses: r-lib/actions/setup-pandoc@v1
24+
25+
- name: Query dependencies
26+
run: |
27+
install.packages('remotes')
28+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
29+
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
30+
shell: Rscript {0}
31+
32+
- name: Cache R packages
33+
uses: actions/cache@v2
34+
with:
35+
path: ${{ env.R_LIBS_USER }}
36+
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
37+
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
38+
39+
- name: Install dependencies
40+
run: |
41+
install.packages(c("remotes"))
42+
remotes::install_deps(dependencies = TRUE)
43+
remotes::install_cran("covr")
44+
shell: Rscript {0}
45+
46+
- name: Test coverage
47+
run: covr::codecov()
48+
shell: Rscript {0}

README.Rmd

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ knitr::opts_chunk$set(
1717

1818
<!-- badges: start -->
1919
[![R build status](https://github.com/davidski/evaluator/workflows/R-CMD-check/badge.svg)](https://github.com/davidski/evaluator/actions)
20-
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/davidski/evaluator?branch=master&svg=true)](https://ci.appveyor.com/project/davidski/evaluator)
2120
[![Coverage Status](https://codecov.io/gh/davidski/evaluator/branch/master/graph/badge.svg)](https://codecov.io/github/davidski/evaluator?branch=master)
2221
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/evaluator)](https://cran.r-project.org/package=evaluator)
2322
![downloads](https://cranlogs.r-pkg.org/badges/grand-total/evaluator)

README.md

+21-23
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55

66
<!-- badges: start -->
77

8-
[![Build
9-
Status](https://travis-ci.org/davidski/evaluator.svg?branch=master)](https://travis-ci.org/davidski/evaluator)
10-
[![AppVeyor Build
11-
Status](https://ci.appveyor.com/api/projects/status/github/davidski/evaluator?branch=master&svg=true)](https://ci.appveyor.com/project/davidski/evaluator)
8+
[![R build
9+
status](https://github.com/davidski/evaluator/workflows/R-CMD-check/badge.svg)](https://github.com/davidski/evaluator/actions)
1210
[![Coverage
1311
Status](https://codecov.io/gh/davidski/evaluator/branch/master/graph/badge.svg)](https://codecov.io/github/davidski/evaluator?branch=master)
1412
[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/evaluator)](https://cran.r-project.org/package=evaluator)
@@ -26,12 +24,12 @@ data-driven risk review.
2624

2725
Three sample outputs of this toolkit are available:
2826

29-
1) A [sample risk
27+
1. A [sample risk
3028
analysis](https://evaluator.tidyrisk.org/reports/evaluator_risk_analysis.html)
3129
report
32-
2) A one page [risk
30+
2. A one page [risk
3331
dashboard](https://evaluator.tidyrisk.org/reports/evaluator_risk_dashboard.html)
34-
3) A demonstration copy of [Scenario
32+
3. A demonstration copy of [Scenario
3533
Explorer](https://davidski.shinyapps.io/scenario_explorer)
3634

3735
## Installation
@@ -68,11 +66,11 @@ From Excel:
6866

6967
From Evaluator:
7068

71-
2. Import the data
72-
3. Prepare the data for simulation
73-
4. Run the simulations
74-
5. Summarize the results
75-
6. Generate draft reports for customization
69+
1. Import the data
70+
2. Prepare the data for simulation
71+
3. Run the simulations
72+
4. Summarize the results
73+
5. Generate draft reports for customization
7674

7775
A detailed guide is available in the vignette accessed via
7876
`vignette("usage", package="evaluator")`. A short screencast showing the
@@ -86,38 +84,38 @@ While evaluator is a powerful tool, it does not attempt to address
8684
interactions between risk scenarios, rolling up multiple levels of risk
8785
into aggregations, or other advanced topics. As you become more
8886
comfortable with quantitative risk analysis, you may wish to dive deeper
89-
into these areas (and I hope you do\!). The following resources may help
87+
into these areas (and I hope you do!). The following resources may help
9088
you explore these and other topics in risk management.
9189

9290
### Alternative Software
9391

94-
- [RiskLens](http://www.risklens.com/), a commercial analysis suite,
92+
- [RiskLens](http://www.risklens.com/), a commercial analysis suite,
9593
founded by the original creator of the FAIR methodology
96-
- [FAIR Tool](https://github.com/zugo01/FAIRTool), a Shiny and R based
94+
- [FAIR Tool](https://github.com/zugo01/FAIRTool), a Shiny and R based
9795
two scenario simulator, authored by Ezeugo Aguta under an MIT
9896
license
99-
- [FAIR-U](https://www.fairinstitute.org/fair-u), a free educational
97+
- [FAIR-U](https://www.fairinstitute.org/fair-u), a free educational
10098
tool for learning FAIR analysis, powered by RiskLens
101-
- [Open FAIR Risk Analysis
99+
- [Open FAIR Risk Analysis
102100
Tool](https://publications.opengroup.org/i181), an Excel and SIPMath
103101
base tool with a limited open license
104102

105103
### Blogs/Books/Training
106104

107-
- Russell C. Thomas’s excellent and provocative blog post on systemic
105+
- Russell C. Thomas’s excellent and provocative blog post on systemic
108106
[Risk
109107
Management](http://exploringpossibilityspace.blogspot.com/2013/08/risk-management-out-with-old-in-with-new.html)
110-
- [Measuring and Managing Information
108+
- [Measuring and Managing Information
111109
Risk](https://smile.amazon.com/gp/product/0124202314)
112-
- [OpenFAIR
110+
- [OpenFAIR
113111
certification](http://www.opengroup.org/certifications/openfair)
114-
- [Hubbard Decision Research calibration
112+
- [Hubbard Decision Research calibration
115113
training](https://www.hubbardresearch.com/training/)
116114

117115
### Associations
118116

119-
- [FAIR Institute](http://www.fairinstitute.org/)
120-
- [Society of Information Risk Analysts
117+
- [FAIR Institute](http://www.fairinstitute.org/)
118+
- [Society of Information Risk Analysts
121119
(SIRA)](https://www.societyinforisk.org/)
122120

123121
## Contributing

appveyor.yml

-69
This file was deleted.

0 commit comments

Comments
 (0)