From 6248c0abbb9e4ff2a04093a16115d65a43cfa187 Mon Sep 17 00:00:00 2001 From: James Black Date: Fri, 15 Dec 2023 13:10:55 +0100 Subject: [PATCH 1/7] Update publish.yml --- .github/workflows/publish.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9dadaa9..ae171b3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,12 +12,8 @@ on: - '**.scss' jobs: - links: - name: Links - uses: filiph/linkcheck@3.0.0 publish: name: Build & Deploy Site - needs: links runs-on: ubuntu-latest container: image: rocker/tidyverse:latest @@ -31,6 +27,9 @@ jobs: run: quarto render --output-dir _site shell: bash + - name: Links + uses: filiph/linkcheck@3.0.0 + - name: Publish Site uses: peaceiris/actions-gh-pages@v3 with: From 882209de68afda8d8cc47aeed55ff0a2362067dd Mon Sep 17 00:00:00 2001 From: James Black Date: Fri, 15 Dec 2023 13:17:46 +0100 Subject: [PATCH 2/7] move check links to post deploy --- .github/workflows/publish.yml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ae171b3..ea8a208 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -27,12 +27,27 @@ jobs: run: quarto render --output-dir _site shell: bash - - name: Links - uses: filiph/linkcheck@3.0.0 - - name: Publish Site uses: peaceiris/actions-gh-pages@v3 with: 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/link-checker@v1.0.2 + 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}}" From 7886087431e54bf199e0c0aeba20701886dbb5c8 Mon Sep 17 00:00:00 2001 From: James Black Date: Fri, 29 Dec 2023 09:54:34 +0100 Subject: [PATCH 3/7] Fix spelling error --- .../cicdworkflows-minimum/posts/r-cmd-check/r-cmd-check.qmd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/cicdworkflows-minimum/posts/r-cmd-check/r-cmd-check.qmd b/content/cicdworkflows-minimum/posts/r-cmd-check/r-cmd-check.qmd index 1f04fd6..5b6c541 100644 --- a/content/cicdworkflows-minimum/posts/r-cmd-check/r-cmd-check.qmd +++ b/content/cicdworkflows-minimum/posts/r-cmd-check/r-cmd-check.qmd @@ -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 ``` @@ -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. \ No newline at end of file +TODO: Add here how to also run against pharmaverse's r-universe latest & the latest release of PPM packages. From 8ed11ebe6bcf34db8a04de76df3c38103285923d Mon Sep 17 00:00:00 2001 From: James Black Date: Fri, 29 Dec 2023 10:11:04 +0100 Subject: [PATCH 4/7] Update validate.qmd --- .../posts/validate/validate.qmd | 69 ++++++++++++------- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/content/cicdworkflows-enhanced/posts/validate/validate.qmd b/content/cicdworkflows-enhanced/posts/validate/validate.qmd index 22c5430..d0c8576 100644 --- a/content/cicdworkflows-enhanced/posts/validate/validate.qmd +++ b/content/cicdworkflows-enhanced/posts/validate/validate.qmd @@ -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). From bf63bcaf6eb30533e064f9ad22d1779ba1b7642b Mon Sep 17 00:00:00 2001 From: James Black Date: Fri, 29 Dec 2023 10:34:48 +0100 Subject: [PATCH 5/7] perm link for admiral --- .../cicdworkflows-recommend/posts/check-links/check-links.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/cicdworkflows-recommend/posts/check-links/check-links.qmd b/content/cicdworkflows-recommend/posts/check-links/check-links.qmd index 43c23d2..d08e5ac 100644 --- a/content/cicdworkflows-recommend/posts/check-links/check-links.qmd +++ b/content/cicdworkflows-recommend/posts/check-links/check-links.qmd @@ -58,4 +58,4 @@ jobs: 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). +admiral here](https://github.com/pharmaverse/admiral/blob/01b819a2a2bf6aa82dafb996f328d7db7123ca93/.lycheeignore). From df6bc9e192a373cdc12ea1f4214ec02437bf4398 Mon Sep 17 00:00:00 2001 From: James Black Date: Fri, 29 Dec 2023 16:41:35 +0100 Subject: [PATCH 6/7] secret is not needed --- content/cicdworkflows-minimum/posts/pkgdown.qmd | 2 -- 1 file changed, 2 deletions(-) diff --git a/content/cicdworkflows-minimum/posts/pkgdown.qmd b/content/cicdworkflows-minimum/posts/pkgdown.qmd index 1a8cc35..b0067ee 100644 --- a/content/cicdworkflows-minimum/posts/pkgdown.qmd +++ b/content/cicdworkflows-minimum/posts/pkgdown.qmd @@ -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 From e145a451a61c55e4fa319914f02ee2f8e0728199 Mon Sep 17 00:00:00 2001 From: James Black Date: Fri, 29 Dec 2023 16:43:10 +0100 Subject: [PATCH 7/7] Update check-links.qmd --- .../cicdworkflows-recommend/posts/check-links/check-links.qmd | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/content/cicdworkflows-recommend/posts/check-links/check-links.qmd b/content/cicdworkflows-recommend/posts/check-links/check-links.qmd index d08e5ac..406f7e3 100644 --- a/content/cicdworkflows-recommend/posts/check-links/check-links.qmd +++ b/content/cicdworkflows-recommend/posts/check-links/check-links.qmd @@ -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/01b819a2a2bf6aa82dafb996f328d7db7123ca93/.lycheeignore). +This `gh-action` is using https://urlchecker.r-lib.org/, so is specific to R packages.