Skip to content

Commit

Permalink
Merge pull request #12 from jiajic/dev
Browse files Browse the repository at this point in the history
Update checks and gh-actions
  • Loading branch information
jiajic authored Sep 6, 2023
2 parents 3da6900 + 73ae625 commit 802e369
Show file tree
Hide file tree
Showing 31 changed files with 1,459 additions and 647 deletions.
146 changes: 146 additions & 0 deletions .github/workflows/dev_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
#
# See https://github.com/r-lib/actions/tree/master/examples#readme for
# additional example workflows available for the R community.


name: Dev Workflow - Test and check
on:
push:
branches: [ "dev" ]

permissions:
contents: read

jobs:
R-CMD-check:
name: R CMD Check
env:
GITHUB_PAT: ${{ secrets.WORKFLOW_PAT }}
runs-on: ubuntu-latest

steps:

- name: Remove vignettes dir
run: rm -rf 'vignettes/'
shell: bash

- name: Checkout repo for workflow access
uses: actions/checkout@v3

- name: Set up R environment
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Set up dependencies (general)
uses: r-lib/actions/setup-r-dependencies@v2
env:
_R_CHECK_FORCE_SUGGESTS: false
_R_CHECK_RD_XREFS: false
with:
dependencies: '"hard"' # do not use suggested dependencies
extra-packages: any::rcmdcheck, any::testthat, any::rlang, any::R.utils, any::remotes

- name: Set up dependencies (GiottoData)
run: |
suppressWarnings({
remotes::install_github('drieslab/GiottoData@suite_modular', build = FALSE)
})
shell: Rscript {0}

- name: Run R CMD check
uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
error-on: '"error"' # workflow errors on error only, can change to include warnings

# show testthat output for ease of access
- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash


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

steps:

- name: Checkout repo for workflow access
uses: actions/checkout@v3

- name: Set up R environment
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Set up dependencies (general)
uses: r-lib/actions/setup-r-dependencies@v2
env:
_R_CHECK_FORCE_SUGGESTS: false
_R_CHECK_RD_XREFS: false
with:
dependencies: '"hard"' # do not use suggested dependencies
extra-packages: any::rcmdcheck, any::testthat, any::rlang, any::R.utils, any::remotes, any::covr
needs: coverage

- name: Set up dependencies (GiottoData)
run: |
suppressWarnings({
remotes::install_github('drieslab/GiottoData@suite_modular', build = FALSE)
})
shell: Rscript {0}

- name: Test coverage
run: |
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
)
shell: Rscript {0}

# add code cov
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}



lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repo for workflow access
uses: actions/checkout@v3

- name: Set up R environment
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Set up dependencies (general)
uses: r-lib/actions/setup-r-dependencies@v2
env:
_R_CHECK_FORCE_SUGGESTS: false
_R_CHECK_RD_XREFS: false
with:
dependencies: '"hard"' # do not use suggested dependencies
extra-packages: any::lintr, local::.
needs: lint

- name: Lint
run: lintr::lint_package()
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: false



Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@
# additional example workflows available for the R community.


name: Master Workflow - Deploy to production

on:
push:
branches: [ "main" ]
pull_request:
types: closed
branches: [ "main" ]

permissions:
contents: read

name: github_workflow

jobs:
R-CMD-check:
env:
GITHUB_PAT: ${{ secrets.WORKFLOW_PAT }}
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})
Expand All @@ -35,32 +37,46 @@ jobs:
- {os: ubuntu-latest, r: 'oldrel-1'}

steps:
# remove vignettes dir

- name: Remove vignettes dir
run: rm -rf 'vignettes/'
shell: bash

# checkout repo for workflow access
- uses: actions/checkout@v2
- name: Checkout repo for workflow access
uses: actions/checkout@v3

# setup R
- uses: r-lib/actions/setup-r@v2
- name: Set up R environment
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

# setup dependencies
- uses: r-lib/actions/setup-r-dependencies@v2
- name: Set up dependencies (general)
uses: r-lib/actions/setup-r-dependencies@v2
env:
_R_CHECK_FORCE_SUGGESTS: false
_R_CHECK_RD_XREFS: false
with:
dependencies: '"hard"' # do not use suggested dependencies
extra-packages: any::rcmdcheck, any::testthat, any::data.table
extra-packages: any::rcmdcheck, any::testthat, any::rlang, any::R.utils, any::remotes, any::covr

- name: Set up dependencies (GiottoData)
run: |
suppressWarnings({
remotes::install_github('drieslab/GiottoData@suite_modular', build = FALSE)
})
shell: Rscript {0}

# run R CMD check
- uses: r-lib/actions/check-r-package@v2
- name: Test python env build
run: |
if (!GiottoClass::checkGiottoEnvironment()) {
GiottoClass::installGiottoEnvironment()
}
shell: Rscript {0}

- name: Run R CMD check
uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
error-on: '"error"' # workflow errors on error only, can change to include warnings
Expand All @@ -71,35 +87,40 @@ jobs:
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash


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

steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v2
- name: Checkout repo for workflow access
uses: actions/checkout@v3

- name: Set up R environment
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

# install extra dependencies
- name: Install GiottoData
- name: Set up dependencies (general)
uses: r-lib/actions/setup-r-dependencies@v2
env:
_R_CHECK_FORCE_SUGGESTS: false
_R_CHECK_RD_XREFS: false
with:
dependencies: '"hard"' # do not use suggested dependencies
extra-packages: any::rcmdcheck, any::testthat, any::rlang, any::R.utils, any::remotes, any::covr
needs: coverage

- name: Set up dependencies (GiottoData)
run: |
suppressWarnings({
if(!require(remotes)){
install.packages('R.utils', repos = 'http://cran.us.r-project.org')
install.packages('remotes', repos = 'http://cran.us.r-project.org')
}
remotes::install_github('drieslab/GiottoData', build = FALSE)
remotes::install_github('drieslab/GiottoData@suite_modular', build = FALSE)
})
shell: Rscript {0}

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

- name: Test coverage
run: |
covr::codecov(
Expand All @@ -109,15 +130,14 @@ jobs:
)
shell: Rscript {0}

# add code cov
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}


# lint:
# runs-on: ubuntu-latest
# needs: R-CMD-check
# env:
# GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
# steps:
Expand All @@ -139,29 +159,31 @@ jobs:
# LINTR_ERROR_ON_LINT: true


# render-rmarkdown:
# runs-on: ubuntu-latest
# env:
# GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
# steps:
# - name: Checkout repo
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
#
# - uses: r-lib/actions/setup-pandoc@v2
#
# - uses: r-lib/actions/setup-r@v2
#
# - uses: r-lib/actions/setup-renv@v2
#
# - name: Install rmarkdown
# run: Rscript -e 'install.packages("rmarkdown")'
#
# - name: Render README
# run: Rscript -e 'rmarkdown::render("README.Rmd")'
#
# - name: Commit results
# run: |
# git commit README.md -m 'Re-build README.Rmd' || echo "No changes to commit"
# git push origin || echo "No changes to commit"
render-rmarkdown:
name: Update README.Rmd
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0

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

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

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

- name: Install rmarkdown
run: Rscript -e 'install.packages("rmarkdown")'

- name: Render README
run: Rscript -e 'rmarkdown::render("README.Rmd")'

- name: Commit results
run: |
git commit README.md -m 'Re-build README.Rmd' || echo "No changes to commit"
git push origin || echo "No changes to commit"
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Suggests:
HDF5Array (>= 1.18.1),
remotes,
rhdf5,
rlang,
RTriangle (>= 1.6-0.10),
S4Vectors,
scattermore,
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export(calculateOverlapParallel)
export(calculateOverlapPolygonImages)
export(calculateOverlapRaster)
export(calculateOverlapSerial)
export(calculateSpatCellMetadataProportions)
export(changeGiottoInstructions)
export(changeImageBg)
export(checkGiottoEnvironment)
Expand All @@ -44,6 +45,7 @@ export(combineFeatureOverlapData)
export(combineMetadata)
export(combineSpatialCellFeatureInfo)
export(combineSpatialCellMetadataInfo)
export(compatible_spatial_network)
export(convertGiottoLargeImageToMG)
export(convert_mgImage_to_array_DT)
export(convert_to_full_spatial_network)
Expand Down
Loading

0 comments on commit 802e369

Please sign in to comment.