From 20a6f8aff72b6a5a41e5821bef096347cec14572 Mon Sep 17 00:00:00 2001 From: LTLA Date: Tue, 3 Dec 2024 12:57:18 -0800 Subject: [PATCH] Added actions for check and doc building. --- .github/workflows/build-pkgdown.yaml | 55 ++++++++++++++++++++++++++++ .github/workflows/r-cmd-check.yaml | 42 +++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 .github/workflows/build-pkgdown.yaml create mode 100644 .github/workflows/r-cmd-check.yaml diff --git a/.github/workflows/build-pkgdown.yaml b/.github/workflows/build-pkgdown.yaml new file mode 100644 index 0000000..1fba915 --- /dev/null +++ b/.github/workflows/build-pkgdown.yaml @@ -0,0 +1,55 @@ +on: + push: + branches: + - master + workflow_dispatch: + +name: Build pkgdown + +jobs: + build: + name: Build pkgdown + runs-on: ubuntu-latest + container: bioconductor/bioconductor_docker:devel + + steps: + - uses: actions/checkout@v4 + + - run: | + sudo apt-get update + sudo apt-get install -y rsync + + - uses: r-lib/actions/setup-pandoc@v2 + + - name: Set directories + run: | + echo "R_PKG_DIR=${R_HOME}/site-library" >> $GITHUB_ENV + + - name: Restore the package directory + uses: actions/cache@v4 + with: + path: ${{ env.R_PKG_DIR }} + key: pkgdown-packages + + - name: Install dependencies + shell: Rscript {0} + run: | + stuff <- read.dcf("DESCRIPTION") + stuff <- stuff[,intersect(colnames(stuff), c("Imports", "LinkingTo", "Suggests", "Depends"))] + deps <- sub(" .*", "", unlist(strsplit(stuff, ",\\s*"), use.names=FALSE)) + BiocManager::install(c("pkgdown", deps)) + + - name: Install self + run: R CMD INSTALL . + + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} + + - name: Deploy to GitHub pages 🚀 + uses: JamesIves/github-pages-deploy-action@v4 + with: + clean: false + branch: gh-pages + folder: docs + diff --git a/.github/workflows/r-cmd-check.yaml b/.github/workflows/r-cmd-check.yaml new file mode 100644 index 0000000..a98116c --- /dev/null +++ b/.github/workflows/r-cmd-check.yaml @@ -0,0 +1,42 @@ +on: + push: + branches: + - master + pull_request: + +name: R CMD check + +jobs: + check: + name: R CMD check + runs-on: ubuntu-latest + container: bioconductor/bioconductor_docker:devel + + steps: + - uses: actions/checkout@v4 + + - name: Set directories + run: | + echo "R_PKG_DIR=${R_HOME}/site-library" >> $GITHUB_ENV + + - name: Restore the package directory + uses: actions/cache@v4 + with: + path: ${{ env.R_PKG_DIR }} + key: check-packages + + - name: Install dependencies + shell: Rscript {0} + run: | + stuff <- read.dcf("DESCRIPTION") + stuff <- stuff[,intersect(colnames(stuff), c("Imports", "LinkingTo", "Suggests", "Depends"))] + deps <- sub(" .*", "", unlist(strsplit(stuff, ",\\s*"), use.names=FALSE)) + BiocManager::install(deps) + + - name: Build the package + run: R CMD build . + + - name: Check the package + run: | + tarball=$(ls *.tar.gz) + R CMD check --no-manual $tarball