|
| 1 | +# This workflow uses actions that are not certified by GitHub. |
| 2 | +# They are provided by a third-party and are governed by |
| 3 | +# separate terms of service, privacy policy, and support |
| 4 | +# documentation. |
| 5 | +# |
| 6 | + |
| 7 | +name: build |
| 8 | + |
| 9 | +on: |
| 10 | + push: |
| 11 | + branches: [ release, master ] |
| 12 | + pull_request: |
| 13 | + branches: [ release, master ] |
| 14 | + |
| 15 | +jobs: |
| 16 | + build: |
| 17 | + runs-on: ${{ matrix.config.os }} |
| 18 | + name: ${{ matrix.config.os }} (${{ matrix.r }}) |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + r: ['release', 'devel'] |
| 23 | + config: |
| 24 | + - {os: windows-latest, suffix: 'zip'} |
| 25 | + - {os: macOS-latest, suffix: 'tgz'} |
| 26 | + - {os: ubuntu-16.04, suffix: 'tar.gz', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} |
| 27 | + isMaster: |
| 28 | + - ${{ contains(github.ref, 'master') }} |
| 29 | + exclude: |
| 30 | + - isMaster: false |
| 31 | + r: devel |
| 32 | + - isMaster: true |
| 33 | + r: release |
| 34 | + env: |
| 35 | + R_REMOTES_NO_ERRORS_FROM_WARNINGS: true |
| 36 | + RSPM: ${{ matrix.config.rspm }} |
| 37 | + |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v2 |
| 40 | + - name: Set up R ${{ matrix.r }} |
| 41 | + uses: r-lib/actions/setup-r@master |
| 42 | + with: |
| 43 | + r-version: ${{ matrix.r }} |
| 44 | + http-user-agent: ${{ matrix.config.http-user-agent }} |
| 45 | + |
| 46 | + - uses: r-lib/actions/setup-pandoc@v1 |
| 47 | + |
| 48 | + - name: set token for cytoinstaller(and remotes) to increase github API rate limit |
| 49 | + env: |
| 50 | + SUPER_SECRET: ${{ secrets.CYTOINSTALLER_TOKEN }} |
| 51 | + run: echo "GITHUB_TOKEN=$SUPER_SECRET" >> $GITHUB_ENV |
| 52 | + |
| 53 | + - name: Query dependencies |
| 54 | + run: | |
| 55 | + install.packages('remotes') |
| 56 | + saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) |
| 57 | + writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") |
| 58 | + shell: Rscript {0} |
| 59 | + |
| 60 | + - name: Get bioc ver |
| 61 | + run: echo "bioc_ver=$(Rscript -e 'writeLines(as.character(remotes::bioc_version()))')" >> $GITHUB_ENV |
| 62 | + shell: bash |
| 63 | + |
| 64 | + - name: Cache R packages |
| 65 | + if: runner.os != 'Windows' |
| 66 | + uses: actions/cache@v2 |
| 67 | + with: |
| 68 | + path: ${{ env.R_LIBS_USER }} |
| 69 | + key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} |
| 70 | + restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- |
| 71 | + |
| 72 | + - name: check bioc ver |
| 73 | + run: echo $bioc_ver |
| 74 | + shell: bash |
| 75 | + |
| 76 | + - name: Install system dependencies |
| 77 | + if: runner.os == 'Linux' |
| 78 | + run: | |
| 79 | + while read -r cmd |
| 80 | + do |
| 81 | + eval sudo $cmd |
| 82 | + done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "16.04"))') |
| 83 | + sudo apt-get install -y libcurl4-openssl-dev |
| 84 | +
|
| 85 | + - name: Install dependencies |
| 86 | + run: | |
| 87 | + remotes::install_cran(c("rcmdcheck", "devtools")) |
| 88 | + remotes::install_github("RGLab/cytoinstaller") |
| 89 | + cytoinstaller::cyto_install_deps(dependencies = TRUE) |
| 90 | + shell: Rscript {0} |
| 91 | + |
| 92 | + - name: check rate limit |
| 93 | + run: | |
| 94 | + gh::gh("GET /rate_limit")$resources$core$remaining |
| 95 | + shell: Rscript {0} |
| 96 | + |
| 97 | + - name: Check |
| 98 | + env: |
| 99 | + _R_CHECK_CRAN_INCOMING_REMOTE_: false |
| 100 | + run: rcmdcheck::rcmdcheck(args = c("--no-manual"), check_dir = "check") |
| 101 | + shell: Rscript {0} |
| 102 | + |
| 103 | + - name: Upload check results |
| 104 | + if: failure() |
| 105 | + uses: actions/upload-artifact@main |
| 106 | + with: |
| 107 | + name: ${{ runner.os }}-r${{ matrix.config.r }}-results |
| 108 | + path: check |
| 109 | + |
| 110 | + - name: build src pkg |
| 111 | + if: runner.os == 'Linux' |
| 112 | + run: devtools::build() |
| 113 | + shell: Rscript {0} |
| 114 | + |
| 115 | + - name: build bin pkg |
| 116 | + if: runner.os != 'Linux' |
| 117 | + run: devtools::build(binary = TRUE) |
| 118 | + shell: Rscript {0} |
| 119 | + |
| 120 | + - name: Upload Release Asset |
| 121 | + uses: svenstaro/upload-release-action@v2 |
| 122 | + with: |
| 123 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 124 | + file: '../*.${{ matrix.config.suffix }}' |
| 125 | + file_glob: true |
| 126 | + tag: bioc_${{ env.bioc_ver}} |
| 127 | + overwrite: true |
| 128 | + body: "This is my release text" |
0 commit comments