Skip to content

Commit

Permalink
Merge pull request #338 from Olink-Proteomics/optimization_develop_st…
Browse files Browse the repository at this point in the history
…rict_ci_workflow

Update CI workflows
  • Loading branch information
klevdiamanti authored Mar 15, 2024
2 parents 052c9cb + 1ad3dbe commit a601f46
Show file tree
Hide file tree
Showing 9 changed files with 399 additions and 707 deletions.
29 changes: 13 additions & 16 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ jobs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
# Required as the JSON input file needs to be read
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- id: set-matrix
uses: JoshuaTheMiller/conditional-build-matrix@main
uses: JoshuaTheMiller/conditional-build-matrix@main
with:
inputFile: '.github/workflows/matrix_config_check.json'
inputFile: '.github/workflows/matrix_config_check.json'
filter: '[?runOn==`${{ github.event_name }}` || runOn==`always`]'
# addInclude: true

R-CMD-check:
needs: matrix_prep
strategy:
fail-fast: false
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}}
strategy:
fail-fast: false
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}}

runs-on: ${{ matrix.os }}
timeout-minutes: 120
timeout-minutes: 120

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

Expand All @@ -37,30 +37,27 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

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

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

- uses: r-lib/actions/setup-pandoc@v2
with:
pandoc-version: '2.18'


- name: Set BioC version
run: |
install.packages("remotes")
forenv <- paste("R_BIOC_VERSION=", as.character(remotes::bioc_version()), sep = "")
write(forenv, file = Sys.getenv("GITHUB_ENV"), append = TRUE) # Store current value to ENV
write(forenv, file = Sys.getenv("GITHUB_ENV"), append = TRUE) # Store current value to ENV
shell: Rscript {0}


- uses: r-lib/actions/setup-r-dependencies@v2
with:
working-directory: OlinkAnalyze
extra-packages: any::rcmdcheck, pillar
extra-packages: any::rcmdcheck

- uses: r-lib/actions/check-r-package@v2
with:
working-directory: OlinkAnalyze
working-directory: OlinkAnalyze
58 changes: 58 additions & 0 deletions .github/workflows/R-CMD-check_no-suggests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# 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
#
# NOTE: This workflow only directly installs "hard" dependencies, i.e. Depends,
# Imports, and LinkingTo dependencies. Notably, Suggests dependencies are never
# installed, with the exception of testthat, knitr, and rmarkdown. The cache is
# never used to avoid accidentally restoring a cache containing a suggested
# dependency.
on:
push:
branches: [main, develop, optimization_develop]
pull_request:
branches: [main, develop, optimization_develop]

name: R-CMD-check-hard

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

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

strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, r: 'release'}

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

steps:
- uses: actions/checkout@v3

- 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:
working-directory: OlinkAnalyze
dependencies: '"hard"'
cache: false
extra-packages: |
any::rcmdcheck
any::testthat
any::knitr
any::rmarkdown
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
working-directory: OlinkAnalyze
9 changes: 8 additions & 1 deletion OlinkAnalyze/tests/testthat/helper-get_wide_synthetic_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,15 @@ get_wide_synthetic_data <- function(olink_platform,
return(df_synthetic)
}

## Compute num of rows of output df ----
# function to get the format specifications for wide files
get_format_spec <- function(data_type) {
format_spec <- olink_wide_spec |>
dplyr::filter(.data[["data_type"]] == .env[["data_type"]])

return(format_spec)
}

# Compute num of rows of output df
olink_wide2long_rows <- function(n_panels,
n_assays,
n_samples,
Expand Down
6 changes: 6 additions & 0 deletions OlinkAnalyze/tests/testthat/test-read_npx.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ test_that(
test_that(
"data loads correctly - long - zip",
{
skip_if_not_installed("zip")

withr::with_tempfile(
new = "tmp_long_csv_zip",
pattern = "csv-zip-long-",
Expand Down Expand Up @@ -205,6 +207,8 @@ test_that(
test_that(
"data loads correctly - long - extended v1 - zip",
{
skip_if_not_installed("zip")

withr::with_tempfile(
new = "tmp_long_csv_ext_v1_zip",
pattern = "csv-ext_v1-zip-long-",
Expand Down Expand Up @@ -279,6 +283,8 @@ test_that(
test_that(
"data loads correctly - long - extended v2 - zip",
{
skip_if_not_installed("zip")

withr::with_tempfile(
new = "tmp_long_csv_ext_v2_zip",
pattern = "csv-ext_v2-zip-long-",
Expand Down
11 changes: 11 additions & 0 deletions OlinkAnalyze/tests/testthat/test-read_npx_delim.R
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ test_that(
test_that(
"check_field_separator - error - sep not a scalar string",
{
skip_on_cran()

withr::with_tempfile(
new = "cfile_test",
Expand Down Expand Up @@ -473,6 +474,7 @@ test_that(
test_that(
"check_field_separator - error - sep is scalar string but not accepted",
{
skip_on_cran()

withr::with_tempfile(
new = "cfile_test",
Expand Down Expand Up @@ -517,6 +519,7 @@ test_that(
test_that(
"check_field_separator - works - long format - sep is NULL",
{
skip_on_cran()

withr::with_tempfile(
new = c("cdfile_test", "scdfile_test"),
Expand Down Expand Up @@ -604,6 +607,7 @@ test_that(
test_that(
"check_field_separator - works - wide format - sep is NULL",
{
skip_on_cran()

withr::with_tempfile(
new = c("cdfile_test", "scdfile_test"),
Expand Down Expand Up @@ -689,6 +693,7 @@ test_that(
test_that(
"check_field_separator - works - long format - sep is correct",
{
skip_on_cran()

withr::with_tempfile(
new = c("cdfile_test", "scdfile_test"),
Expand Down Expand Up @@ -776,6 +781,7 @@ test_that(
test_that(
"check_field_separator - works - wide format - sep is correct",
{
skip_on_cran()

withr::with_tempfile(
new = c("cdfile_test", "scdfile_test"),
Expand Down Expand Up @@ -863,6 +869,7 @@ test_that(
test_that(
"get_field_separator - error - empty header or file",
{
skip_on_cran()

withr::with_tempfile(
new = "tfile_empty",
Expand Down Expand Up @@ -891,6 +898,7 @@ test_that(
test_that(
"get_field_separator - works - semicolon",
{
skip_on_cran()

withr::with_tempfile(
new = "tfile_semicolon",
Expand Down Expand Up @@ -919,6 +927,7 @@ test_that(
test_that(
"get_field_separator - works - comma",
{
skip_on_cran()

withr::with_tempfile(
new = "tfile_comma",
Expand Down Expand Up @@ -947,6 +956,7 @@ test_that(
test_that(
"get_field_separator - error - wrong sep",
{
skip_on_cran()

withr::with_tempfile(
new = "tfile_hashtag",
Expand Down Expand Up @@ -975,6 +985,7 @@ test_that(
test_that(
"get_field_separator - error - both comma and semicolon",
{
skip_on_cran()

withr::with_tempfile(
new = "tfile_mixed",
Expand Down
6 changes: 6 additions & 0 deletions OlinkAnalyze/tests/testthat/test-read_npx_excel.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
test_that(
"read_npx_excel - works - wide format",
{
skip_if_not_installed("writexl")

# get wide synthetic data
df_synthetic <- get_wide_synthetic_data(olink_platform = "Target 96",
data_type = "NPX",
Expand Down Expand Up @@ -91,6 +93,8 @@ test_that(
test_that(
"read_npx_excel - works - long format",
{
skip_if_not_installed("writexl")

# get wide synthetic data
df_synthetic <- get_wide_synthetic_data(olink_platform = "Target 96",
data_type = "NPX",
Expand Down Expand Up @@ -219,6 +223,8 @@ test_that(
test_that(
"read_npx_excel - error - df has one column only",
{
skip_if_not_installed("writexl")

withr::with_tempfile(
new = "excel_file",
pattern = "excel-file-test",
Expand Down
Loading

0 comments on commit a601f46

Please sign in to comment.