-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding standard templates and GHA #1
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!-- Inspiration from https://github.com/angular-translate/angular-translate/blob/master/.github/ISSUE_TEMPLATE.md --> | ||
|
||
### Issue Description | ||
Please provide a brief description of the issue here. | ||
|
||
### Inputs | ||
Please describe your experimental/sequencing strategy (e.g. pgPEN library and screening data, sequenced with an Illumina MiSeq, etc.) | ||
|
||
### Your environment | ||
Describe how you ran the pipeline (e.g. high-performance computing [HPC] cluster, linux/shell interface (Ubuntu, MacOS terminal, Windows powershell, etc.) | ||
|
||
### Steps to reproduce | ||
Please include relevant commands and steps taken. If your counts table was generated outside of the Berger Lab's pgPEN analysis workflow, please also describe the steps taken to pre-process your data. | ||
|
||
### Pipeline behavior and error messages | ||
Please include relevant screenshots or codeblocks with any relevant error messages. If your code ran up to a certain point before encountering an error, please include this information as well. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!-- From https://axolo.co/blog/p/part-3-github-pull-request-template--> | ||
|
||
# Description | ||
|
||
<!-- Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change. --> | ||
|
||
Fixes # (issue) | ||
|
||
## Type of change | ||
|
||
<!-- Please delete options that are not relevant. --> | ||
|
||
- [ ] Bug fix (non-breaking change which fixes an issue) | ||
- [ ] New feature (non-breaking change which adds functionality) | ||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
- [ ] This change requires a documentation update | ||
|
||
# How Has This Been Tested? | ||
|
||
<!-- Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration --> | ||
|
||
- [ ] Test A | ||
- [ ] Test B | ||
|
||
# Checklist: | ||
|
||
- [ ] My code follows the style guidelines of this project | ||
- [ ] I have performed a self-review of my code | ||
- [ ] I have commented my code, particularly in hard-to-understand areas | ||
- [ ] I have made corresponding changes to the documentation | ||
- [ ] My changes generate no new warnings | ||
- [ ] I have added tests that prove my fix is effective or that my feature works | ||
- [ ] New and existing unit tests pass locally with my changes | ||
- [ ] Any dependent changes have been merged and published in downstream modules |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. | ||
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
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: windows-latest, r: 'release'} | ||
- {os: macOS-latest, r: 'release'} | ||
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} | ||
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} | ||
|
||
env: | ||
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | ||
RSPM: ${{ matrix.config.rspm }} | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
r-version: ${{ matrix.config.r }} | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- name: Query dependencies | ||
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") | ||
shell: Rscript {0} | ||
|
||
- name: Restore R package cache | ||
if: runner.os != 'Windows' | ||
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 system dependencies | ||
if: runner.os == 'Linux' | ||
run: | | ||
while read -r cmd | ||
do | ||
eval sudo $cmd | ||
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') | ||
|
||
- name: Install dependencies | ||
run: | | ||
remotes::install_deps(dependencies = TRUE) | ||
remotes::install_cran("rcmdcheck") | ||
shell: Rscript {0} | ||
|
||
- name: Check | ||
run: | | ||
options(crayon.enabled = TRUE) | ||
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), check_dir = "check") | ||
shell: Rscript {0} | ||
|
||
- name: Check testthat | ||
if: runner.os != 'Windows' | ||
id: check_check | ||
run: | | ||
error_num=$(Rscript --vanilla '.github/workflows/check_testthat.R') | ||
echo "error_num=$error_num" >> $GITHUB_OUTPUT | ||
|
||
- name: Stop if there are errors! | ||
if: ${{ steps.check_check.outputs.error_num != '0' }} | ||
run: exit 1 | ||
|
||
- name: Upload check results | ||
if: failure() | ||
uses: actions/upload-artifact@main | ||
with: | ||
name: ${{ runner.os }}-r${{ matrix.config.r }}-results | ||
path: check |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Check up on the testthat results | ||
# C. Savonen | ||
# Nov 2023 | ||
|
||
library(magrittr) | ||
|
||
|
||
# Find .git root directory | ||
root_dir <- rprojroot::find_root(rprojroot::has_dir(".git")) | ||
|
||
out_file <- list.files(pattern = "testthat.Rout$|Rout.fail$", file.path(root_dir, "check"), | ||
recursive = TRUE, full.names = TRUE) | ||
|
||
check_content <- readLines(out_file) | ||
test_result <- grep("\\[ FAIL", check_content, value = TRUE)[1] | ||
test_result <- unlist(strsplit(test_result, "\\||\\[|\\]")) | ||
|
||
# Format the data into a dataframe | ||
test_result_df <- data.frame(result = trimws(test_result)) %>% | ||
dplyr::filter(result != "") %>% | ||
tidyr::separate(result, sep = " ", into = c("test_name", "num")) %>% | ||
dplyr::mutate(num = as.numeric(num)) | ||
|
||
fail_num <- test_result_df %>% | ||
dplyr::filter(test_name %in% c("FAIL", "WARN")) %>% | ||
dplyr::summarize(total = sum(num)) | ||
|
||
fail_num <- as.character(fail_num$total) | ||
|
||
# Spit the number out | ||
writeLines(fail_num, con = stdout()) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# 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] | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
name: pkgdown | ||
|
||
jobs: | ||
pkgdown: | ||
runs-on: ubuntu-latest | ||
# Only restrict concurrency for non-PR jobs | ||
concurrency: | ||
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::pkgdown, local::. | ||
needs: website | ||
|
||
- name: Build site | ||
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) | ||
shell: Rscript {0} | ||
|
||
- name: Deploy to GitHub pages 🚀 | ||
if: github.event_name != 'pull_request' | ||
uses: JamesIves/github-pages-deploy-action@v4.4.1 | ||
with: | ||
clean: false | ||
branch: gh-pages | ||
folder: docs |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Candace Savonen 2024 | ||
|
||
name: Style Code | ||
|
||
on: | ||
pull_request: | ||
branches: [ main, staging ] | ||
|
||
jobs: | ||
|
||
style-code: | ||
name: Style code | ||
runs-on: ubuntu-latest | ||
container: | ||
image: cansav09/gimap | ||
|
||
steps: | ||
- name: Checkout files | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Login as jhudsl-robot | ||
run: | | ||
git config --global --add safe.directory $GITHUB_WORKSPACE | ||
git config --global user.email "itcrtrainingnetwork@gmail.com" | ||
git config --global user.name "jhudsl-robot" | ||
|
||
- name: Run styler | ||
run: Rscript -e "styler::style_file(list.files(pattern = 'Rmd$', recursive = TRUE, full.names = TRUE));warnings()" | ||
|
||
- name: Commit styled files | ||
run: | | ||
git config --system --add safe.directory "$GITHUB_WORKSPACE" | ||
git add \*.Rmd | ||
git commit -m 'Style Rmds' || echo "No changes to commit" | ||
git push origin || echo "No changes to commit" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for starting this! I'd like to try using
usethis
e.g.:usethis::use_github_action("check-standard")
since we can run it periodically for updates :)