2021-04-12 19:25:34 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ main ]
|
|
|
|
pull_request:
|
|
|
|
branches: [ main ]
|
|
|
|
|
|
|
|
# Allows running this workflow manually from the Actions tab
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
2023-03-03 14:53:33 +00:00
|
|
|
build_and_test:
|
2021-04-12 19:25:34 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
2023-06-27 06:11:08 +00:00
|
|
|
# it is helpful to know which sets of tests would have succeeded,
|
|
|
|
# even when there is a failure.
|
|
|
|
fail-fast: false
|
2021-04-12 19:25:34 +00:00
|
|
|
matrix:
|
2022-09-06 15:46:52 +00:00
|
|
|
python-version: [3.9]
|
2022-03-28 19:43:47 +00:00
|
|
|
node-version: [14.x]
|
2023-03-03 14:53:33 +00:00
|
|
|
tests:
|
|
|
|
- ':lint:python:client:common:smoke:'
|
|
|
|
- ':server-1-of-2:'
|
|
|
|
- ':server-2-of-2:'
|
2023-06-27 06:11:08 +00:00
|
|
|
- ':nbrowser-^[A-G]:'
|
|
|
|
- ':nbrowser-^[H-L]:'
|
|
|
|
- ':nbrowser-^[M-O]:'
|
|
|
|
- ':nbrowser-^[P-S]:'
|
|
|
|
- ':nbrowser-^[^A-S]:'
|
2021-04-12 19:25:34 +00:00
|
|
|
steps:
|
2023-03-03 14:53:33 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-04-12 19:25:34 +00:00
|
|
|
|
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
2023-03-03 14:53:33 +00:00
|
|
|
uses: actions/setup-node@v3
|
2021-04-12 19:25:34 +00:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node-version }}
|
2023-03-03 14:53:33 +00:00
|
|
|
cache: 'yarn'
|
2021-04-12 19:25:34 +00:00
|
|
|
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
2023-03-03 14:53:33 +00:00
|
|
|
uses: actions/setup-python@v4
|
2021-04-12 19:25:34 +00:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
2023-03-03 14:53:33 +00:00
|
|
|
cache: 'pip'
|
2021-04-12 19:25:34 +00:00
|
|
|
|
|
|
|
- name: Install Python packages
|
|
|
|
run: |
|
|
|
|
pip install virtualenv
|
|
|
|
yarn run install:python
|
|
|
|
|
|
|
|
- name: Install Node.js packages
|
|
|
|
run: yarn install
|
|
|
|
|
2022-12-27 18:59:42 +00:00
|
|
|
- name: Run eslint
|
2023-03-03 14:53:33 +00:00
|
|
|
if: contains(matrix.tests, ':lint:')
|
2022-12-27 18:59:42 +00:00
|
|
|
run: yarn run lint:ci
|
|
|
|
|
2022-12-22 17:58:39 +00:00
|
|
|
- name: Make sure bucket is versioned
|
2023-03-03 14:53:33 +00:00
|
|
|
if: contains(matrix.tests, ':server-')
|
2022-12-22 17:58:39 +00:00
|
|
|
env:
|
|
|
|
AWS_ACCESS_KEY_ID: administrator
|
|
|
|
AWS_SECRET_ACCESS_KEY: administrator
|
|
|
|
run: aws --region us-east-1 --endpoint-url http://localhost:9000 s3api put-bucket-versioning --bucket grist-docs-test --versioning-configuration Status=Enabled
|
|
|
|
|
2021-04-12 19:25:34 +00:00
|
|
|
- name: Build Node.js code
|
|
|
|
run: yarn run build:prod
|
|
|
|
|
2021-12-13 18:35:00 +00:00
|
|
|
- name: Run smoke test
|
2023-03-03 14:53:33 +00:00
|
|
|
if: contains(matrix.tests, ':smoke:')
|
2022-08-10 12:16:27 +00:00
|
|
|
run: VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:smoke
|
2021-12-13 18:35:00 +00:00
|
|
|
|
2022-10-03 06:10:32 +00:00
|
|
|
- name: Run python tests
|
2023-03-03 14:53:33 +00:00
|
|
|
if: contains(matrix.tests, ':python:')
|
2022-10-03 06:10:32 +00:00
|
|
|
run: yarn run test:python
|
|
|
|
|
2023-03-03 14:53:33 +00:00
|
|
|
- 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
|
|
|
|
|
2022-12-22 17:58:39 +00:00
|
|
|
- name: Run server tests with minio and redis
|
2023-03-03 14:53:33 +00:00
|
|
|
if: contains(matrix.tests, ':server-')
|
|
|
|
run: |
|
|
|
|
export TEST_SPLITS=$(echo $TESTS | sed "s/.*:server-\([^:]*\).*/\1/")
|
|
|
|
MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:server
|
2022-12-22 17:58:39 +00:00
|
|
|
env:
|
|
|
|
GRIST_DOCS_MINIO_ACCESS_KEY: administrator
|
|
|
|
GRIST_DOCS_MINIO_SECRET_KEY: administrator
|
|
|
|
TEST_REDIS_URL: "redis://localhost/11"
|
|
|
|
GRIST_DOCS_MINIO_USE_SSL: 0
|
|
|
|
GRIST_DOCS_MINIO_ENDPOINT: localhost
|
|
|
|
GRIST_DOCS_MINIO_PORT: 9000
|
|
|
|
GRIST_DOCS_MINIO_BUCKET: grist-docs-test
|
|
|
|
|
|
|
|
- name: Run main tests without minio and redis
|
2023-03-03 14:53:33 +00:00
|
|
|
if: contains(matrix.tests, ':nbrowser-')
|
|
|
|
run: |
|
2023-06-27 06:11:08 +00:00
|
|
|
export GREP_TESTS=$(echo $TESTS | sed "s/.*:nbrowser-\([^:]*\).*/\1/")
|
|
|
|
MOCHA_WEBDRIVER_SKIP_CLEANUP=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:nbrowser --parallel --jobs 3
|
2023-03-03 14:53:33 +00:00
|
|
|
env:
|
|
|
|
TESTS: ${{ matrix.tests }}
|
2022-12-22 17:58:39 +00:00
|
|
|
|
|
|
|
services:
|
|
|
|
# https://github.com/bitnami/bitnami-docker-minio/issues/16
|
|
|
|
minio:
|
|
|
|
image: bitnami/minio:latest
|
|
|
|
env:
|
|
|
|
MINIO_DEFAULT_BUCKETS: "grist-docs-test:public"
|
|
|
|
MINIO_ROOT_USER: administrator
|
|
|
|
MINIO_ROOT_PASSWORD: administrator
|
|
|
|
ports:
|
|
|
|
- 9000:9000
|
|
|
|
options: >-
|
|
|
|
--health-cmd "curl -f http://localhost:9000/minio/health/ready"
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
|
|
|
|
redis:
|
|
|
|
image: redis
|
|
|
|
ports:
|
|
|
|
- 6379:6379
|
|
|
|
options: >-
|
|
|
|
--health-cmd "redis-cli ping"
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
2023-03-03 14:53:33 +00:00
|
|
|
|
|
|
|
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
|