actions@v5 #317
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
| # For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. | |
| # https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| paths-ignore: | |
| - "Meta**" | |
| - "memcheck**" | |
| - "docs**" | |
| - "**.git" | |
| - "**.json" | |
| - "**.md" | |
| - "**.yml" | |
| - "!**R-CMD-check.yml" | |
| - "**.R[dD]ata" | |
| - "**.Rpro*" | |
| pull_request: | |
| branches: | |
| - main | |
| - master | |
| paths-ignore: | |
| - "Meta**" | |
| - "memcheck**" | |
| - "docs**" | |
| - "**.git" | |
| - "**.json" | |
| - "**.md" | |
| - "**.yml" | |
| - "!**R-CMD-check.yml" | |
| - "**.R[dD]ata" | |
| - "**.Rpro*" | |
| name: R-CMD-check | |
| 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: macOS-latest, r: 'release'} | |
| - {os: ubuntu-latest, r: '4.1', rspm: "https://packagemanager.rstudio.com/cran/__linux__/noble/latest"} # Until TreeDist can slough phangorn | |
| - {os: ubuntu-latest, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/noble/latest"} | |
| - {os: ubuntu-latest, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/noble/latest"} | |
| env: | |
| R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
| _R_CHECK_FORCE_SUGGESTS_: false | |
| R_REALLY_FORCE_SYMBOLS: true | |
| R_COMPILE_AND_INSTALL_PACKAGES: 'never' | |
| RSPM: ${{ matrix.config.rspm }} | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: true | |
| - name: Temporarily bump package version | |
| run: | | |
| old_version=$(grep "Version:" DESCRIPTION | awk '{print $2}') | |
| if [[ $(echo "$old_version" | tr -cd '.' | wc -c) -eq 2 ]]; then | |
| new_version="${old_version}.9999" | |
| if [[ "$RUNNER_OS" == "macOS" ]]; then | |
| sed -i "" "s/Version: .*/Version: ${new_version}/" DESCRIPTION | |
| else | |
| sed -i "s/Version: .*/Version: ${new_version}/" DESCRIPTION | |
| fi | |
| fi | |
| echo "Current package version is now: $(grep "Version:" DESCRIPTION | awk '{print $2}')" | |
| shell: bash | |
| - name: Install system dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get install -y libpoppler-glib-dev bwidget libavfilter-dev libtesseract-dev gdal-bin proj-bin libgdal-dev libproj-dev tesseract-ocr-eng libleptonica-dev tcl libgtk2.0-dev libgtk-3-dev | |
| sudo pkg-config --libs poppler-glib | |
| sudo pkg-config --cflags poppler-glib | |
| - uses: r-lib/actions/setup-r@v2 | |
| with: | |
| r-version: ${{ matrix.config.r }} | |
| - uses: r-lib/actions/setup-pandoc@v2 | |
| - name: Cache R packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ env.R_LIBS_USER }} | |
| key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} | |
| restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- | |
| - name: Install system dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install libgit2 xquartz | |
| - name: Set up R dependencies (Windows) | |
| if: runner.os == 'Windows' | |
| uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| extra-packages: callr | |
| needs: | | |
| check | |
| coverage | |
| github-actions | |
| - name: Set up R dependencies (Non-Windows) | |
| if: runner.os != 'Windows' | |
| uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| needs: | | |
| check | |
| github-actions | |
| extra-packages: | | |
| phangorn=?ignore-before-r=4.1.0 | |
| - name: Check package | |
| uses: r-lib/actions/check-r-package@v2 | |
| - name: Test coverage | |
| if: runner.os == 'Windows' | |
| run: | | |
| covr::codecov() | |
| shell: Rscript {0} | |
| - name: Notify on failure | |
| if: failure() && github.event_name == 'schedule' | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: 31, | |
| body: 'Scheduled workflow has failed: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' | |
| }); | |