From 47e8ca560e2a6c1a6ac6fcc6f9e59cebacca6e75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 28 Sep 2024 21:41:47 +0200 Subject: [PATCH 1/4] ci: Use pkgdown branch --- .github/workflows/R-CMD-check.yaml | 2 +- .github/workflows/pkgdown.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 428cec137..49a3b45f0 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -66,7 +66,7 @@ jobs: cache-version: rcc-smoke-2 needs: check, website # Beware of using dev pkgdown here, has brought in dev dependencies in the past - extra-packages: any::rcmdcheck r-lib/roxygen2 any::decor r-lib/styler pkgdown deps::. + extra-packages: any::rcmdcheck r-lib/roxygen2 any::decor r-lib/styler r-lib/pkgdown@f-readme-tweak deps::. - name: Install package run: | diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 09dc06382..6afddb16f 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -42,7 +42,7 @@ jobs: install-r: false cache-version: pkgdown-2 needs: website - extra-packages: pkgdown local::. + extra-packages: r-lib/pkgdown@f-readme-tweak local::. - uses: ./.github/workflows/custom/after-install if: hashFiles('.github/workflows/custom/after-install/action.yml') != '' From bfe214d703466d1a0bf3f70e9fa1996b05065c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 27 Oct 2024 05:51:24 +0100 Subject: [PATCH 2/4] ci: Updates from duckdb --- .github/workflows/R-CMD-check-status.yaml | 5 +- .github/workflows/R-CMD-check.yaml | 92 ++++++++++++++++++- .github/workflows/update-snapshots/action.yml | 9 +- 3 files changed, 97 insertions(+), 9 deletions(-) diff --git a/.github/workflows/R-CMD-check-status.yaml b/.github/workflows/R-CMD-check-status.yaml index 15860acbb..b9bdf4e4a 100644 --- a/.github/workflows/R-CMD-check-status.yaml +++ b/.github/workflows/R-CMD-check-status.yaml @@ -16,11 +16,10 @@ jobs: name: "Update commit status" - # Only run if triggered by rcc workflow - if: github.event.workflow_run.name == 'rcc' - steps: - name: "Update commit status" + # Only run if triggered by rcc workflow + if: github.event.workflow_run.name == 'rcc' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 49a3b45f0..56ae58c6b 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -18,9 +18,17 @@ on: workflow_dispatch: inputs: ref: - description: "Branch or tag to check out" + description: "Branch, tag, or commit to check out" required: false default: "main" + versions-matrix: + description: "Create a matrix of R versions" + type: boolean + default: false + dep-suggests-matrix: + description: "Create a matrix of suggested dependencies" + type: boolean + default: false merge_group: types: - checks_requested @@ -51,6 +59,38 @@ jobs: with: ref: ${{ inputs.ref }} + - name: Update status for rcc + # FIXME: Wrap into action + if: github.event_name == 'workflow_dispatch' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Check status of this workflow + state="pending" + sha=${{ inputs.ref }} + if [ -z "${sha}" ]; then + sha=${{ github.head_ref }} + fi + if [ -z "${sha}" ]; then + sha=${{ github.sha }} + fi + sha=$(git rev-parse ${sha}) + + html_url=$(gh api \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + repos/${{ github.repository }}/actions/runs/${{ github.run_id }} | jq -r .html_url) + + description="${{ github.workflow }} / ${{ github.job }}" + + gh api \ + --method POST \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + repos/${{ github.repository }}/statuses/${sha} \ + -f "state=${state}" -f "target_url=${html_url}" -f "description=${description}" -f "context=rcc" + shell: bash + - uses: ./.github/workflows/rate-limit with: token: ${{ secrets.GITHUB_TOKEN }} @@ -70,21 +110,25 @@ jobs: - name: Install package run: | - R CMD INSTALL . + _R_SHLIB_STRIP_=true R CMD INSTALL . shell: bash - uses: ./.github/workflows/custom/after-install if: hashFiles('.github/workflows/custom/after-install/action.yml') != '' - id: versions-matrix - # Only run for pull requests if the base repo is different from the head repo, always run for other events - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository + # Only run for pull requests if the base repo is different from the head repo, not for workflow_dispatch if not requested, always run for other events + if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository) && (github.event_name != 'workflow_dispatch' || inputs.versions-matrix) uses: ./.github/workflows/versions-matrix - id: dep-suggests-matrix + # Not for workflow_dispatch if not requested, always run for other events + if: github.event_name != 'workflow_dispatch' || inputs.dep-suggests-matrix uses: ./.github/workflows/dep-suggests-matrix - uses: ./.github/workflows/update-snapshots + with: + base: ${{ inputs.ref || github.head_ref }} - uses: ./.github/workflows/style @@ -120,6 +164,46 @@ jobs: name: rcc-smoke-sha path: rcc-smoke-sha.txt + - name: Update status for rcc + # FIXME: Wrap into action + if: always() && github.event_name == 'workflow_dispatch' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Check status of this workflow + if [ "${{ job.status }}" == "success" ]; then + state="success" + else + state="failure" + fi + + sha=${{ steps.commit.outputs.sha }} + if [ -z "${sha}" ]; then + sha=${{ inputs.ref }} + fi + if [ -z "${sha}" ]; then + sha=${{ github.head_ref }} + fi + if [ -z "${sha}" ]; then + sha=${{ github.sha }} + fi + sha=$(git rev-parse ${sha}) + + html_url=$(gh api \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + repos/${{ github.repository }}/actions/runs/${{ github.run_id }} | jq -r .html_url) + + description="${{ github.workflow }} / ${{ github.job }}" + + gh api \ + --method POST \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + repos/${{ github.repository }}/statuses/${sha} \ + -f "state=${state}" -f "target_url=${html_url}" -f "description=${description}" -f "context=rcc" + shell: bash + rcc-smoke-check-matrix: runs-on: ubuntu-latest diff --git a/.github/workflows/update-snapshots/action.yml b/.github/workflows/update-snapshots/action.yml index 6322dc156..5ee7e3ecc 100644 --- a/.github/workflows/update-snapshots/action.yml +++ b/.github/workflows/update-snapshots/action.yml @@ -3,6 +3,11 @@ description: > This action will run `testthat::test_local()` for tests that seem to use snapshots, this is determined by reading and grepping the test files. If the tests are failing, snapshots are updated, and a pull request is opened. +inputs: + base: + description: "The base branch to create the pull request against." + required: false + default: "main" runs: using: "composite" @@ -67,8 +72,8 @@ runs: id: cpr uses: peter-evans/create-pull-request@v6 with: - base: ${{ github.head_ref }} - branch: snapshot-${{ github.ref_name }}-${{ github.job }}-${{ steps.matrix-desc.outputs.branch }} + base: ${{ inputs.base }} + branch: snapshot-${{ inputs.base }}-${{ github.job }}-${{ steps.matrix-desc.outputs.branch }} delete-branch: true title: "test: Snapshot updates for ${{ github.job }} (${{ steps.matrix-desc.outputs.text }})" body: "Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action${{ github.event.number && format(' for #{0}', github.event.number) || '' }}." From 84c0faee9ae6639e358f9372e96799569a0e3650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 27 Oct 2024 06:08:59 +0100 Subject: [PATCH 3/4] ci: Trigger run --- .github/workflows/R-CMD-check.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 56ae58c6b..e2234cde6 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -41,6 +41,7 @@ concurrency: name: rcc + jobs: rcc-smoke: runs-on: ubuntu-latest From 324e98499f989ffe3110e4d381ea8d41d304531e Mon Sep 17 00:00:00 2001 From: krlmlr Date: Sun, 27 Oct 2024 05:12:03 +0000 Subject: [PATCH 4/4] chore: Auto-update from GitHub Actions Run: https://github.com/cynkra/fledge/actions/runs/11537814916 --- .github/dep-suggests-matrix.json | 1 - .github/versions-matrix.json | 1 - R/api-bump-version.R | 3 +-- 3 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 .github/dep-suggests-matrix.json delete mode 100644 .github/versions-matrix.json diff --git a/.github/dep-suggests-matrix.json b/.github/dep-suggests-matrix.json deleted file mode 100644 index acbc05868..000000000 --- a/.github/dep-suggests-matrix.json +++ /dev/null @@ -1 +0,0 @@ -{"package":["covr","foghorn","httptest2"]} diff --git a/.github/versions-matrix.json b/.github/versions-matrix.json deleted file mode 100644 index 5af4434a8..000000000 --- a/.github/versions-matrix.json +++ /dev/null @@ -1 +0,0 @@ -{"include":[{"os":"macos-latest","r":"4.4"},{"os":"macos-latest","r":"4.3"},{"os":"windows-latest","r":"devel"},{"os":"windows-latest","r":"4.4"},{"os":"windows-latest","r":"4.3"},{"os":"ubuntu-22.04","r":"devel","http-user-agent":"release"},{"os":"ubuntu-22.04","r":"4.4"},{"os":"ubuntu-22.04","r":"4.3"},{"os":"ubuntu-22.04","r":"4.2"},{"os":"ubuntu-22.04","r":"4.1"},{"os":"ubuntu-22.04","r":"4.0"},{"os":"ubuntu-22.04","r":"4.4","covr":"true","desc":"with covr"}]} diff --git a/R/api-bump-version.R b/R/api-bump-version.R index 6e9494cbb..d32f72908 100644 --- a/R/api-bump-version.R +++ b/R/api-bump-version.R @@ -30,8 +30,7 @@ bump_version <- function( which = c("dev", "patch", "pre-minor", "minor", "pre-major", "major"), ..., no_change_behavior = c("bump", "noop", "fail"), - check_default_branch = TRUE -) { + check_default_branch = TRUE) { check_dots_empty() which <- arg_match(which)