Repository: Gilead-BioStats/gsm.kri
Pull request #33: Add qualification report GHA
Author: login: lauramaxwell
Created: 2025-02-25T16:03:33Z | Merged: 2025-03-05T15:50:35Z

Use [repository-dispatch](https://github.com/peter-evans/repository-dispatch/tree/main) to run qualification reports by triggering the call to gsm.qc package


Diff:
diff --git a/.github/workflows/qualification-report.yaml b/.github/workflows/qualification-report.yaml
new file mode 100644
index 00000000..e52f3cfd
--- /dev/null
+++ b/.github/workflows/qualification-report.yaml
@@ -0,0 +1,34 @@
+on:
+  release:
+    types: [published]
+  pull_request:
+    branches: main
+  workflow_dispatch:
+
+name: qualification-report
+
+jobs:
+  qualification-report:
+    runs-on: ubuntu-latest
+    env:
+      GITHUB_PAT: ${{ secrets.GH_TOKEN }}
+
+    steps:
+      - uses: actions/checkout@v4
+
+      - uses: r-lib/actions/setup-r@v2
+        with:
+          r-version: '4.1.3'
+          use-public-rspm: true
+
+      - name: qualification report trigger
+        uses: peter-evans/repository-dispatch@v3
+        with:
+          token: ${{secrets.GH_TOKEN}}
+          repository: Gilead-BioStats/gsm.qc
+          event-type: qualification
+          client-payload: '{
+          "GH_TOKEN": "${{ secrets.GH_TOKEN }}",
+          "repository": "${{ github.repository }}",
+          "release_tag": "${{ github.ref_name }}"
+          }'
diff --git a/.github/workflows/qualification-tests-dev.yaml b/.github/workflows/qualification-tests-dev.yaml
new file mode 100644
index 00000000..e183b6cf
--- /dev/null
+++ b/.github/workflows/qualification-tests-dev.yaml
@@ -0,0 +1,51 @@
+on:
+  workflow_dispatch:
+
+name: qualification-tests-dev
+
+jobs:
+  qualification-tests:
+    runs-on: ${{ matrix.config.os }}
+
+    name: ${{ matrix.config.os }} (${{ matrix.config.r }})
+
+    strategy:
+      fail-fast: false
+      matrix:
+        config:
+          - {os: ubuntu-latest, r: '4.1.3', repos: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
+
+    env:
+      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
+      R_KEEP_PKG_SOURCE: yes
+
+    steps:
+      - uses: actions/checkout@v4
+
+      - uses: r-lib/actions/setup-pandoc@v2
+
+      - uses: r-lib/actions/setup-r@v2
+        with:
+          r-version: ${{ matrix.config.r }}
+          http-user-agent: ${{ matrix.config.http-user-agent }}
+          use-public-rspm: true
+
+      - uses: r-lib/actions/setup-r-dependencies@v2
+        with:
+          extra-packages: any::rcmdcheck, any::devtools, any::here, local::.
+          needs: qualification
+
+      - name: qualification report trigger
+        uses: peter-evans/repository-dispatch@v3
+        with:
+          token: ${{secrets.GH_TOKEN}}
+          repository: Gilead-BioStats/gsm.qc
+          event-type: qualification-test
+
+
+      - name: Upload check results
+        if: failure()
+        uses: actions/upload-artifact@main
+        with:
+          name: ${{ runner.os }}-r${{ matrix.config.r }}-results
+          path: check
diff --git a/DESCRIPTION b/DESCRIPTION
index 95e4f55d..9dc22e24 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -45,4 +45,5 @@ Suggests:
 Remotes:
     gsm=Gilead-BioStats/gsm@gsm-core-test,
     clindata=Gilead-BioStats/clindata
+Config/Needs/qualification: Gilead-BioStats/gsm.qc@dev
 Config/testthat/edition: 3


Reviews:
user: login: jonthegeek
body: I made some suggestions to stop us from having to install gsm.qc all the time, and instead only install it to run qualification tests. This is a technique I've been meaning to look into more for some other cases, but I think it definitely makes sense here. Basically, instead of just lumping everything into "Suggests", you can specify what packages are used for, and *only* install them in those contexts.
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-28T20:05:09Z
user: login: lauramaxwell
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-03T16:04:49Z
user: login: jonthegeek
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-03T16:25:56Z
user: login: lauramaxwell
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-03T19:05:33Z
user: login: jonthegeek
body: Looks great! I'm sure we'll have more tweaks as we go, but the structure is solid 💪
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T21:14:18Z
user: login: jonthegeek
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T21:23:16Z

Review comments:
diff_hunk: @@ -37,12 +37,14 @@ Imports:
     tidyr
 Suggests: 
     testthat (>= 3.0.0),
+    gsm.qc,
path: DESCRIPTION
user: login: jonthegeek
body: ```suggestion
```
(see below; if this is in suggests, it needs to be on CRAN when we submit this)
created_at: 2025-02-28T19:54:27Z
author_association: CONTRIBUTOR
diff_hunk: @@ -37,12 +37,14 @@ Imports:
     tidyr
 Suggests: 
     testthat (>= 3.0.0),
+    gsm.qc,
     clindata,
     knitr,
     lubridate,
     fontawesome,
     withr
 Remotes:
     gsm=Gilead-BioStats/gsm@gsm-core-test,
-    clindata=Gilead-BioStats/clindata
+    clindata=Gilead-BioStats/clindata,
+    gsm.qc=Gilead-BioStats/gsm.qc
path: DESCRIPTION
user: login: jonthegeek
body: ```suggestion
    clindata=Gilead-BioStats/clindata
Config/Needs/qualification: Gilead-BioStats/gsm.qc
```
We can install this just for qc tests, rather than every time we run (other) tests or build the website. 

Separate issue: We really should do the same for clindata (and/or eliminate its use from tests; clindata is unlikely to make it to CRAN, so we won't be able to submit this one to CRAN with clindata in tests).
created_at: 2025-02-28T19:57:11Z
author_association: CONTRIBUTOR
path: .github/workflows/qualification-report.yaml
user: login: jonthegeek
body: See https://github.com/Gilead-BioStats/gsm.qc/issues/9
created_at: 2025-02-28T20:00:54Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,53 @@
+on:
+  pull_request:
+    branches: dev, main
+  workflow_dispatch:
+
+name: qualification-tests-dev
+
+jobs:
+  qualification-tests:
+    runs-on: ${{ matrix.config.os }}
+
+    name: ${{ matrix.config.os }} (${{ matrix.config.r }})
+
+    strategy:
+      fail-fast: false
+      matrix:
+        config:
+          - {os: ubuntu-latest, r: '4.1.3', repos: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
+
+    env:
+      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
+      R_KEEP_PKG_SOURCE: yes
+
+    steps:
+      - uses: actions/checkout@v4
+
+      - uses: r-lib/actions/setup-pandoc@v2
+
+      - uses: r-lib/actions/setup-r@v2
+        with:
+          r-version: ${{ matrix.config.r }}
+          http-user-agent: ${{ matrix.config.http-user-agent }}
+          use-public-rspm: true
+
+      - uses: r-lib/actions/setup-r-dependencies@v2
+        with:
+          extra-packages: any::rcmdcheck, any::devtools, any::here, local::.
path: .github/workflows/qualification-tests-dev.yaml
user: login: jonthegeek
body: ```suggestion
          extra-packages: any::rcmdcheck, any::devtools, any::here, local::.
          needs: qualification
```
created_at: 2025-02-28T20:02:14Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,53 @@
+on:
+  pull_request:
+    branches: dev, main
+  workflow_dispatch:
+
+name: qualification-tests-dev
+
+jobs:
+  qualification-tests:
+    runs-on: ${{ matrix.config.os }}
+
+    name: ${{ matrix.config.os }} (${{ matrix.config.r }})
+
+    strategy:
+      fail-fast: false
+      matrix:
+        config:
+          - {os: ubuntu-latest, r: '4.1.3', repos: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
+
+    env:
+      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
+      R_KEEP_PKG_SOURCE: yes
+
+    steps:
+      - uses: actions/checkout@v4
+
+      - uses: r-lib/actions/setup-pandoc@v2
+
+      - uses: r-lib/actions/setup-r@v2
+        with:
+          r-version: ${{ matrix.config.r }}
+          http-user-agent: ${{ matrix.config.http-user-agent }}
+          use-public-rspm: true
+
+      - uses: r-lib/actions/setup-r-dependencies@v2
+        with:
+          extra-packages: any::rcmdcheck, any::devtools, any::here, local::.
path: .github/workflows/qualification-tests-dev.yaml
user: login: jonthegeek
body: In theory this should take care of gsm.qc (and thus also the install.packages() lines in the next block).
created_at: 2025-02-28T20:03:08Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,53 @@
+on:
+  pull_request:
+    branches: dev, main
+  workflow_dispatch:
+
+name: qualification-tests-dev
+
+jobs:
+  qualification-tests:
+    runs-on: ${{ matrix.config.os }}
+
+    name: ${{ matrix.config.os }} (${{ matrix.config.r }})
+
+    strategy:
+      fail-fast: false
+      matrix:
+        config:
+          - {os: ubuntu-latest, r: '4.1.3', repos: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
+
+    env:
+      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
+      R_KEEP_PKG_SOURCE: yes
+
+    steps:
+      - uses: actions/checkout@v4
+
+      - uses: r-lib/actions/setup-pandoc@v2
+
+      - uses: r-lib/actions/setup-r@v2
+        with:
+          r-version: ${{ matrix.config.r }}
+          http-user-agent: ${{ matrix.config.http-user-agent }}
+          use-public-rspm: true
+
+      - uses: r-lib/actions/setup-r-dependencies@v2
+        with:
+          extra-packages: any::rcmdcheck, any::devtools, any::here, local::.
+
+      - name: run qualification tests
+        run: |
+          install.packages("remotes")
+          install.packages("devtools")
+          devtools::install(dependencies = T)
+          remotes::install_github("Gilead-BioStats/gsm.qc@dev", dependencies = T, upgrade = "never")
path: .github/workflows/qualification-tests-dev.yaml
user: login: jonthegeek
body: ```suggestion
```
I'm not sure what `upgrade = "never"` was for here.
created_at: 2025-02-28T20:03:43Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,53 @@
+on:
+  pull_request:
+    branches: dev, main
+  workflow_dispatch:
+
+name: qualification-tests-dev
+
+jobs:
+  qualification-tests:
+    runs-on: ${{ matrix.config.os }}
+
+    name: ${{ matrix.config.os }} (${{ matrix.config.r }})
+
+    strategy:
+      fail-fast: false
+      matrix:
+        config:
+          - {os: ubuntu-latest, r: '4.1.3', repos: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
+
+    env:
+      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
+      R_KEEP_PKG_SOURCE: yes
+
+    steps:
+      - uses: actions/checkout@v4
+
+      - uses: r-lib/actions/setup-pandoc@v2
+
+      - uses: r-lib/actions/setup-r@v2
+        with:
+          r-version: ${{ matrix.config.r }}
+          http-user-agent: ${{ matrix.config.http-user-agent }}
+          use-public-rspm: true
+
+      - uses: r-lib/actions/setup-r-dependencies@v2
+        with:
+          extra-packages: any::rcmdcheck, any::devtools, any::here, local::.
+
+      - name: run qualification tests
+        run: |
+          install.packages("remotes")
+          install.packages("devtools")
+          devtools::install(dependencies = T)
+          remotes::install_github("Gilead-BioStats/gsm.qc@dev", dependencies = T, upgrade = "never")
path: .github/workflows/qualification-tests-dev.yaml
user: login: lauramaxwell
body: i'm pretty sure we need 
```
install.packages("devtools")
devtools::install(dependencies = T)
```
here in order to run the qual report on the current package version (i.e. the version not yet merged in that triggered the action). it's what we have in `gsm` at the moment, and i recall running into issues with versioning if we didn't install at this step. but, happy to try it out to see if it's unnecessary
created_at: 2025-03-03T16:04:49Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,53 @@
+on:
+  pull_request:
+    branches: dev, main
+  workflow_dispatch:
+
+name: qualification-tests-dev
+
+jobs:
+  qualification-tests:
+    runs-on: ${{ matrix.config.os }}
+
+    name: ${{ matrix.config.os }} (${{ matrix.config.r }})
+
+    strategy:
+      fail-fast: false
+      matrix:
+        config:
+          - {os: ubuntu-latest, r: '4.1.3', repos: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
+
+    env:
+      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
+      R_KEEP_PKG_SOURCE: yes
+
+    steps:
+      - uses: actions/checkout@v4
+
+      - uses: r-lib/actions/setup-pandoc@v2
+
+      - uses: r-lib/actions/setup-r@v2
+        with:
+          r-version: ${{ matrix.config.r }}
+          http-user-agent: ${{ matrix.config.http-user-agent }}
+          use-public-rspm: true
+
+      - uses: r-lib/actions/setup-r-dependencies@v2
+        with:
+          extra-packages: any::rcmdcheck, any::devtools, any::here, local::.
+
+      - name: run qualification tests
+        run: |
+          install.packages("remotes")
+          install.packages("devtools")
+          devtools::install(dependencies = T)
+          remotes::install_github("Gilead-BioStats/gsm.qc@dev", dependencies = T, upgrade = "never")
path: .github/workflows/qualification-tests-dev.yaml
user: login: jonthegeek
body: We're installing `local::.` and dependencies in the step above, though, so that should cover this.
created_at: 2025-03-03T16:25:56Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,53 @@
+on:
+  pull_request:
+    branches: dev, main
+  workflow_dispatch:
+
+name: qualification-tests-dev
+
+jobs:
+  qualification-tests:
+    runs-on: ${{ matrix.config.os }}
+
+    name: ${{ matrix.config.os }} (${{ matrix.config.r }})
+
+    strategy:
+      fail-fast: false
+      matrix:
+        config:
+          - {os: ubuntu-latest, r: '4.1.3', repos: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
+
+    env:
+      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
+      R_KEEP_PKG_SOURCE: yes
+
+    steps:
+      - uses: actions/checkout@v4
+
+      - uses: r-lib/actions/setup-pandoc@v2
+
+      - uses: r-lib/actions/setup-r@v2
+        with:
+          r-version: ${{ matrix.config.r }}
+          http-user-agent: ${{ matrix.config.http-user-agent }}
+          use-public-rspm: true
+
+      - uses: r-lib/actions/setup-r-dependencies@v2
+        with:
+          extra-packages: any::rcmdcheck, any::devtools, any::here, local::.
+
+      - name: run qualification tests
+        run: |
+          install.packages("remotes")
+          install.packages("devtools")
+          devtools::install(dependencies = T)
+          remotes::install_github("Gilead-BioStats/gsm.qc@dev", dependencies = T, upgrade = "never")
path: .github/workflows/qualification-tests-dev.yaml
user: login: lauramaxwell
body: yeah, that makes sense. i'll apply this suggestion, and confirm the local repo gets installed properly.
created_at: 2025-03-03T19:05:33Z
author_association: COLLABORATOR
diff_hunk: @@ -1,7 +1,7 @@
 on:
   release:
     types: [published]
-  pull-request:
+  pull_request:
path: .github/workflows/qualification-report.yaml
user: login: jonthegeek
body: Doh, good catch!
created_at: 2025-03-04T21:23:16Z
author_association: CONTRIBUTOR

PR comments:
user: login: jonthegeek
created_at: 2025-03-03T21:59:40Z
body: This needs https://github.com/Gilead-BioStats/gsm.qc/issues/9 before it will work (with the `Needs` change).
author_association: CONTRIBUTOR
user: login: lauramaxwell
created_at: 2025-03-03T22:02:03Z
body: > This needs [Gilead-BioStats/gsm.qc#9](https://github.com/Gilead-BioStats/gsm.qc/issues/9) before it will work (with the `Needs` change).

ah thanks. i was also testing some permissions stuff here, but i'll go ahead and make that gsm.qc edit 
author_association: COLLABORATOR