mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
run grist-core test batches in parallel (#444)
This sets up a framework for running tests in parallel. It increases the total time taken (since some steps are repeated) but reduces the turn-around time significantly overall. The main objective is to make it possible to release more test batches to grist-core without bringing CI to a crawl. The clever little test/split-test.js script is from the Grist Labs mono-repo and is Dmitry's work. I considered doing the build in one job, and copying it to test jobs, since it feels wasteful to repeat it. That may be worth trying, especially if we start getting jobs backing up (total concurrent Linux jobs on free plan is quoted at 20). It might also be worth looking at doing some tests in parallel on the same worker, perhaps using the relatively new MOCHA_WORKER_ID feature, since the tests are often not actually CPU or I/O bound.
This commit is contained in:
67
.github/workflows/main.yml
vendored
67
.github/workflows/main.yml
vendored
@@ -10,24 +10,35 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build_and_test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.9]
|
||||
node-version: [14.x]
|
||||
tests:
|
||||
- ':lint:python:client:common:smoke:'
|
||||
- ':server-1-of-2:'
|
||||
- ':server-2-of-2:'
|
||||
- ':nbrowser-1-of-5:'
|
||||
- ':nbrowser-2-of-5:'
|
||||
- ':nbrowser-3-of-5:'
|
||||
- ':nbrowser-4-of-5:'
|
||||
- ':nbrowser-5-of-5:'
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache: 'pip'
|
||||
|
||||
- name: Install Python packages
|
||||
run: |
|
||||
@@ -38,9 +49,11 @@ jobs:
|
||||
run: yarn install
|
||||
|
||||
- name: Run eslint
|
||||
if: contains(matrix.tests, ':lint:')
|
||||
run: yarn run lint:ci
|
||||
|
||||
- name: Make sure bucket is versioned
|
||||
if: contains(matrix.tests, ':server-')
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: administrator
|
||||
AWS_SECRET_ACCESS_KEY: administrator
|
||||
@@ -49,15 +62,27 @@ jobs:
|
||||
- name: Build Node.js code
|
||||
run: yarn run build:prod
|
||||
|
||||
|
||||
- name: Run smoke test
|
||||
if: contains(matrix.tests, ':smoke:')
|
||||
run: VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:smoke
|
||||
|
||||
- name: Run python tests
|
||||
if: contains(matrix.tests, ':python:')
|
||||
run: yarn run test:python
|
||||
|
||||
- name: Run client tests
|
||||
if: contains(matrix.tests, ':client:')
|
||||
run: yarn run test:client
|
||||
|
||||
- name: Run common tests
|
||||
if: contains(matrix.tests, ':common:')
|
||||
run: yarn run test:common
|
||||
|
||||
- name: Run server tests with minio and redis
|
||||
run: MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:server
|
||||
if: contains(matrix.tests, ':server-')
|
||||
run: |
|
||||
export TEST_SPLITS=$(echo $TESTS | sed "s/.*:server-\([^:]*\).*/\1/")
|
||||
MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:server
|
||||
env:
|
||||
GRIST_DOCS_MINIO_ACCESS_KEY: administrator
|
||||
GRIST_DOCS_MINIO_SECRET_KEY: administrator
|
||||
@@ -68,15 +93,12 @@ jobs:
|
||||
GRIST_DOCS_MINIO_BUCKET: grist-docs-test
|
||||
|
||||
- name: Run main tests without minio and redis
|
||||
run: MOCHA_WEBDRIVER_HEADLESS=1 yarn run test --exclude '_build/test/server/**/*'
|
||||
|
||||
- name: Update candidate branch
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
uses: ad-m/github-push-action@8407731efefc0d8f72af254c74276b7a90be36e1
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: latest_candidate
|
||||
force: true
|
||||
if: contains(matrix.tests, ':nbrowser-')
|
||||
run: |
|
||||
export TEST_SPLITS=$(echo $TESTS | sed "s/.*:nbrowser-\([^:]*\).*/\1/")
|
||||
MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:nbrowser
|
||||
env:
|
||||
TESTS: ${{ matrix.tests }}
|
||||
|
||||
services:
|
||||
# https://github.com/bitnami/bitnami-docker-minio/issues/16
|
||||
@@ -103,3 +125,18 @@ jobs:
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
candidate:
|
||||
needs: build_and_test
|
||||
if: ${{ success() && github.event_name == 'push' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Fetch new candidate branch
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Update candidate branch
|
||||
uses: ad-m/github-push-action@8407731efefc0d8f72af254c74276b7a90be36e1
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: latest_candidate
|
||||
force: true
|
||||
|
||||
Reference in New Issue
Block a user