-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from jhudsl/cansavvy/gha
Adding github actions and some reorganizations
- Loading branch information
Showing
37 changed files
with
253 additions
and
645 deletions.
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,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
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,62 @@ | ||
# Candace Savonen Jan 2024 | ||
|
||
name: Build Docker | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
dockerhubpush: | ||
description: 'Push to Dockerhub?' | ||
required: true | ||
default: 'false' | ||
|
||
jobs: | ||
build-docker: | ||
name: Build Docker image | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: checkout repo | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{secrets.GH_PAT}} | ||
fetch-depth: 0 | ||
|
||
# Set up Docker build | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
# Setup layer cache | ||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Get token | ||
run: echo ${{ secrets.GH_PAT }} > ${{ github.workspace }}/inst/extdata/docker/git_token.txt | ||
|
||
# Build docker image | ||
- name: Build Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: false | ||
load: true | ||
context: inst/extdata/docker | ||
tags: cansav09/metricminer | ||
|
||
# Login to Dockerhub | ||
- name: Login to DockerHub | ||
if: ${{ github.event.inputs.dockerhubpush != 'false' }} | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
# Push the Docker image if set to true from a manual trigger | ||
- name: Push Docker image if manual trigger set to true | ||
if: ${{ github.event.inputs.dockerhubpush != 'false' }} | ||
run: | | ||
docker push cansav09/metricminer |
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/[email protected] | ||
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
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
File renamed without changes.
Oops, something went wrong.