-
Notifications
You must be signed in to change notification settings - Fork 4
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
add rSharp-based reusable workflows #33
Merged
Yuri05
merged 8 commits into
Open-Systems-Pharmacology:main
from
Felixmil:rSharp-actions
Jul 22, 2024
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3c84156
rename rClr based reusable workflows
Felixmil 89a6be8
Add new reusable workflows for R packages
Felixmil 33d5093
Merge commit '8984f7f931a51ff952d9e018042feaea994d4678'
Felixmil 12dc249
fix typo
Felixmil 15c1c6f
fix indentation
Felixmil ce9fedc
remove type argument for secret
Felixmil 15f9ac5
fix indentation
Felixmil 71788d6
fix indentation
Felixmil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
|
||
on: | ||
workflow_call: | ||
|
||
name: R-CMD-check | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
R-CMD-check: | ||
runs-on: ${{ matrix.config.os }} | ||
|
||
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- {os: windows-latest, r: 'release'} | ||
- {os: ubuntu-latest, r: 'release'} | ||
|
||
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 | ||
needs: check | ||
|
||
- uses: r-lib/actions/check-r-package@v2 | ||
with: | ||
upload-snapshots: true | ||
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' | ||
error-on: 'c("error")' | ||
|
||
- name: Build package | ||
if: ${{ success() }} | ||
run: | | ||
output_dir <- file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "built_package") | ||
dir.create(output_dir) | ||
devtools::build(binary = TRUE, path = output_dir) | ||
shell: Rscript {0} | ||
|
||
- name: Get package package and R versions and store in environment | ||
run: | | ||
echo "PKG_VERSION=$(Rscript -e 'desc::desc_get_version()')" >> $GITHUB_ENV | ||
echo "R_VERSION=$(Rscript -e 'cat(R.version$major, R.version$minor, sep = ".")')" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Upload built package | ||
if: ${{ success() }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ospsuite-v${{ env.PKG_VERSION }}-${{runner.os}}-r_${{ env.R_VERSION }} | ||
path: ${{ runner.temp }}/built_package/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# This reusable workflow will, if triggered by a merge: | ||
# - Bump version if the current version is development (x.y.z.9000+) | ||
# - Tag the target branch with version number | ||
name: bump-dev-version | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
app-id: | ||
type: string | ||
required: true | ||
secrets: | ||
private-key: | ||
required: true | ||
|
||
jobs: | ||
bump-dev-version: | ||
if: github.event_name != 'pull_request' | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
permissions: write-all | ||
steps: | ||
|
||
- uses: actions/create-github-app-token@v1 | ||
id: app-token | ||
with: | ||
app-id: ${{ inputs.app-id }} | ||
private-key: ${{ secrets.private-key }} | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ steps.app-token.outputs.token }} | ||
|
||
- name: Setup R | ||
uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- name: Install packages | ||
run: | | ||
install.packages("usethis") | ||
shell: Rscript {0} | ||
|
||
- name: Change DESCRIPTION file | ||
run: | | ||
if(usethis:::is_dev_version()){ | ||
desc::desc_set_version(version = usethis:::bump_version()[["dev"]]) | ||
} | ||
shell: Rscript {0} | ||
|
||
- name: Get package version from DESCRIPTION file and set as environment variable | ||
run: | | ||
echo "PKG_VERSION=$(Rscript -e 'desc::desc_get_version()')" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- uses: EndBug/add-and-commit@v9 | ||
if: ${{ success() }} | ||
with: | ||
message: '🤖 Bump version. [skip actions]' | ||
default_author: github_actions | ||
add: 'DESCRIPTION' | ||
tag: 'v${{ env.PKG_VERSION }}' |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
|
||
on: | ||
workflow_call: | ||
|
||
name: pkgdown | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
pkgdown: | ||
runs-on: ubuntu-latest | ||
# Only restrict concurrency for non-PR jobs | ||
concurrency: | ||
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::pkgdown, local::. | ||
needs: website | ||
|
||
- name: Build site | ||
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) | ||
shell: Rscript {0} | ||
|
||
- name: Deploy to GitHub pages 🚀 | ||
if: github.event_name != 'pull_request' | ||
uses: JamesIves/github-pages-deploy-action@v4.5.0 | ||
with: | ||
clean: false | ||
branch: gh-pages | ||
folder: docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
|
||
on: | ||
workflow_call: | ||
|
||
name: test-coverage | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
test-coverage: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::covr, any::xml2 | ||
needs: coverage | ||
|
||
- name: Test coverage | ||
run: | | ||
cov <- covr::package_coverage( | ||
quiet = FALSE, | ||
clean = FALSE, | ||
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") | ||
) | ||
covr::to_cobertura(cov) | ||
shell: Rscript {0} | ||
|
||
- uses: codecov/codecov-action@v4 | ||
with: | ||
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }} | ||
file: ./cobertura.xml | ||
plugin: noop | ||
disable_search: true | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
- name: Show testthat output | ||
if: always() | ||
run: | | ||
## -------------------------------------------------------------------- | ||
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true | ||
shell: bash | ||
|
||
- name: Upload test results | ||
if: failure() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-test-failures | ||
path: ${{ runner.temp }}/package |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should add
--no-vignettes
to the check args?args: c("--no-manual", "--as-cran", "--no-vignettes")
Otherwise all vignettes outputs are created twice: first during the check step, and then during the build step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends if we want to make vignettes available for the users directly from R (with
vignette(...)
) or not.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand this.
If the vignettes are built and delivered as part of the package: they can be accessed via
vignette(..)
.. or not?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but if they are not build during this process, they will not be available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, I think we should stick with the default behavior (this is the default from r-lib repo)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I have created a separate issue for this: #34