Test out R 4.4 upgrade (#301) #154
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
name: PACE-HRH Create Release and upload Windows Binary Build | |
on: | |
push: | |
branches: | |
- "main" | |
jobs: | |
job_check: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.setVersion.outputs.CUR_VERSION }} | |
tag_exist: ${{ steps.checkTag.outputs.exists }} | |
container: | |
image: mewu/rimage:pandoc | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set current version | |
id: setVersion | |
run: | | |
CUR_VERSION=$(Rscript -e "library(desc); cat(toString(desc('pacehrh/DESCRIPTION')\$get_version()))") | |
echo $CUR_VERSION | |
echo "::set-output name=CUR_VERSION::$CUR_VERSION" | |
- name: Check variable is set | |
run: | | |
echo "Current version: ${{ steps.setVersion.outputs.CUR_VERSION }}" | |
- uses: mukunku/[email protected] | |
id: checkTag | |
with: | |
tag: ${{ steps.setVersion.outputs.CUR_VERSION }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check output | |
id: tagFound | |
run: | | |
echo "Is tag found? ${{ steps.checkTag.outputs.exists }}" | |
- name: Create tag if non-existent | |
if: steps.checkTag.outputs.exists == 'false' | |
id: tag_version | |
uses: mathieudutour/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
custom_tag: ${{ steps.setVersion.outputs.CUR_VERSION }} | |
tag_prefix: '' | |
job_build: | |
runs-on: windows-latest | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
R: [ '4.4' ] | |
name: R ${{ matrix.R }} Binary Build | |
needs: job_check | |
if: needs.job_check.outputs.tag_exist == 'false' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.R }} | |
- run: Rscript -e 'R.version' | |
- name: Install devtools | |
run: | | |
Rscript -e "install.packages('devtools')" | |
- name: Install pandoc | |
uses: crazy-max/ghaction-chocolatey@v2 | |
with: | |
args: install pandoc | |
- name: Setup Dependency | |
working-directory: 'tests/setup' | |
run: | | |
Rscript install_dep_for_tests.R | |
- name: Build docs | |
working-directory: 'pacehrh' | |
run: | | |
Rscript -e "install.packages('pkgdown'); pkgdown::build_site(override = list(destination = c('inst/doc')))" | |
- name: Build binary | |
run: | | |
Rscript -e "devtools::build(pkg='pacehrh', binary=TRUE)" | |
- name: Check vignettes | |
working-directory: 'pacehrh' | |
run: | | |
Rscript -e "devtools::install_local('.', repos=NULL, build_vignettes = TRUE, force=TRUE); library(pacehrh)" | |
Rscript -e "v <- vignette(package='pacehrh'); stopifnot(length(v)>0)" | |
Rscript -e "v <- browseVignettes('pacehrh'); stopifnot(length(v)>0)" | |
- name: Create Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo 'version: ${{ needs.job_check.outputs.version }}' | |
gh release create ${{ needs.job_check.outputs.version }} pacehrh_${{ needs.job_check.outputs.version }}.zip --generate-notes | |
- name: Publish gh-pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.TOKEN }} | |
publish_branch: gh-pages | |
publish_dir: pacehrh/inst/doc |