Add testing and test coverage as github actions #7
Workflow file for this run
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
# 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-build: | |
runs-on: windows-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
RCLR_VERSION: 0.9.2 | |
R_KEEP_PKG_SOURCE: yes | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download latest PK-sim build archive | |
run: | | |
$url = "https://ci.appveyor.com/api/projects/open-systems-pharmacology-ci/pk-sim/artifacts/setup.zip?branch=develop" | |
# Define the location where you want to save the zip file | |
$outputPath = "${{ runner.workspace }}/setup.zip" | |
Invoke-WebRequest -Uri $url -OutFile $outputPath | |
shell: powershell | |
- name: Unzip PK-sim build archive | |
run: | | |
$zipPath = "${{ runner.workspace }}/setup.zip" | |
$unzipPath = "${{ runner.workspace }}/unzipped" | |
Expand-Archive -Path $zipPath -DestinationPath $unzipPath | |
shell: powershell | |
- name: Install PK-sim MSI | |
run: | | |
$msiPath = Get-ChildItem -Path "${{ runner.workspace }}/unzipped" -Filter "*.msi" | Select-Object -First 1 | |
if ($msiPath) { | |
Start-Process msiexec -ArgumentList "/i", $msiPath.FullName, "/quiet", "/qn", "/norestart" -Wait | |
} else { | |
Write-Output "No MSI file found in the unzipped directory." | |
exit 1 | |
} | |
shell: powershell | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- name: Download rClr | |
run: | | |
RCLR_URL <- "https://github.com/Open-Systems-Pharmacology/rClr/releases/download/v${{ env.RCLR_VERSION }}/rClr_${{ env.RCLR_VERSION }}.zip" | |
download.file(RCLR_URL, "rClr_${{ env.RCLR_VERSION }}.zip") | |
shell: Rscript {0} | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: | | |
rClr=local::./rClr_${{ env.RCLR_VERSION }}.zip | |
any::rcmdcheck | |
any::devtools | |
local::. | |
ospsuite.utils=github::Open-Systems-Pharmacology/OSPSuite.RUtils | |
tlf=github::Open-Systems-Pharmacology/TLF-Library | |
ospsuite=github::Open-Systems-Pharmacology/OSPSuite-R | |
ospsuite.parameteridentification=github::Open-Systems-Pharmacology/OSPSuite.ParameterIdentification | |
needs: check | |
- name: build package | |
run: | | |
devtools::build(binary = TRUE, path = "built_package/") | |
list.files("./built_package/", pattern = "esqlabsR_.*\\.zip", full.names = TRUE) | |
shell: Rscript {0} | |
- name: create test file | |
run: | | |
file.create("built_package/test.txt") | |
shell: Rscript {0} | |
- name: upload built package | |
uses: actions/upload-artifact@v3 | |
with: | |
path: D:/a/esqlabsR/built_package/esqlabsR_*.zip | |
- name: upload test file | |
uses: actions/upload-artifact@v3 | |
with: | |
path: D:/a/esqlabsR/built_package/test.txt |