(core) run test:docker target prior to pushing grist-core image

Summary:
This activates the new tests that can run on a grist-core image,
and will not push a new version to `latest` tag unless those tests
pass.

This also runs a smoke test in the regular CI tests, to confirm the
code continues to work without GRIST_TEST_LOGIN enabled.

Test Plan: tested on a fork of grist-core

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3186
This commit is contained in:
Paul Fitzpatrick 2021-12-13 13:35:00 -05:00
parent 1ae586cf42
commit 65ac8aaa85
3 changed files with 37 additions and 3 deletions

View File

@ -15,11 +15,41 @@ jobs:
push_to_registry: push_to_registry:
name: Push latest Docker image to Docker Hub name: Push latest Docker image to Docker Hub
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7]
node-version: [10.x]
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: latest_candidate
- name: Prepare image but do not push it yet
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ${{ github.repository_owner }}/grist
tags: latest
push: false
- name: Use Node.js ${{ matrix.node-version }} for testing
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Set up Python ${{ matrix.python-version }} for testing - maybe not needed
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python packages
run: |
pip install virtualenv
yarn run install:python
- name: Install Node.js packages
run: yarn install
- name: Build Node.js code
run: yarn run build:prod
- name: Run tests
run: TEST_IMAGE=${{ github.repository_owner }}/grist VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:docker
- name: Push to Docker Hub - name: Push to Docker Hub
uses: docker/build-push-action@v1 uses: docker/build-push-action@v1
with: with:

View File

@ -41,7 +41,10 @@ jobs:
- name: Build Node.js code - name: Build Node.js code
run: yarn run build:prod run: yarn run build:prod
- name: Run tests - name: Run smoke test
run: VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:smoke
- name: Run main tests
run: VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test run: VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test
- name: Update candidate branch - name: Update candidate branch

View File

@ -19,12 +19,13 @@ DOCKER_CONTAINER=grist-core-test
DOCKER_PID="" DOCKER_PID=""
cleanup() { cleanup() {
return_value=$?
docker rm -f $DOCKER_CONTAINER docker rm -f $DOCKER_CONTAINER
if [ -n "$DOCKER_PID" ]; then if [ -n "$DOCKER_PID" ]; then
wait $DOCKER_PID || echo "docker container gone" wait $DOCKER_PID || echo "docker container gone"
fi fi
echo "Cleaned up docker container, bye." echo "Cleaned up docker container, bye."
exit 0 exit $return_value
} }
docker run --name $DOCKER_CONTAINER --rm \ docker run --name $DOCKER_CONTAINER --rm \
@ -33,7 +34,7 @@ docker run --name $DOCKER_CONTAINER --rm \
--env GRIST_SESSION_COOKIE=grist_test_cookie \ --env GRIST_SESSION_COOKIE=grist_test_cookie \
--env GRIST_TEST_LOGIN=1 \ --env GRIST_TEST_LOGIN=1 \
--env TEST_SUPPORT_API_KEY=api_key_for_support \ --env TEST_SUPPORT_API_KEY=api_key_for_support \
gristlabs/grist & ${TEST_IMAGE:-gristlabs/grist} &
DOCKER_PID="$!" DOCKER_PID="$!"