|
| 1 | +# Based on workflows from https://github.com/Huber-group-EMBL/rhdf5 |
| 2 | +# Uses steps from https://github.com/grimbough/bioc-actions |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - devel |
| 7 | + pull_request: |
| 8 | + |
| 9 | +name: R-CMD-check-bioc |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +env: |
| 16 | + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
| 17 | + R_REMOTES_NO_ERRORS_FROM_WARNINGS: true |
| 18 | + |
| 19 | +jobs: |
| 20 | + R-CMD-check-bioc: |
| 21 | + runs-on: ${{ matrix.config.os }} |
| 22 | + |
| 23 | + name: ${{ matrix.config.os }} (${{ matrix.config.bioc-version }}) |
| 24 | + |
| 25 | + strategy: |
| 26 | + fail-fast: false |
| 27 | + matrix: |
| 28 | + config: |
| 29 | + - { os: windows-latest, bioc-version: 'devel', bioc-mirror: 'https://bioconductor.posit.co/', Ncpus: 2} |
| 30 | + - { os: macOS-latest, bioc-version: 'devel', bioc-mirror: 'https://bioconductor.posit.co/', Ncpus: 3} |
| 31 | + - { os: macOS-15-intel, bioc-version: 'devel', bioc-mirror: 'https://bioconductor.posit.co/', Ncpus: 3} |
| 32 | + - { os: ubuntu-latest, bioc-version: 'devel', bioc-mirror: 'https://bioconductor.posit.co/', Ncpus: 4} |
| 33 | + - { os: ubuntu-latest, bioc-version: 'release', bioc-mirror: 'https://packagemanager.posit.co/bioconductor', Ncpus: 4} |
| 34 | + steps: |
| 35 | + |
| 36 | + ## R CMD check complains about Windows line endings without this |
| 37 | + - name: Configure git |
| 38 | + run: | |
| 39 | + git config --global core.autocrlf false |
| 40 | +
|
| 41 | + - name: Checkout repository |
| 42 | + uses: actions/checkout@v5 |
| 43 | + |
| 44 | + - name: Install Linux dependencies |
| 45 | + if: runner.os == 'Linux' |
| 46 | + run: | |
| 47 | + sudo apt-get update |
| 48 | + sudo apt-get -y install hdf5-tools libsz2 libaec-dev |
| 49 | +
|
| 50 | + - name: Setup R and Bioconductor |
| 51 | + uses: grimbough/bioc-actions/setup-bioc@v1 |
| 52 | + with: |
| 53 | + bioc-version: ${{ matrix.config.bioc-version }} |
| 54 | + bioc-mirror: ${{ matrix.config.bioc-mirror }} |
| 55 | + |
| 56 | + - name: Set paths |
| 57 | + id: set-paths |
| 58 | + run: | |
| 59 | + current_dir <- getwd() |
| 60 | + cat("Current dir:", normalizePath(current_dir), "\n") |
| 61 | +
|
| 62 | + sep <- ifelse(.Platform$OS.type == "windows", "\\\\", "/") |
| 63 | +
|
| 64 | + pkg_name <- basename(current_dir) |
| 65 | + cat("Package name:", pkg_name, "\n") |
| 66 | + cat("pkg-name=", pkg_name, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE) |
| 67 | +
|
| 68 | + working_dir <- ".." |
| 69 | + working_dir_norm <- normalizePath(working_dir) |
| 70 | + cat("Working dir:", working_dir_norm, "\n") |
| 71 | + cat("working-dir=", working_dir_norm, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE) |
| 72 | +
|
| 73 | + pkg_dir <- file.path(working_dir, pkg_name) |
| 74 | + pkg_dir_norm <- normalizePath(pkg_dir) |
| 75 | + cat("Package dir:", pkg_dir_norm, "\n") |
| 76 | + cat("pkg-dir=", pkg_dir_norm, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE) |
| 77 | +
|
| 78 | + # Handle different behavior of normalizePath on Windows |
| 79 | + check_dir <- if (.Platform$OS.type == "windows") { |
| 80 | + paste0(pkg_dir, ".Rcheck") |
| 81 | + } else { |
| 82 | + paste0(normalizePath(pkg_dir), ".Rcheck") |
| 83 | + } |
| 84 | + check_dir_norm <- normalizePath(check_dir) |
| 85 | + cat("Check dir:", check_dir_norm, "\n") |
| 86 | + cat("check-dir=", check_dir_norm, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE) |
| 87 | + shell: Rscript {0} |
| 88 | + |
| 89 | + - name: Install pandoc |
| 90 | + uses: r-lib/actions/setup-pandoc@v2 |
| 91 | + |
| 92 | + - name: Install R dependencies |
| 93 | + uses: r-lib/actions/setup-r-dependencies@v2 |
| 94 | + with: |
| 95 | + extra-packages: any::rcmdcheck |
| 96 | + needs: check |
| 97 | + |
| 98 | + - name: Bioc - Build, Install, Check |
| 99 | + uses: grimbough/bioc-actions/build-install-check@v1 |
| 100 | + |
| 101 | + - name: Show testthat output |
| 102 | + run: | |
| 103 | + find . -name 'testthat.Rout*' -exec cat '{}' \; || true |
| 104 | + shell: bash |
| 105 | + working-directory: ${{ steps.set-paths.outputs.working-dir }} |
| 106 | + |
| 107 | + - name: Upload check results |
| 108 | + if: failure() |
| 109 | + uses: actions/upload-artifact@v4 |
| 110 | + with: |
| 111 | + name: ${{ format('{0}-{1}-bioc-{2}-results', runner.os, runner.arch, env.R_BIOC_VERSION ) }} |
| 112 | + path: ${{ steps.set-paths.outputs.check-dir }} |
| 113 | + |
| 114 | + - name: Run BiocCheck |
| 115 | + if: matrix.config.os == 'ubuntu-latest' && matrix.config.bioc-version == 'devel' |
| 116 | + uses: grimbough/bioc-actions/run-BiocCheck@v1 |
| 117 | + with: |
| 118 | + error-on: 'never' |
| 119 | + arguments: '--no-check-bioc-help' |
0 commit comments