workflows: build the grist-oss, grist, and grist-ee images

This modifies the workflow to build grist-ee images as well as grist,
which is the same image as grist-ee but merely renamed. The original
image built by these workflows is now called grist-oss.
pull/1066/head
Jordi Gutiérrez Hermoso 3 months ago committed by jordigh
parent bc52f65b26
commit 70ed8553b3

@ -8,17 +8,31 @@ on:
jobs: jobs:
push_to_registry: push_to_registry:
name: Push Docker image to Docker Hub name: Push Docker images to Docker Hub
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
image:
- name: "grist-oss"
repo: "grist-core"
- name: "grist"
repo: "grist-ee"
- name: "grist-ee"
repo: "grist-ee"
steps: steps:
- name: Check out the repo - name: Check out the repo
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Check out the ext/ directory
if: matrix.image.name != 'grist-oss'
run: buildtools/checkout-ext-directory.sh ${{ matrix.image.repo }}
- name: Docker meta - name: Docker meta
id: meta id: meta
uses: docker/metadata-action@v4 uses: docker/metadata-action@v4
with: with:
images: | images: |
${{ github.repository_owner }}/grist ${{ github.repository_owner }}/${{ matrix.image.name }}
tags: | tags: |
type=ref,event=branch type=ref,event=branch
type=ref,event=pr type=ref,event=pr
@ -28,13 +42,16 @@ jobs:
stable stable
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- name: Log in to Docker Hub - name: Log in to Docker Hub
uses: docker/login-action@v1 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to Docker Hub - name: Push to Docker Hub
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
@ -44,3 +61,5 @@ jobs:
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
build-contexts: ${{ matrix.image.name != 'grist-oss' && 'ext=ext' || '' }}

@ -10,6 +10,12 @@ on:
# Run at 5:41 UTC daily # Run at 5:41 UTC daily
- cron: '41 5 * * *' - cron: '41 5 * * *'
workflow_dispatch: workflow_dispatch:
inputs:
latest_branch:
description: Branch from which to create the latest Docker image (default: latest_candidate)
type: string
required: true
default_value: latest_candidate
jobs: jobs:
push_to_registry: push_to_registry:
@ -19,54 +25,84 @@ jobs:
matrix: matrix:
python-version: [3.9] python-version: [3.9]
node-version: [18.x] node-version: [18.x]
image:
- name: "grist-oss"
repo: "grist-core"
- name: "grist"
repo: "grist-ee"
- name: "grist-ee"
repo: "grist-ee"
steps: steps:
- name: Check out the repo - name: Check out the repo
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
ref: latest_candidate ref: ${{ inputs.latest_branch }}
- name: Check out the ext/ directory
if: matrix.image.name != 'grist-oss'
run: buildtools/checkout-ext-directory.sh ${{ matrix.image.repo }}
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- name: Prepare image but do not push it yet - name: Prepare image but do not push it yet
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: . context: .
load: true load: true
tags: ${{ github.repository_owner }}/grist:latest tags: ${{ github.repository_owner }}/${{ matrix.image.name }}:experimental
cache-from: type=gha cache-from: type=gha
build-contexts: ${{ matrix.image.name != 'grist-oss' && 'ext=ext' || '' }}
- name: Use Node.js ${{ matrix.node-version }} for testing - name: Use Node.js ${{ matrix.node-version }} for testing
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
- name: Set up Python ${{ matrix.python-version }} for testing - maybe not needed - name: Set up Python ${{ matrix.python-version }} for testing - maybe not needed
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Install Python packages - name: Install Python packages
run: | run: |
pip install virtualenv pip install virtualenv
yarn run install:python yarn run install:python
- name: Install Node.js packages - name: Install Node.js packages
run: yarn install run: yarn install
- name: Build Node.js code - name: Build Node.js code
run: yarn run build:prod run: |
pushd ext && \
{ if [ -e package.json ] ; then yarn install --frozen-lockfile --modules-folder=../../node_modules; fi } && \
popd
yarn run build:prod
- name: Run tests - name: Run tests
run: TEST_IMAGE=${{ github.repository_owner }}/grist VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:docker run: TEST_IMAGE=${{ github.repository_owner }}/${{ matrix.image.name }} VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:docker
- name: Log in to Docker Hub - name: Log in to Docker Hub
uses: docker/login-action@v1 uses: docker/login-action@v1
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to Docker Hub - name: Push to Docker Hub
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64/v8 platforms: linux/amd64,linux/arm64/v8
push: true push: true
tags: ${{ github.repository_owner }}/grist:latest tags: ${{ github.repository_owner }}/${{ matrix.image.name }}:experimental
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
build-contexts: ${{ matrix.image.name != 'grist-oss' && 'ext=ext' || '' }}
- name: Update latest branch - name: Update latest branch
uses: ad-m/github-push-action@8407731efefc0d8f72af254c74276b7a90be36e1 uses: ad-m/github-push-action@8407731efefc0d8f72af254c74276b7a90be36e1
with: with:

Loading…
Cancel
Save