Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit feb02bc

Browse files
authored
ci: Use pkgdown branch (#31)
* ci: Use pkgdown branch * ci: Updates from duckdb
1 parent 624a042 commit feb02bc

File tree

4 files changed

+99
-11
lines changed

4 files changed

+99
-11
lines changed

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

+2-3
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

+89-5
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
@@ -51,6 +59,38 @@ jobs:
5159
with:
5260
ref: ${{ inputs.ref }}
5361

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

71111
- name: Install package
72112
run: |
73-
R CMD INSTALL .
113+
_R_SHLIB_STRIP_=true R CMD INSTALL .
74114
shell: bash
75115

76116
- uses: ./.github/workflows/custom/after-install
77117
if: hashFiles('.github/workflows/custom/after-install/action.yml') != ''
78118

79119
- 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
120+
# 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
121+
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository) && (github.event_name != 'workflow_dispatch' || inputs.versions-matrix)
82122
uses: ./.github/workflows/versions-matrix
83123

84124
- id: dep-suggests-matrix
125+
# Not for workflow_dispatch if not requested, always run for other events
126+
if: github.event_name != 'workflow_dispatch' || inputs.dep-suggests-matrix
85127
uses: ./.github/workflows/dep-suggests-matrix
86128

87129
- uses: ./.github/workflows/update-snapshots
130+
with:
131+
base: ${{ inputs.ref || github.head_ref }}
88132

89133
- uses: ./.github/workflows/style
90134

@@ -120,6 +164,46 @@ jobs:
120164
name: rcc-smoke-sha
121165
path: rcc-smoke-sha.txt
122166

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

.github/workflows/pkgdown.yaml

+1-1
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

+7-2
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)