Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOC] Publish HTML documentation preview on surge #128

Merged
merged 44 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
02a68f2
START html doc generation - init the pkgdown configuration
tbouffard Oct 26, 2022
5d6b7aa
update CONTRIBUTING.md
tbouffard Oct 27, 2022
6353605
add gh wf
tbouffard Oct 27, 2022
24b494a
update condition to trigger teardown on pr close
tbouffard Oct 27, 2022
b1fa5e2
update wf paths
tbouffard Oct 27, 2022
00eb7a5
gh wf: update condition
tbouffard Oct 27, 2022
daa4062
wf: update comment
tbouffard Oct 27, 2022
4ae781d
gh wf update condition
tbouffard Oct 27, 2022
7dc289c
wf: only manage PR use case for now
tbouffard Nov 17, 2022
8a3f355
wf: bump surge-preview-tools from v1 to v2
tbouffard Nov 17, 2022
9aa5836
wf: log node environment info
tbouffard Nov 17, 2022
22cfb38
doc: improve wording and fix typo
tbouffard Nov 17, 2022
8c07dfc
doc: use 'main' branch instead of 'master'
tbouffard Nov 17, 2022
3385c31
update .gitignore comment
tbouffard Nov 17, 2022
9043dce
EXTRA js file: update the license header (use block comment instead o…
tbouffard Nov 17, 2022
361faa1
EXTRA examples: prefix the package name when calling functions
tbouffard Nov 17, 2022
6d759dc
WF debug surge error
tbouffard Nov 18, 2022
ef722c0
TMP remove the build wf
tbouffard Nov 18, 2022
b4dd9fb
Revert "TMP remove the build wf"
tbouffard Nov 18, 2022
b740b93
TMP disable build wf
tbouffard Nov 18, 2022
f03b019
WF: log surge tools outputs
tbouffard Nov 18, 2022
9ebd989
TMP: fix condition to disable the "build" wf
tbouffard Nov 18, 2022
1857780
WF: dedicated wf for PR
tbouffard Nov 18, 2022
965e436
WF: add checkout step
tbouffard Nov 18, 2022
a4b4efb
WF: more tests
tbouffard Nov 18, 2022
a76b0e6
WF: more tests
tbouffard Nov 18, 2022
e8e3e11
WF: permissions set on job not globally
tbouffard Nov 18, 2022
b3fe6de
remove the temp 'pr preview' wf
tbouffard Nov 18, 2022
70f7cc7
wf: build the doc site
tbouffard Nov 18, 2022
bb74786
wf: manage teardown + run on ubuntu 22 + remove commented configuration
tbouffard Nov 18, 2022
d5bd5d2
wf: introduce a 'build-setup' action to remove duplication between wo…
tbouffard Nov 21, 2022
955a4bf
EXTRA wip news menu entry
tbouffard Nov 21, 2022
eff0fe9
Attempt doc wf: do not run R CMD install, to see if it is required
tbouffard Nov 21, 2022
0ece7c5
EXTRA: configure the site title
tbouffard Nov 21, 2022
d9e9834
Revert "EXTRA examples: prefix the package name when calling functions"
tbouffard Nov 21, 2022
d0e9a99
Revert "EXTRA js file: update the license header (use block comment i…
tbouffard Nov 21, 2022
63df75b
Revert "doc: improve wording and fix typo"
tbouffard Nov 21, 2022
f6a6e8c
Revert "doc: use 'main' branch instead of 'master'"
tbouffard Nov 21, 2022
f936c8f
revert pkgdown.yml customization
tbouffard Nov 21, 2022
2b148fa
wf: remove commented configuration
tbouffard Nov 22, 2022
9f40048
Merge branch 'main' into docs/generate_html_site
tbouffard Nov 22, 2022
62ef031
improve doc paragraph in the contributing guide
tbouffard Nov 22, 2022
0a30bca
wf: remove extra comment
tbouffard Nov 22, 2022
66b312f
Update CONTRIBUTING.md
csouchet Nov 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
^.*\.md$
^doc$
^LICENSE$
^_pkgdown\.yml$
^docs$
^pkgdown$
29 changes: 29 additions & 0 deletions .github/actions/build-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 'Build Setup'
description: 'Setup R and install dependencies'
inputs:
dependencies-extra-packages:
description: '`extra-packages` input for the `setup-r-dependencies` action.'
required: true
dependencies-needs:
description: '`needs` input for the `setup-r-dependencies` action.'
required: true
r-version:
description: 'The R version to use.'
required: true
runs:
using: 'composite'
steps:
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ inputs.r-version }}
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: ${{ inputs.dependencies-extra-packages }}
needs: ${{ inputs.dependencies-needs }}
# to generate documentation
- uses: r-lib/actions/setup-pandoc@v2
# Sets up LaTeX with tinytex, for PDF generation
- uses: r-lib/actions/setup-tinytex@v2


17 changes: 5 additions & 12 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
tags:
- v*
paths:
- '.github/actions/build-setup/**/*'
- '.github/workflows/R-CMD-check.yaml'
- 'R/**/*'
- 'inst/**/*'
Expand All @@ -19,6 +20,7 @@ on:
branches:
- main
paths:
- '.github/actions/build-setup/**/*'
- '.github/workflows/R-CMD-check.yaml'
- 'R/**/*'
- 'inst/**/*'
Expand Down Expand Up @@ -49,14 +51,11 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/setup-r@v2
- uses: ./.github/actions/build-setup
with:
dependencies-extra-packages: any::rcmdcheck
dependencies-needs: check
r-version: ${{ matrix.config.r }}
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/check-r-package@v2


Expand All @@ -74,12 +73,6 @@ jobs:
with:
name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-source-package
path: bpmnVisualization_*.tar.gz


# Sets up LaTeX with tinytex, for PDF generation
# not needed before as the checks on the repo sources are done with --no-manual
- uses: r-lib/actions/setup-tinytex@v2

- name: Check the source package
id: source_package_checks
run: R CMD check --as-cran bpmnVisualization_*.tar.gz
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/publish-documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Publish Documentation

on:
pull_request:
# To manage 'surge-preview' action teardown, add default event types + closed event type
types: [opened, synchronize, reopened, closed]
branches:
- main
paths:
- '.github/actions/build-setup/**/*'
- '.github/workflows/publish-documentation.yml'
- 'inst/**'
- 'man/**'
- '.Rbuildignore'
- '_pkgdown.yml'
- 'CONTRIBUTING.md'
- 'DESCRIPTION'
- 'README.md' # TODO use the right file, the repo from the repo cannot be included (wrong format, too much info)

jobs:
# for Pull Request
pr_preview: # the id is used by surge to generate the surge url
if: github.event_name == 'pull_request'
runs-on: ubuntu-22.04
permissions:
pull-requests: write # surge-preview: PR comments
steps:
- uses: actions/checkout@v3
if: github.event.action != 'closed'
- uses: ./.github/actions/build-setup
if: github.event.action != 'closed'
with:
dependencies-extra-packages: any::pkgdown, local::.
dependencies-needs: website
r-version: release
- name: Build documentation website
if: github.event.action != 'closed'
shell: Rscript {0}
run: |
pkgdown::build_site()
# Always upload the website for local browsing and when it cannot be deployed to surge
- name: Upload documentation
if: github.event.action != 'closed'
uses: actions/upload-artifact@v3
with:
name: documentation-${{github.sha}}
path: docs
- uses: bonitasoft/actions/packages/surge-preview-tools@v2
id: surge-preview-tools
with:
surge-token: ${{ secrets.SURGE_TOKEN }}
- name: Manage surge preview
if: steps.surge-preview-tools.outputs.can-run-surge-command == 'true'
id: doc_preview
uses: afc163/surge-preview@v1
with:
surge_token: ${{ secrets.SURGE_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
dist: docs
failOnError: true
teardown: true
build: ls -lh docs
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ vignettes/*.pdf

# R Environment Variables
.Renviron

# Generated documentation
docs
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,20 @@ To regenerate this documentation after function comment updating, run this comma
devtools::document()
```

### Generate the HTML documentation (site)

Generate the HTML documentation with [pkgdown](https://pkgdown.r-lib.org)
tbouffard marked this conversation as resolved.
Show resolved Hide resolved
csouchet marked this conversation as resolved.
Show resolved Hide resolved

**Note**: on Ubuntu, you may encounter errors during the installation of `pkgdown`. In particular, the installation of some dependent packages may fail:
- `systemfonts`: run `sudo apt -y install libfontconfig1-dev` (see [systemfonts#35](https://github.com/r-lib/systemfonts/issues/35#issuecomment-633560151) )
- `textshapping`: `run sudo apt -y install libharfbuzz-dev libfribidi-dev`

Once `pkgdown` is installed, you can generate the HTML documentation quickly with this command:
```
pkgdown::build_site(devel = TRUE, lazy = TRUE, preview = FALSE)
```
For more details about the available options, see [the official documentation](https://pkgdown.r-lib.org/reference/build_site.html).

### bpmn-visualization TypeScript library update

The [bpmn-visualization](https://github.com/process-analytics/bpmn-visualization-js) dependency is automatically updated by the [Update bpmn-visualization version](.github/workflows/update_bpmn_visualization_version.yml) workflow when a new version of this library is released.
Expand Down