Merge pull request #6 from dfe-analytical-services/updated_version_ks… #44
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: | |
- main | |
- development | |
pull_request: | |
name: shiny-tests | |
jobs: | |
automatedTests: | |
runs-on: ${{ matrix.config.os }} | |
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
# Running on mac as it's quicker to build | |
- {os: macOS-latest, r: 'release'} | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
RSPM: ${{ matrix.config.rspm }} | |
RENV_PATHS_ROOT: ~/.local/share/renv | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: 4.2.1 | |
use-public-rspm: true | |
- name: Cache R packages | |
if: runner.os != 'Windows' | |
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: Cache renv packages | |
uses: actions/cache@v1 | |
with: | |
path: ${{ env.RENV_PATHS_ROOT }} | |
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }} | |
restore-keys: | | |
${{ runner.os }}-renv- | |
- name: Restore renv snapshot | |
shell: Rscript {0} | |
run: | | |
if (!requireNamespace("renv", quietly = TRUE)) install.packages("renv") | |
renv::restore() | |
- name: Find PhantomJS path | |
id: phantomjs | |
run: | | |
echo "::set-output name=path::$(Rscript -e 'cat(shinytest:::phantom_paths()[[1]])')" | |
- name: Cache PhantomJS | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.phantomjs.outputs.path }} | |
key: ${{ runner.os }}-phantomjs | |
restore-keys: ${{ runner.os }}-phantomjs | |
- name: Install PhantomJS | |
shell: Rscript {0} | |
run: | | |
options(install.packages.check.source = "no") | |
if (!shinytest::dependenciesInstalled()) shinytest::installDependencies() | |
- name: Run tests | |
shell: Rscript {0} | |
run: | | |
shiny::runTests(".", assert = TRUE) | |
- name: Upload test results | |
if: failure() | |
uses: actions/upload-artifact@master | |
with: | |
name: ${{ runner.os }}-r${{ matrix.config.r }}-tests | |
path: tests |