Surface headers for Linking To #1309
Workflow file for this run
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: | |
| schedule: | |
| - cron: "24 06 * * 1" | |
| workflow_dispatch: | |
| push: | |
| branches: ["*"] | |
| paths-ignore: | |
| - "Meta**" | |
| - "memcheck**" | |
| - "docs**" | |
| - "**.git" | |
| - "**.json" | |
| - "**.md" | |
| - "**.yaml" | |
| - "**.yml" | |
| - "!**R-CMD-check.yml" | |
| - "**.R[dD]ata" | |
| - "**.Rpro*" | |
| pull_request: | |
| branches: ["*"] | |
| paths-ignore: | |
| - "Meta**" | |
| - "memcheck**" | |
| - "docs**" | |
| - "**.git" | |
| - "**.json" | |
| - "**.md" | |
| - "**.yaml" | |
| - "**.yml" | |
| - "!**R-CMD-check.yml" | |
| - "**.R[dD]ata" | |
| - "**.Rpro*" | |
| name: R-CMD-check | |
| jobs: | |
| check-release: | |
| runs-on: ubuntu-24.04 | |
| name: ubuntu-24.04 (release) | |
| env: | |
| _R_CHECK_CRAN_INCOMING_: true # Seemingly not set by --as-cran | |
| _R_CHECK_FORCE_SUGGESTS_: false # CRAN settings | |
| R_COMPILE_AND_INSTALL_PACKAGES: 'never' | |
| _R_CHECK_THINGS_IN_CHECK_DIR_: false | |
| R_REMOTES_STANDALONE: true | |
| R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
| RSPM: "https://packagemanager.posit.co/cran/__linux__/noble/latest" | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Checkout git repo | |
| uses: actions/checkout@v5 | |
| - 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}.8888" | |
| if [[ "$RUNNER_OS" == "macOS" ]]; then | |
| sed -i "" "s/Version: .*/Version: ${new_version}/" DESCRIPTION | |
| else | |
| sed -i "s/Version: .*/Version: ${new_version}/" DESCRIPTION | |
| fi | |
| fi | |
| shell: bash | |
| - name: Set up R | |
| uses: r-lib/actions/setup-r@v2 | |
| - name: Set up R dependencies | |
| uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| cache-version: 2-${{ runner.arch }} | |
| extra-packages: | | |
| ms609/TreeDistData | |
| needs: | | |
| check | |
| - name: Check package | |
| uses: r-lib/actions/check-r-package@v2 | |
| check-all: | |
| 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-15-intel, r: "release"} # Until Intel architecture retired 2027-11 | |
| - {os: macOS-latest, r: "release"} | |
| - {os: ubuntu-22.04, r: '4.1', rspm: "https://packagemanager.posit.co/cran/__linux__/jammy/latest"} | |
| - {os: ubuntu-24.04-arm, r: "release", rspm: "https://packagemanager.posit.co/cran/__linux__/noble/latest"} | |
| - {os: ubuntu-24.04, r: "devel", rspm: "https://packagemanager.posit.co/cran/__linux__/noble/latest"} | |
| env: | |
| _R_CHECK_CRAN_INCOMING_: ${{ github.event_name == 'pull_request' }} | |
| _R_CHECK_FORCE_SUGGESTS_: false # CRAN settings | |
| R_COMPILE_AND_INSTALL_PACKAGES: 'never' | |
| _R_CHECK_THINGS_IN_CHECK_DIR_: false | |
| R_REMOTES_STANDALONE: true | |
| R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
| R_REALLY_FORCE_SYMBOLS: true # Until R4.3 | |
| RSPM: ${{ matrix.config.rspm }} | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Checkout git repo | |
| uses: actions/checkout@v5 | |
| - 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}.8888" | |
| if [[ "$RUNNER_OS" == "macOS" ]]; then | |
| sed -i "" "s/Version: .*/Version: ${new_version}/" DESCRIPTION | |
| else | |
| sed -i "s/Version: .*/Version: ${new_version}/" DESCRIPTION | |
| fi | |
| fi | |
| shell: bash | |
| - name: Set up R | |
| uses: r-lib/actions/setup-r@v2 | |
| with: | |
| r-version: ${{ matrix.config.r }} | |
| extra-repositories: https://ms609.github.io/packages/ | |
| - name: Set up R dependencies (Windows) | |
| if: runner.os == 'Windows' | |
| uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| cache-version: 2-${{ runner.arch }} | |
| extra-packages: | | |
| ms609/TreeDistData | |
| needs: | | |
| check | |
| coverage | |
| - name: Set up R dependencies (Non-Windows) | |
| if: runner.os != 'Windows' | |
| uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| cache-version: 2-${{ runner.arch }} | |
| extra-packages: | | |
| ms609/TreeDistData | |
| phangorn=?ignore-before-r=4.4.0 | |
| ggplot2=?ignore-before-r=4.4.0 | |
| hypervolume=?ignore-before-r=4.4.0 | |
| kdensity=?ignore-before-r=4.4.0 | |
| Rogue=?ignore-before-r=4.4.0 | |
| TreeSearch=?ignore-before-r=4.4.0 | |
| Umatrix=?ignore-before-r=4.4.0 | |
| uwot=?ignore-before-r=4.4.0 | |
| needs: | | |
| check | |
| - name: Check package | |
| uses: r-lib/actions/check-r-package@v2 | |
| - name: Code 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: | | |
| const issue_number = 164; | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issue_number, | |
| per_page: 3 | |
| }); | |
| const oneHourAgo = new Date(Date.now() - 60 * 60 * 1000); | |
| const recentFailureNotified = comments.some(comment => | |
| new Date(comment.created_at) > oneHourAgo && | |
| comment.body.includes('Scheduled workflow has failed') | |
| ); | |
| if (recentFailureNotified) { | |
| console.log("Recently notified; don't bombard"); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issue_number, | |
| body: 'Scheduled workflow has failed: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' | |
| }); | |
| await github.rest.issues.update({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issue_number, | |
| state: 'open' | |
| }); | |
| } | |
| rev-dep-check: | |
| runs-on: ubuntu-latest | |
| needs: check-release | |
| name: revdepcheck | |
| env: | |
| R_COMPILE_AND_INSTALL_PACKAGES: 'never' | |
| R_REMOTES_STANDALONE: true | |
| R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
| RSPM: ${{ matrix.config.rspm }} | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - uses: ms609/actions/revdepcheck@main | |
| with: | |
| deps: ${{ matrix.config.deps }} | |
| extra-packages: ms609/TreeDistData | |
| benchmark: | |
| runs-on: ubuntu-latest | |
| needs: check-release | |
| if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' | |
| name: benchmark | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| RSPM: "https://packagemanager.posit.co/cran/__linux__/noble/latest" | |
| _R_CHECK_BUILD_VIGNETTES_: false | |
| _R_CHECK_CRAN_INCOMING_: false | |
| _R_CHECK_FORCE_SUGGESTS_: false | |
| R_REMOTES_STANDALONE: true | |
| R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
| R_REALLY_FORCE_SYMBOLS: true | |
| PKG_CXXFLAGS: "-O3" | |
| steps: | |
| - name: Checkout PR branch | |
| uses: actions/checkout@v5 | |
| with: | |
| path: pr | |
| - name: Checkout target branch | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.event.pull_request.base.ref || 'main' }} | |
| path: main | |
| - name: Set up R | |
| uses: r-lib/actions/setup-r@v2 | |
| with: | |
| extra-repositories: https://ms609.github.io/packages/ | |
| - name: Install R dependencies | |
| uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| dependencies: '"hard"' | |
| extra-packages: | | |
| github::ms609/TreeTools | |
| needs: benchmark | |
| - name: Benchmark PR | |
| uses: ms609/actions/benchmark-step@main | |
| with: | |
| path: pr | |
| output: pr | |
| - name: Benchmark target | |
| uses: ms609/actions/benchmark-step@main | |
| with: | |
| path: main | |
| output: main | |
| - name: Benchmark PR again | |
| uses: ms609/actions/benchmark-step@main | |
| with: | |
| path: pr | |
| output: pr2 | |
| - run: dir pr-benchmark-results | |
| working-directory: pr | |
| - run: dir main-benchmark-results | |
| working-directory: pr | |
| - name: Compare benchmarks | |
| id: compare_results | |
| working-directory: pr | |
| run: | | |
| Rscript benchmark/_compare_results.R | |
| shell: bash | |
| - name: Upload PR benchmark results | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pr-benchmark-results | |
| path: pr/pr-benchmark-results/*.bench.Rds | |
| - name: Upload main benchmark results | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: main-benchmark-results | |
| path: pr/main-benchmark-results/*.bench.Rds | |
| - name: Comment on PR | |
| if: always() && github.event_name == 'pull_request' && steps.compare_results.outputs.report != '' | |
| uses: actions/github-script@v7 | |
| env: | |
| BENCHMARK_MESSAGE: ${{ steps.compare_results.outputs.report }} | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const benchmarkIdentifier = '<!-- benchmark-comment -->'; | |
| const outdatedPrefix = '> **⚠️ This benchmark result is outdated. See the latest comment below.**\n\n'; | |
| const comments = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number | |
| }); | |
| const previousBenchmarkComments = comments.data.filter(comment => | |
| comment.user.type === 'Bot' && | |
| comment.body.includes(benchmarkIdentifier) && | |
| !comment.body.startsWith('> **⚠️ This benchmark result is outdated.') | |
| ); | |
| for (const comment of previousBenchmarkComments) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: comment.id, | |
| body: outdatedPrefix + comment.body | |
| }); | |
| } | |
| const newCommentBody = benchmarkIdentifier + '\n' + process.env.BENCHMARK_MESSAGE; | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: newCommentBody | |
| }); |