try to handle imports #15
This file contains 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
name: Check, build, and push image | |
on: [push, pull_request] | |
env: | |
cache-version: v1 | |
jobs: | |
r-build-and-check: | |
runs-on: ubuntu-latest | |
container: bioconductor/bioconductor_docker:devel | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Query dependencies and update old packages | |
run: | | |
BiocManager::install(ask=FALSE) | |
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) | |
shell: Rscript {0} | |
- name: Cache R packages | |
if: runner.os != 'Windows' | |
uses: actions/cache@v1 | |
with: | |
path: /usr/local/lib/R/site-library | |
key: ${{ env.cache-version }}-${{ runner.os }}-r-${{ hashFiles('.github/depends.Rds') }} | |
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-r- | |
# This lets us augment with additional dependencies | |
- name: Install system dependencies | |
if: runner.os == 'Linux' | |
env: | |
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc | |
run: | | |
Rscript -e "remotes::install_github('r-hub/sysreqs')" | |
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))") | |
sudo -s eval "$sysreqs" | |
- name: Install dependencies | |
run: | | |
BiocManager::repositories() | |
remotes::install_deps(dependencies = TRUE, repos = BiocManager::repositories()) | |
remotes::install_cran("rcmdcheck") | |
shell: Rscript {0} | |
- name: Check | |
env: | |
_R_CHECK_CRAN_INCOMING_REMOTE_: false | |
run: rcmdcheck::rcmdcheck(args = c("--no-manual"), error_on = "warning", check_dir = "check") | |
shell: Rscript {0} | |
- name: Build pkgdown | |
run: | | |
PATH=$PATH:$HOME/bin/ Rscript -e 'pkgdown::build_site(".")' | |
# deploy needs rsync? Seems so. | |
- name: Install deploy dependencies | |
run: | | |
apt-get update | |
apt-get -y install rsync | |
- name: Deploy 🚀 | |
uses: JamesIves/github-pages-deploy-action@releases/v4 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: gh-pages # The branch the action should deploy to. | |
FOLDER: docs # The folder the action should deploy. | |
docker-build-and-push: | |
#needs: r-build-and-check | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
# This is used to complete the identity challenge | |
# with sigstore/fulcio when running outside of PRs. | |
id-token: write | |
steps: | |
- name: Free root space | |
uses: almahmoud/free-root-space@main | |
with: | |
verbose: true | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set Environment Variables | |
run: | | |
REPO_LOWER="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')" | |
REGISTRY=ghcr.io | |
echo "BUILD_DATE=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV | |
echo "GIT_SHA=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV | |
echo "REGISTRY=${REGISTRY}" >> $GITHUB_ENV | |
echo "IMAGE=${REGISTRY}/${REPO_LOWER}" >> $GITHUB_ENV | |
- name: Show environment | |
run: | | |
env | |
# Install the cosign tool except on PR | |
# https://github.com/sigstore/cosign-installer | |
- name: Install cosign | |
if: github.event_name != 'pull_request' | |
uses: sigstore/cosign-installer@1e95c1de343b5b0c23352d6417ee3e48d5bcd422 | |
with: | |
cosign-release: 'v1.4.0' | |
# Workaround: https://github.com/docker/build-push-action/issues/461 | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf | |
# Login against a Docker registry except on PR | |
# https://github.com/docker/login-action | |
- name: Log into registry ${{ env.REGISTRY }} | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Extract metadata (tags, labels) for Docker | |
# https://github.com/docker/metadata-action | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | |
with: | |
images: ${{ env.IMAGE }} | |
# Build and push Docker image with Buildx (don't push on PR) | |
# https://github.com/docker/build-push-action | |
- name: Build and push Docker image | |
id: build-and-push | |
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: | | |
${{ env.IMAGE }}:latest | |
${{ env.IMAGE }}:${{ env.GIT_SHA }} | |