-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #149 from rstudio/add-cron
add a daily cron
- Loading branch information
Showing
3 changed files
with
140 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
which: | ||
description: "Which images to build. Default 'all'. Options: 'all','rstudio-workbench-preview','rstudio-connect-preview','rstudio-connect-content-init-preview','r-session-complete-preview'. Can also use a prefix (i.e. 'rstudio-connect') to trigger multiple image builds." | ||
required: true | ||
default: "all" | ||
version: | ||
description: "The version to build. Default 'auto'. Can use any string, but must have which != 'all' if using something other than 'auto'" | ||
required: false | ||
default: "auto" | ||
|
||
name: build/test/push (preview) | ||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
name: build-${{ matrix.config.tag_prefix}}${{ matrix.config.product}} | ||
if: ${{ (github.events.inputs.which == 'all' || startsWith(matrix.config.product, github.events.inputs.which) ) && (github.events.inputs.version == 'auto' || github.events.inputs.which != 'all') }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- {product: 'rstudio-workbench-preview', dir: 'server-pro', prefix: RSP, os: 'bionic/amd64', version: 'daily'} | ||
- {product: 'rstudio-workbench-preview', dir: 'server-pro', prefix: RSP, os: 'bionic/amd64', version: 'preview'} | ||
- {product: 'rstudio-connect-preview', dir: 'connect', prefix: RSC, version: 'daily'} | ||
- {product: 'rstudio-connect-content-init-preview', dir: 'connect-content-init', prefix: RSC, version: 'daily'} | ||
- {product: 'r-session-complete-preview', tag_prefix: 'bionic-', dir: 'r-session-complete/bionic', os: 'bionic/amd64', prefix: RSP, version: 'daily'} | ||
- {product: 'r-session-complete-preview', tag_prefix: 'centos7-', dir: 'r-session-complete/centos7', os: 'centos7/x86_64', prefix: RSP, version: 'daily'} | ||
- {product: 'r-session-complete-preview', tag_prefix: 'bionic-', dir: 'r-session-complete/bionic', os: 'bionic/amd64', prefix: RSP, version: 'preview'} | ||
- {product: 'r-session-complete-preview', tag_prefix: 'centos7-', dir: 'r-session-complete/centos7', os: 'centos7/x86_64', prefix: RSP, version: 'preview'} | ||
|
||
steps: | ||
- name: Check Out Repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Get version | ||
id: version | ||
run: | | ||
# NOTE: --local ensures that "latest" builds use the version in our Makefile (instead of latest from the web) | ||
VERSION=`./get-version.py ${{ matrix.config.product }} --type=${{ matrix.config.version }} --local --override=${{ github.events.inputs.version }}` | ||
echo "::set-output name=VERSION::${VERSION}" | ||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Build | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./${{ matrix.config.dir }} | ||
file: ./${{ matrix.config.dir }}/Dockerfile | ||
builder: ${{ steps.buildx.outputs.name }} | ||
tags: | | ||
rstudio/${{ matrix.config.product }}:${{ matrix.config.tag_prefix }}${{ matrix.config.version }} | ||
rstudio/${{ matrix.config.product }}:${{ matrix.config.tag_prefix }}${{ steps.version.outputs.VERSION }} | ||
ghcr.io/rstudio/${{ matrix.config.product }}:${{ matrix.config.tag_prefix }}${{ matrix.config.version }} | ||
ghcr.io/rstudio/${{ matrix.config.product }}:${{ matrix.config.tag_prefix }}${{ steps.version.outputs.VERSION }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
load: true | ||
push: false | ||
build-args: | | ||
RSP_VERSION=${{ steps.version.outputs.VERSION }} | ||
RSC_VERSION=${{ steps.version.outputs.VERSION }} | ||
RSPM_VERSION=${{ steps.version.outputs.VERSION }} | ||
# TODO: need a better way to handle pivoting DOWNLOAD_URL for OS | ||
RSP_DOWNLOAD_URL=https://s3.amazonaws.com/rstudio-ide-build/server/${{ matrix.config.os }} | ||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} | ||
|
||
- name: Show image size | ||
run: | | ||
docker image ls | ||
- name: Test image | ||
env: | ||
IMAGE_NAME: rstudio/${{ matrix.config.product }}:${{ matrix.config.tag_prefix }}${{ matrix.config.version }} | ||
# because we cannot dynamically set env var names... set them all... | ||
RSP_VERSION: ${{ steps.version.outputs.VERSION }} | ||
RSC_VERSION: ${{ steps.version.outputs.VERSION }} | ||
RSPM_VERSION: ${{ steps.version.outputs.VERSION }} | ||
run: | | ||
docker-compose -f ./${{ matrix.config.dir }}/docker-compose.test.yml run sut | ||
- name: Login to Docker Hub | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
- name: Login to ghcr.io | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.BUILD_PAT }} | ||
|
||
- name: Push image(s) to Docker Hub | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
run: | | ||
docker push rstudio/${{ matrix.config.product }}:${{ matrix.config.tag_prefix }}${{ matrix.config.version }} | ||
docker push rstudio/${{ matrix.config.product }}:${{ matrix.config.tag_prefix }}${{ steps.version.outputs.VERSION }} | ||
docker push ghcr.io/rstudio/${{ matrix.config.product }}:${{ matrix.config.tag_prefix }}${{ matrix.config.version }} | ||
docker push ghcr.io/rstudio/${{ matrix.config.product }}:${{ matrix.config.tag_prefix }}${{ steps.version.outputs.VERSION }} |
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
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