Skip to content

Commit

Permalink
update checks
Browse files Browse the repository at this point in the history
  • Loading branch information
wjschne committed Apr 13, 2024
1 parent 18c5c7e commit 7fafddf
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 36 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
58 changes: 30 additions & 28 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,50 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches:
- main
- master
branches: [main, master]
pull_request:
branches:
- main
- master
branches: [main, master]

name: test-coverage

jobs:
test-coverage:
runs-on: macOS-latest
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
needs: coverage

- name: Query dependencies
- name: Test coverage
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
shell: Rscript {0}

- name: Restore R package cache
uses: actions/cache@v2
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: Install dependencies
- name: Show testthat output
if: always()
run: |
install.packages(c("remotes"))
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("covr")
shell: Rscript {0}
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Test coverage
run: covr::codecov()
shell: Rscript {0}
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
1 change: 1 addition & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ knitr::opts_chunk$set(
[![CRAN status](https://www.r-pkg.org/badges/version/simstandard)](https://CRAN.R-project.org/package=simstandard)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![Codecov test coverage](https://codecov.io/gh/wjschne/simstandard/branch/main/graph/badge.svg)](https://app.codecov.io/gh/wjschne/simstandard?branch=main)
[![R-CMD-check](https://github.com/wjschne/simstandard/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/wjschne/simstandard/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->


Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ status](https://www.r-pkg.org/badges/version/simstandard)](https://CRAN.R-projec
stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![Codecov test
coverage](https://codecov.io/gh/wjschne/simstandard/branch/main/graph/badge.svg)](https://app.codecov.io/gh/wjschne/simstandard?branch=main)
[![R-CMD-check](https://github.com/wjschne/simstandard/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/wjschne/simstandard/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

Sometimes you have a structural model with standardized path
Expand Down Expand Up @@ -69,14 +70,14 @@ data <- sim_standardized(m = model, n = 500)
knitr::kable(head(data), digits = 2)
```

| A1 | A2 | B1 | B2 | C | A | B | e_A1 | e_A2 | e_B1 | e_B2 | d_B |
|------:|-----:|------:|------:|------:|------:|------:|------:|------:|------:|------:|------:|
| -0.72 | 0.70 | 0.53 | -0.81 | -1.05 | 0.65 | -0.22 | -1.04 | 0.18 | 0.66 | -0.66 | -0.74 |
| -0.13 | 0.26 | 0.48 | 0.66 | 1.51 | 1.51 | 1.89 | -0.89 | -0.95 | -0.65 | -0.66 | 0.68 |
| 0.67 | 0.39 | -0.53 | 0.28 | 0.56 | 0.21 | -0.37 | 0.56 | 0.22 | -0.31 | 0.54 | -0.53 |
| -0.55 | 0.15 | 0.82 | -1.60 | 0.71 | -0.27 | -0.46 | -0.42 | 0.36 | 1.10 | -1.28 | -0.25 |
| 0.62 | 0.10 | -1.36 | -0.78 | -0.87 | -0.46 | 0.11 | 0.86 | 0.47 | -1.43 | -0.86 | 0.48 |
| 1.56 | 1.85 | 1.01 | -0.03 | 0.43 | 1.35 | 1.29 | 0.89 | 0.77 | 0.24 | -0.93 | 0.21 |
| A1 | A2 | B1 | B2 | C | A | B | e_A1 | e_A2 | e_B1 | e_B2 | d_B |
|------:|------:|------:|------:|------:|------:|------:|------:|------:|------:|------:|------:|
| 0.95 | -0.20 | -0.48 | 0.64 | -0.07 | 0.25 | 0.62 | 0.83 | -0.40 | -0.85 | 0.21 | 0.42 |
| -0.58 | -0.47 | 0.60 | 0.87 | 1.03 | 0.43 | -0.83 | -0.80 | -0.82 | 1.10 | 1.46 | -1.18 |
| -0.06 | -1.82 | -1.45 | -1.34 | 0.10 | -1.46 | -2.38 | 0.67 | -0.66 | -0.02 | 0.33 | -1.21 |
| -2.50 | -0.51 | -0.95 | -1.75 | -0.68 | -1.18 | -1.90 | -1.92 | 0.43 | 0.19 | -0.42 | -0.96 |
| 1.05 | -0.64 | 0.19 | 0.22 | 1.36 | -0.36 | -0.28 | 1.23 | -0.36 | 0.35 | 0.42 | 0.01 |
| -0.01 | -0.83 | -0.67 | -0.86 | 0.49 | -0.75 | -0.32 | 0.36 | -0.24 | -0.47 | -0.63 | 0.27 |

See more in the [tutorial for this
package](https://wjschne.github.io/simstandard//articles/simstandard_tutorial.html).

0 comments on commit 7fafddf

Please sign in to comment.