Skip to content

Commit

Permalink
Merge branch 'main' of github.com:phuse-org/devops
Browse files Browse the repository at this point in the history
  • Loading branch information
epijim committed Dec 30, 2023
2 parents 0a91ccc + e145a45 commit 8f00a3b
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 35 deletions.
22 changes: 18 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@ on:
- '**.scss'

jobs:
links:
name: Links
uses: filiph/[email protected]
publish:
name: Build & Deploy Site
needs: links
runs-on: ubuntu-latest
container:
image: rocker/tidyverse:latest
Expand All @@ -37,3 +33,21 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site
keep_files: true

broken_link_checker_job:
runs-on: ubuntu-latest
needs: publish
name: Check for broken links
steps:
- name: Check for broken links
id: link-report
uses: celinekurpershoek/[email protected]
with:
# Required:
url: "https://phuse-org.github.io/devops/"
# optional:
honorRobotExclusions: false
ignorePatterns: "github,google"
recursiveLinks: false # Check all URLs on all reachable pages (could take a while)
- name: Get the result
run: echo "${{steps.link-report.outputs.result}}"
69 changes: 46 additions & 23 deletions content/cicdworkflows-enhanced/posts/validate/validate.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,39 +21,62 @@ toc: true

## Why should I use this?

As a codebase grows, it becomes more likely you will end up with a number of links in your documentation.
These links can over time stop working - and often you won't know till a user flags your links or broken.
Validation is not a fixed term, and it is strongly recommended to make yourself aware of the work of the R Validation Hub (https://www.pharmar.org/), including the
regulatory repo project.

This `gh-action` lets you stay on top of broken links, by actively scanning for them.
When using an R package, it is important to know that what the documentation claims the package does is tested, and these tests pass on the
environment you will be using. This gh-action generates a generic report, that takes the documentation and links it to the
unit tests, and records how the the tests performed against a specific R environment.

The aim here is to who in a pan-company way to document the relationship between documentation and tests. Before
using internally, you would need to 1) confirm the documentation is well written, 2) the unit tests are sufficient to
test that documentation and 3) you are assessing against the actual environments you use internally.

## How do I set it up?

Below is an example of using this `gh-action` whenever someone tries to make PR into your `main` or `devel` branch.
Below is an example of using this `gh-action` when a release is made.


```bash
---
name: Docs 📚

on:
push:
branches:
- main
- devel
pull_request:
branches:
- main
- devel
name: R Package Validation report

on: # Run this action when a release is published
release:
types: [published]

jobs:
links:
name: Links
uses: pharmaverse/admiralci/.github/workflows/links.yml@main
if: github.event_name == 'pull_request'
r-pkg-validation:
name: Create report 📃
runs-on: ubuntu-latest
container:
image: rocker/verse:4.1.1
# Set Github token permissions
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
packages: write
deployments: write
steps:
- name: Checkout repo 🛎
uses: actions/checkout@v3

- name: Build report 🏗
id: validation
uses: insightsengineering/thevalidatoR@main
# see parameters above for custom templates and other formats

# Upload the validation report to the release
- name: Upload report to release 🔼
if: success()
uses: svenstaro/upload-release-action@v2
with:
file: ${{ steps.validation.outputs.report_output_filename }}
asset_name: ${{ steps.validation.outputs.report_output_filename }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
overwrite: false
```

## The deets

This gh-action uses lychee. If you need to prevent false positive deadlinks stopping the
process, you can use a `.lycheeignore` file. There is an example of this file [from
admiral here](https://github.com/pharmaverse/admiral/blob/devel/.lycheeignore).
2 changes: 0 additions & 2 deletions content/cicdworkflows-minimum/posts/pkgdown.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ jobs:
docs:
name: Pkgdown Docs 📚
uses: phuse-org/devops-toolkit/.github/workflows/pkgdown.yml@main
secrets:
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
```

## The deets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ on:
workflow_dispatch:

jobs:
links:
name: Links
check:
name: Check
uses: phuse-org/devops-toolkit/.github/workflows/R-CMD-check.yml@main
```

Expand All @@ -61,4 +61,4 @@ jobs:

## Advanced use

TODO: Add here how to also run against pharmaverse's r-universe latest & the latest release of PPM packages.
TODO: Add here how to also run against pharmaverse's r-universe latest & the latest release of PPM packages.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,4 @@ jobs:

## The deets

This gh-action uses lychee. If you need to prevent false positive deadlinks stopping the
process, you can use a `.lycheeignore` file. There is an example of this file [from
admiral here](https://github.com/pharmaverse/admiral/blob/devel/.lycheeignore).
This `gh-action` is using https://urlchecker.r-lib.org/, so is specific to R packages.

0 comments on commit 8f00a3b

Please sign in to comment.