Repository navigation
Add GitHub Actions CI and release workflows #10
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1a30caf
Add GitHub Actions CI (R CMD check) and release workflows
d-osorio-qdi 7f66d16
Harden release workflow: split read-only build from publish, verify t…
d-osorio-qdi 5bcc2ee
CI: run testthat against the installed package so parallel future wor…
d-osorio-qdi 1191af9
runSCORPION: skip batch correction when batch has a single level
dosorio 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -6,3 +6,4 @@ README.md | |
| tests/* | ||
| ^\.positai$ | ||
| ^\.claude$ | ||
| ^\.github$ | ||
This file contains hidden or 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,70 @@ | ||
| # Continuous integration: R CMD check on Linux, macOS and Windows. | ||
| on: | ||
| push: | ||
| branches: [main, master] | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| name: R-CMD-check | ||
|
|
||
| permissions: read-all | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| R-CMD-check: | ||
| runs-on: ${{ matrix.config.os }} | ||
|
|
||
| name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| config: | ||
| - {os: macos-latest, r: 'release'} | ||
| - {os: windows-latest, r: 'release'} | ||
| - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} | ||
| - {os: ubuntu-latest, r: 'release'} | ||
| - {os: ubuntu-latest, r: 'oldrel-1'} | ||
|
|
||
| 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")' | ||
|
|
||
| # tests/ is excluded from the source tarball via .Rbuildignore, so | ||
| # R CMD check skips them; run the testthat suite from the repo instead. | ||
| # Install first: the parallel tests start future workers that attach the | ||
| # installed package, so pkgload::load_all() is not enough. | ||
| - name: Run testthat suite | ||
| shell: Rscript {0} | ||
| env: | ||
| NOT_CRAN: 'true' | ||
| run: | | ||
| options(testthat.progress.max_fails = Inf) | ||
| install.packages(".", repos = NULL, type = "source") | ||
| testthat::test_dir("tests/testthat", package = "SCORPION", load_package = "installed", | ||
| stop_on_failure = TRUE, | ||
| reporter = testthat::ProgressReporter$new(show_praise = FALSE)) | ||
This file contains hidden or 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,93 @@ | ||
| # Continuous delivery: on a version tag, build and check the source | ||
| # tarball, then attach it to a GitHub release. | ||
| on: | ||
| push: | ||
| tags: ['v*', '[0-9]*'] | ||
| workflow_dispatch: | ||
|
|
||
| name: release | ||
|
|
||
| permissions: read-all | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| env: | ||
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
| 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::rcmdcheck | ||
| needs: check | ||
|
|
||
| # Tags may be written as 1.2.3, v1.2.3 or v.1.2.3. | ||
| - name: Verify tag matches DESCRIPTION version | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| run: | | ||
| pkg_version=$(grep '^Version:' DESCRIPTION | sed 's/Version:[[:space:]]*//') | ||
| tag_version=${GITHUB_REF_NAME#v} | ||
| tag_version=${tag_version#.} | ||
| if [ "$tag_version" != "$pkg_version" ]; then | ||
| echo "::error::Tag $GITHUB_REF_NAME does not match DESCRIPTION version $pkg_version" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # tests/ is excluded from the source tarball via .Rbuildignore, so | ||
| # run the testthat suite from the checkout before releasing. | ||
| # Install first: the parallel tests start future workers that attach the | ||
| # installed package, so pkgload::load_all() is not enough. | ||
| - name: Run testthat suite | ||
| shell: Rscript {0} | ||
| env: | ||
| NOT_CRAN: 'true' | ||
| run: | | ||
| install.packages(".", repos = NULL, type = "source") | ||
| testthat::test_dir("tests/testthat", package = "SCORPION", load_package = "installed", | ||
| stop_on_failure = TRUE, | ||
| reporter = testthat::ProgressReporter$new(show_praise = FALSE)) | ||
|
|
||
| - name: Build source tarball | ||
| run: R CMD build --no-manual . | ||
|
|
||
| - name: Check source tarball | ||
| shell: Rscript {0} | ||
| run: | | ||
| tarball <- Sys.glob("*.tar.gz") | ||
| stopifnot(length(tarball) == 1) | ||
| rcmdcheck::rcmdcheck(tarball, args = c("--no-manual", "--as-cran"), | ||
| error_on = "warning", check_dir = "check") | ||
|
|
||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: source-tarball | ||
| path: '*.tar.gz' | ||
| if-no-files-found: error | ||
|
|
||
| publish: | ||
| needs: build | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| name: source-tarball | ||
|
|
||
| - name: Create GitHub release | ||
|
dosorio marked this conversation as resolved.
Resolved
|
||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| gh release create "$GITHUB_REF_NAME" *.tar.gz \ | ||
| --repo "$GITHUB_REPOSITORY" \ | ||
| --title "$GITHUB_REF_NAME" --generate-notes | ||
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.