mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 21:47:17 +00:00
167 lines
5.6 KiB
YAML
167 lines
5.6 KiB
YAML
name: CI
|
|
# Controls when the workflow will run
|
|
on:
|
|
push:
|
|
branches: [develop, main]
|
|
pull_request:
|
|
types: [labeled, opened, synchronize, reopened]
|
|
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main') && github.run_number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
FORCE_COLOR: true
|
|
NODE_OPTIONS: "--max-old-space-size=4096"
|
|
LOCKBOX_MASTER_KEY: lockbox-master-key
|
|
SECRET_KEY_BASE: secrret-key-base
|
|
NODE_ENV: test
|
|
PG_HOST: postgres
|
|
PG_PORT: 5432
|
|
PG_USER: postgres
|
|
PG_PASS: postgres
|
|
PG_DB: tooljet_test
|
|
|
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
if: |
|
|
contains(github.event.pull_request.labels.*.name, 'run-ci') ||
|
|
github.ref == 'refs/heads/main' ||
|
|
github.ref == 'refs/heads/develop'
|
|
|
|
steps:
|
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Use Node.js 18.3.0
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18.3.0
|
|
|
|
- name: Cache node modules
|
|
uses: actions/cache@v3
|
|
env:
|
|
cache-name: cache-node-modules
|
|
with:
|
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
${{ runner.os }}-build-
|
|
${{ runner.os }}-
|
|
|
|
- run: npm run build
|
|
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
if: |
|
|
contains(github.event.pull_request.labels.*.name, 'run-ci') ||
|
|
github.ref == 'refs/heads/main' ||
|
|
github.ref == 'refs/heads/develop'
|
|
steps:
|
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Use Node.js 18.3.0
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18.3.0
|
|
|
|
- name: Cache node modules
|
|
uses: actions/cache@v3
|
|
env:
|
|
cache-name: cache-node-modules
|
|
with:
|
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
${{ runner.os }}-build-
|
|
${{ runner.os }}-
|
|
|
|
- run: npm run build:plugins
|
|
- run: npm --prefix frontend ci && npm --prefix server ci && npm --prefix plugins ci
|
|
- run: npm --prefix server run lint && npm --prefix frontend run lint && npm --prefix plugins run lint
|
|
|
|
unit-test:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
container: node:18.3.0-buster
|
|
services:
|
|
postgres:
|
|
image: postgres
|
|
env:
|
|
POSTGRES_PASSWORD: postgres
|
|
# Set health checks to wait until postgres has started
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Cache node modules
|
|
uses: actions/cache@v3
|
|
env:
|
|
cache-name: cache-node-modules
|
|
with:
|
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
${{ runner.os }}-build-
|
|
${{ runner.os }}-
|
|
- run: apt update && apt install -y postgresql
|
|
- run: npm --prefix plugins ci
|
|
- run: npm --prefix plugins run create:client && npm --prefix plugins run create:server
|
|
- run: npm --prefix plugins run build:packages && npm --prefix plugins run build:server
|
|
- run: npm --prefix server ci
|
|
- run: npm --prefix server run db:create
|
|
- run: npm --prefix server run db:migrate
|
|
- run: npm --prefix server run test
|
|
|
|
e2e-test:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
container: node:18.3.0-buster
|
|
services:
|
|
postgres:
|
|
image: postgres
|
|
env:
|
|
POSTGRES_PASSWORD: postgres
|
|
# Set health checks to wait until postgres has started
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Cache node modules
|
|
uses: actions/cache@v3
|
|
env:
|
|
cache-name: cache-node-modules
|
|
with:
|
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
${{ runner.os }}-build-
|
|
${{ runner.os }}-
|
|
- run: apt update && apt install -y postgresql
|
|
- run: npm --prefix plugins ci
|
|
- run: npm --prefix plugins run create:client && npm --prefix plugins run create:server
|
|
- run: npm --prefix plugins run build:packages && npm --prefix plugins run build:server
|
|
- run: npm --prefix server ci
|
|
- run: npm --prefix server run db:create
|
|
- run: npm --prefix server run db:migrate
|
|
- run: NODE_OPTIONS=--max_old_space_size=8096 npm --prefix server run test:e2e -- --silent --testTimeout=20000
|