Skip to content

Commit d5aa842

Browse files
authored
ci: Use pkgdown branch (#14)
* ci: Use pkgdown branch * ci: Updates from duckdb * ci: Trigger run
1 parent 843c42f commit d5aa842

File tree

4 files changed

+100
-11
lines changed

4 files changed

+100
-11
lines changed

.github/workflows/R-CMD-check-status.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ jobs:
1616

1717
name: "Update commit status"
1818

19-
# Only run if triggered by rcc workflow
20-
if: github.event.workflow_run.name == 'rcc'
21-
2219
steps:
2320
- name: "Update commit status"
21+
# Only run if triggered by rcc workflow
22+
if: github.event.workflow_run.name == 'rcc'
2423
env:
2524
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2625
run: |

.github/workflows/R-CMD-check.yaml

Lines changed: 90 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,17 @@ on:
1818
workflow_dispatch:
1919
inputs:
2020
ref:
21-
description: "Branch or tag to check out"
21+
description: "Branch, tag, or commit to check out"
2222
required: false
2323
default: "main"
24+
versions-matrix:
25+
description: "Create a matrix of R versions"
26+
type: boolean
27+
default: false
28+
dep-suggests-matrix:
29+
description: "Create a matrix of suggested dependencies"
30+
type: boolean
31+
default: false
2432
merge_group:
2533
types:
2634
- checks_requested
@@ -33,6 +41,7 @@ concurrency:
3341

3442
name: rcc
3543

44+
3645
jobs:
3746
rcc-smoke:
3847
runs-on: ubuntu-latest
@@ -51,6 +60,38 @@ jobs:
5160
with:
5261
ref: ${{ inputs.ref }}
5362

63+
- name: Update status for rcc
64+
# FIXME: Wrap into action
65+
if: github.event_name == 'workflow_dispatch'
66+
env:
67+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
run: |
69+
# Check status of this workflow
70+
state="pending"
71+
sha=${{ inputs.ref }}
72+
if [ -z "${sha}" ]; then
73+
sha=${{ github.head_ref }}
74+
fi
75+
if [ -z "${sha}" ]; then
76+
sha=${{ github.sha }}
77+
fi
78+
sha=$(git rev-parse ${sha})
79+
80+
html_url=$(gh api \
81+
-H "Accept: application/vnd.github+json" \
82+
-H "X-GitHub-Api-Version: 2022-11-28" \
83+
repos/${{ github.repository }}/actions/runs/${{ github.run_id }} | jq -r .html_url)
84+
85+
description="${{ github.workflow }} / ${{ github.job }}"
86+
87+
gh api \
88+
--method POST \
89+
-H "Accept: application/vnd.github+json" \
90+
-H "X-GitHub-Api-Version: 2022-11-28" \
91+
repos/${{ github.repository }}/statuses/${sha} \
92+
-f "state=${state}" -f "target_url=${html_url}" -f "description=${description}" -f "context=rcc"
93+
shell: bash
94+
5495
- uses: ./.github/workflows/rate-limit
5596
with:
5697
token: ${{ secrets.GITHUB_TOKEN }}
@@ -66,25 +107,29 @@ jobs:
66107
cache-version: rcc-smoke-2
67108
needs: check, website
68109
# Beware of using dev pkgdown here, has brought in dev dependencies in the past
69-
extra-packages: any::rcmdcheck r-lib/roxygen2 any::decor r-lib/styler pkgdown deps::.
110+
extra-packages: any::rcmdcheck r-lib/roxygen2 any::decor r-lib/styler r-lib/pkgdown@f-readme-tweak deps::.
70111

71112
- name: Install package
72113
run: |
73-
R CMD INSTALL .
114+
_R_SHLIB_STRIP_=true R CMD INSTALL .
74115
shell: bash
75116

76117
- uses: ./.github/workflows/custom/after-install
77118
if: hashFiles('.github/workflows/custom/after-install/action.yml') != ''
78119

79120
- id: versions-matrix
80-
# Only run for pull requests if the base repo is different from the head repo, always run for other events
81-
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
121+
# 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
122+
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository) && (github.event_name != 'workflow_dispatch' || inputs.versions-matrix)
82123
uses: ./.github/workflows/versions-matrix
83124

84125
- id: dep-suggests-matrix
126+
# Not for workflow_dispatch if not requested, always run for other events
127+
if: github.event_name != 'workflow_dispatch' || inputs.dep-suggests-matrix
85128
uses: ./.github/workflows/dep-suggests-matrix
86129

87130
- uses: ./.github/workflows/update-snapshots
131+
with:
132+
base: ${{ inputs.ref || github.head_ref }}
88133

89134
- uses: ./.github/workflows/style
90135

@@ -120,6 +165,46 @@ jobs:
120165
name: rcc-smoke-sha
121166
path: rcc-smoke-sha.txt
122167

168+
- name: Update status for rcc
169+
# FIXME: Wrap into action
170+
if: always() && github.event_name == 'workflow_dispatch'
171+
env:
172+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
173+
run: |
174+
# Check status of this workflow
175+
if [ "${{ job.status }}" == "success" ]; then
176+
state="success"
177+
else
178+
state="failure"
179+
fi
180+
181+
sha=${{ steps.commit.outputs.sha }}
182+
if [ -z "${sha}" ]; then
183+
sha=${{ inputs.ref }}
184+
fi
185+
if [ -z "${sha}" ]; then
186+
sha=${{ github.head_ref }}
187+
fi
188+
if [ -z "${sha}" ]; then
189+
sha=${{ github.sha }}
190+
fi
191+
sha=$(git rev-parse ${sha})
192+
193+
html_url=$(gh api \
194+
-H "Accept: application/vnd.github+json" \
195+
-H "X-GitHub-Api-Version: 2022-11-28" \
196+
repos/${{ github.repository }}/actions/runs/${{ github.run_id }} | jq -r .html_url)
197+
198+
description="${{ github.workflow }} / ${{ github.job }}"
199+
200+
gh api \
201+
--method POST \
202+
-H "Accept: application/vnd.github+json" \
203+
-H "X-GitHub-Api-Version: 2022-11-28" \
204+
repos/${{ github.repository }}/statuses/${sha} \
205+
-f "state=${state}" -f "target_url=${html_url}" -f "description=${description}" -f "context=rcc"
206+
shell: bash
207+
123208
rcc-smoke-check-matrix:
124209
runs-on: ubuntu-latest
125210

.github/workflows/pkgdown.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
install-r: false
4343
cache-version: pkgdown-2
4444
needs: website
45-
extra-packages: pkgdown local::.
45+
extra-packages: r-lib/pkgdown@f-readme-tweak local::.
4646

4747
- uses: ./.github/workflows/custom/after-install
4848
if: hashFiles('.github/workflows/custom/after-install/action.yml') != ''

.github/workflows/update-snapshots/action.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ description: >
33
This action will run `testthat::test_local()` for tests that seem to use snapshots,
44
this is determined by reading and grepping the test files.
55
If the tests are failing, snapshots are updated, and a pull request is opened.
6+
inputs:
7+
base:
8+
description: "The base branch to create the pull request against."
9+
required: false
10+
default: "main"
611

712
runs:
813
using: "composite"
@@ -67,8 +72,8 @@ runs:
6772
id: cpr
6873
uses: peter-evans/create-pull-request@v6
6974
with:
70-
base: ${{ github.head_ref }}
71-
branch: snapshot-${{ github.ref_name }}-${{ github.job }}-${{ steps.matrix-desc.outputs.branch }}
75+
base: ${{ inputs.base }}
76+
branch: snapshot-${{ inputs.base }}-${{ github.job }}-${{ steps.matrix-desc.outputs.branch }}
7277
delete-branch: true
7378
title: "test: Snapshot updates for ${{ github.job }} (${{ steps.matrix-desc.outputs.text }})"
7479
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) || '' }}."

0 commit comments

Comments
 (0)