Skip to content

Commit

Permalink
yaml file local
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-messier committed May 25, 2024
2 parents e30789d + 1a60bbd commit a29d778
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 63 deletions.
107 changes: 107 additions & 0 deletions .github/workflows/test-coverage-local.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# also derived from https://github.com/we-cli/coverage-badge-action
# 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: test-coverage-local

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

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

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

- name: Cache C++ and R dependencies
uses: actions/cache@v2
with:
path: |
~/.cache/R
~/.local/share/R
key: dependencies-${{ runner.os }}-${{ hashFiles('**/DESCRIPTION') }}
restore-keys: |
dependencies-${{ runner.os }}-
- name: Test coverage
run: >
Rscript -e
"covd<-covr::coverage_to_list()$totalcoverage;
write.table(covd[length(covd)], file = '${{ github.workspace }}/local_cov.Rout', row.names = F, col.names = F)"
shell: bash

- name: Get Values
id: get-values
shell: bash
run: |
COV=$(cat ${{ github.workspace }}/local_cov.Rout)
echo "Patch coverage read from local_cov.Rout: $COV"
echo "coverage=$COV" >> $GITHUB_OUTPUT
- name: Checkout gh-pages
uses: actions/checkout@v4
with:
ref: gh-pages

- name: Patch comparison
id: patch-comparison
shell: bash
run: |
cov_patch="${{ steps.get-values.outputs.coverage }}"
cov_current=$(cat cov_current.Rout)
echo "Current coverage: $cov_current"
if (( $(echo "$cov_patch >= $cov_current" | bc -l) )); then
echo "Patch coverage ($cov_patch) is greater than or equal to current coverage ($cov_current)."
echo "cov_update=$cov_patch" >> $GITHUB_OUTPUT
else
echo "Patch coverage ($cov_patch) is less than current coverage ($cov_current)."
exit 1
fi
- name: Overwrite cov_current.Rout
if: ${{ github.event_name == 'push' }}
shell: bash
run: |
cov_update="${{ steps.patch-comparison.outputs.cov_update }}"
touch cov_current.Rout
echo "$cov_update" > cov_current.Rout
- name: Create Badges
shell: bash
run: |
npm i -g badgen-cli
export COV=${{ steps.get-values.outputs.coverage }}
COLOR=$(node -p '+process.env.COV >= 95 ? `green` : `orange`')
mkdir -p badges
badgen -j coverage -s $COV% -c $COLOR > badges/coverage.svg
- name: Deploy Badges
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Update badges [skip ci] & cov_current.Rout"
branch: gh-pages
skip_fetch: true
skip_checkout: true

# Without this, will get Error:
# Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under '/home/runner/work/coverage-badge-action/coverage-badge-action/action.yml'.
# Did you forget to run actions/checkout before running your local action?
- name: Checkout Back
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
55 changes: 0 additions & 55 deletions .github/workflows/test-coverage.yaml

This file was deleted.

13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,17 @@
# GeoTox

<!-- badges: start -->

[![test-coverage](https://github.com/Spatiotemporal-Exposures-and-Toxicology/GeoTox/actions/workflows/test-coverage.yaml/badge.svg)](https://github.com/Spatiotemporal-Exposures-and-Toxicology/GeoTox/actions/workflows/test-coverage.yaml)
[![codecov](https://codecov.io/github/Spatiotemporal-Exposures-and-Toxicology/GeoTox/graph/badge.svg?token=I1L9BZJ58Y)](https://codecov.io/github/Spatiotemporal-Exposures-and-Toxicology/GeoTox)
[![R-CMD-check](https://github.com/Spatiotemporal-Exposures-and-Toxicology/GeoTox/actions/workflows/check-release.yaml/badge.svg)](https://github.com/Spatiotemporal-Exposures-and-Toxicology/GeoTox/actions/workflows/check-release.yaml)
[![Lifecycle:
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![R-CMD-check](https://github.com/NIEHS/GeoTox/actions/workflows/check-release.yaml/badge.svg)](https://github.com/NIEHS/GeoTox/actions/workflows/check-release.yaml)
[![cov](https://NIEHS.github.io/GeoTox/badges/coverage.svg)](https://github.com/NIEHS/GeoTox/actions)
[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![CRAN
status](https://www.r-pkg.org/badges/version/GeoTox)](https://CRAN.R-project.org/package=GeoTox)

<!-- badges: end -->

![](https://codecov.io/github/Spatiotemporal-Exposures-and-Toxicology/GeoTox/graphs/icicle.svg?token=I1L9BZJ58Y)

The GeoTox package <x y z plus other stuff>, as introduced in
The GeoTox package as introduced in
[Eccles KM, Karmaus AL, Kleinstreuer NC, Parham F, Rider CV, Wambaugh
JF, Messier KP. A geospatial modeling approach to quantifying the risk
of exposure to environmental chemical mixtures via a common molecular
Expand All @@ -32,5 +29,5 @@ You can install the development version of GeoTox from

``` r
# install.packages("devtools")
devtools::install_github("Spatiotemporal-Exposures-and-Toxicology/GeoTox")
devtools::install_github("NIEHS/GeoTox")
```

0 comments on commit a29d778

Please sign in to comment.