ToolJet/.github/workflows/ci.yml
Muhsin Shah C P 53d119680f
[chore] Node-module vulnerabilities (#8226)
* started working on node upgrade to 18.18.2

* testing ci

* updated ci node version

* updated action code

* deleted all package-lock.json files

* deleted and ovverrided some packages

* deleted and fixed server & frontend vulnerabilities

* updated firestore version

* fix: ws type issue

* fix: upgraded lerna version

* regenerated package-lock.json files again

* regenerated marketplace lock file

* updated node version in other ci and docker files

* update: lock file plugin side

* updated the npm version in docker & ci files

* removed unused imports from events file

* removed dependency-review action

* updated some packages

* tried to go with current node-module of jest. had to upgrade

* fix: deprecated function usage - ts-jest

* fix: server directory lint issues

* fixed login page issue after router-dom upgrade

* updated import/no-unresolved rule to ignore import errors of  react-loading-skeleton, react-spring packages

* fix: cypress node version & package-lock issue

* regenerated cli package-lock.json

* fix: new webpack version might cause runtime issues (had issues with enterprise). lets use old version only

* fix: form-data docker issue

* removed comment
2023-12-21 11:55:35 +05:30

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.18.2
uses: actions/setup-node@v3
with:
node-version: 18.18.2
- 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.18.2
uses: actions/setup-node@v3
with:
node-version: 18.18.2
- 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.18.2-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.18.2-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