Browse Source

refactor(workflows): simplify workflow & use pnpm store

pull/5903/head
Wing-Kam Wong 1 year ago
parent
commit
e37099369d
  1. 61
      .github/workflows/ci-cd.yml
  2. 12
      .github/workflows/playwright-test-workflow.yml
  3. 20
      .github/workflows/release-executables.yml
  4. 24
      .github/workflows/release-timely-executables.yml
  5. 13
      .github/workflows/unit-test.yml
  6. 6
      .github/workflows/update-sdk-path.yml

61
.github/workflows/ci-cd.yml

@ -45,28 +45,20 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Cache node modules - name: Get pnpm store directory
uses: actions/cache@v3 shell: bash
env: run: |
cache-name: cache-node-modules echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with: with:
# pnpm cache files are stored in `~/.pnpm` on Linux/macOS path: ${{ env.STORE_PATH }}
path: ~/.pnpm key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: | restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-pnpm-store-
${{ runner.os }}-build- - name: Install dependencies for packages
${{ runner.os }}- run: pnpm bootstrap
- name: install dependencies nocodb-sdk
working-directory: ./packages/nocodb-sdk
run: pnpm install
- name: build nocodb-sdk
working-directory: ./packages/nocodb-sdk
run: pnpm run build:main
- name: Install dependencies - name: Install dependencies
working-directory: ./packages/nocodb
run: pnpm install
- name: run unit tests - name: run unit tests
working-directory: ./packages/nocodb working-directory: ./packages/nocodb
run: pnpm run test:unit run: pnpm run test:unit
@ -87,19 +79,17 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Cache node modules - name: Get pnpm store directory
uses: actions/cache@v3 shell: bash
env: run: |
cache-name: cache-node-modules echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with: with:
# pnpm cache files are stored in `~/.pnpm` on Linux/macOS path: ${{ env.STORE_PATH }}
path: ~/.pnpm key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: | restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-pnpm-store-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Set CI env - name: Set CI env
run: export CI=true run: export CI=true
- name: Set NC Edition - name: Set NC Edition
@ -107,15 +97,8 @@ jobs:
- name: setup pg - name: setup pg
working-directory: ./ working-directory: ./
run: docker-compose -f ./tests/playwright/scripts/docker-compose-playwright-pg.yml up -d & run: docker-compose -f ./tests/playwright/scripts/docker-compose-playwright-pg.yml up -d &
- name: install dependencies nocodb-sdk - name: install dependencies
working-directory: ./packages/nocodb-sdk run: pnpm bootstrap
run: pnpm install
- name: build nocodb-sdk
working-directory: ./packages/nocodb-sdk
run: pnpm run build:main
- name: Install dependencies
working-directory: ./packages/nocodb
run: pnpm install
- name: run unit tests - name: run unit tests
working-directory: ./packages/nocodb working-directory: ./packages/nocodb
run: pnpm run test:unit:pg run: pnpm run test:unit:pg

12
.github/workflows/playwright-test-workflow.yml

@ -57,12 +57,8 @@ jobs:
run: export CI=true run: export CI=true
- name: Set NC Edition - name: Set NC Edition
run: export EE=true run: export EE=true
- name: install dependencies nocodb-sdk - name: install dependencies
working-directory: ./packages/nocodb-sdk run: pnpm bootstrap
run: pnpm install
- name: Build nocodb-sdk
working-directory: ./packages/nocodb-sdk
run: pnpm run build
- name: Setup mysql - name: Setup mysql
if: ${{ inputs.db == 'mysql' }} if: ${{ inputs.db == 'mysql' }}
working-directory: ./packages/nocodb/tests/mysql-sakila-db working-directory: ./packages/nocodb/tests/mysql-sakila-db
@ -90,24 +86,20 @@ jobs:
if: ${{ inputs.db == 'sqlite' }} if: ${{ inputs.db == 'sqlite' }}
working-directory: ./packages/nocodb working-directory: ./packages/nocodb
run: | run: |
pnpm install
pnpm run watch:run:playwright &> ${{ inputs.db }}_${{ inputs.shard }}_test_backend.log & pnpm run watch:run:playwright &> ${{ inputs.db }}_${{ inputs.shard }}_test_backend.log &
- name: Run backend:mysql - name: Run backend:mysql
if: ${{ inputs.db == 'mysql' }} if: ${{ inputs.db == 'mysql' }}
working-directory: ./packages/nocodb working-directory: ./packages/nocodb
run: | run: |
pnpm install
pnpm run watch:run:playwright:mysql &> ${{ inputs.db }}_${{ inputs.shard }}_test_backend.log & pnpm run watch:run:playwright:mysql &> ${{ inputs.db }}_${{ inputs.shard }}_test_backend.log &
- name: Run backend:pg - name: Run backend:pg
if: ${{ inputs.db == 'pg' }} if: ${{ inputs.db == 'pg' }}
working-directory: ./packages/nocodb working-directory: ./packages/nocodb
run: | run: |
pnpm install
pnpm run watch:run:playwright:pg &> ${{ inputs.db }}_${{ inputs.shard }}_test_backend.log & pnpm run watch:run:playwright:pg &> ${{ inputs.db }}_${{ inputs.shard }}_test_backend.log &
- name: Install dependencies - name: Install dependencies
if: steps.playwright-cache.outputs.cache-hit != 'true' if: steps.playwright-cache.outputs.cache-hit != 'true'
working-directory: ./tests/playwright working-directory: ./tests/playwright
run: pnpm install
- name: Install Playwright Browsers - name: Install Playwright Browsers
working-directory: ./tests/playwright working-directory: ./tests/playwright
run: pnpm exec playwright install --with-deps chromium run: pnpm exec playwright install --with-deps chromium

20
.github/workflows/release-executables.yml

@ -22,19 +22,17 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Cache node modules - name: Get pnpm store directory
id: cache-npm shell: bash
uses: actions/cache@v3 run: |
env: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
cache-name: cache-node-modules - uses: actions/cache@v3
name: Setup pnpm cache
with: with:
# npm cache files are stored in `~/.npm` on Linux/macOS path: ${{ env.STORE_PATH }}
path: ~/.npm key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: | restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-pnpm-store-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache pkg modules - name: Cache pkg modules
id: cache-pkg id: cache-pkg

24
.github/workflows/release-timely-executables.yml

@ -29,19 +29,17 @@ jobs:
with: with:
token: ${{ secrets.NC_GITHUB_TOKEN }} token: ${{ secrets.NC_GITHUB_TOKEN }}
repository: 'nocodb/nocodb-timely' repository: 'nocodb/nocodb-timely'
- name: Cache node modules - name: Get pnpm store directory
id: cache-pnpm shell: bash
uses: actions/cache@v3 run: |
env: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
cache-name: cache-node-modules - uses: actions/cache@v3
name: Setup pnpm cache
with: with:
# pnpm cache files are stored in `~/.pnpm` on Linux/macOS path: ${{ env.STORE_PATH }}
path: ~/.pnpm key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: | restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-pnpm-store-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache pkg modules - name: Cache pkg modules
id: cache-pkg id: cache-pkg
uses: actions/cache@v3 uses: actions/cache@v3
@ -68,7 +66,7 @@ jobs:
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 18
- name: Update nocodb-timely - name: Update nocodb-timely
env: env:
@ -86,7 +84,7 @@ jobs:
- name : Install dependencies and build executables - name : Install dependencies and build executables
run: | run: |
# install pnpm dependendencies # install pnpm dependendencies
pnpm i pnpm bootstrap
# Copy sqlite binaries # Copy sqlite binaries
# rsync -rvzhP ./binaries/binding/ ./node_modules/sqlite3/lib/binding/ # rsync -rvzhP ./binaries/binding/ ./node_modules/sqlite3/lib/binding/

13
.github/workflows/unit-test.yml

@ -20,7 +20,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [16.x] node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps: steps:
@ -34,15 +34,8 @@ jobs:
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: 'pnpm' cache: 'pnpm'
- name: install dependencies nocodb-sdk - name: install dependencies
working-directory: ./packages/nocodb-sdk run: pnpm bootstrap
run: pnpm install --frozen-lockfile
- name: build nocodb-sdk
working-directory: ./packages/nocodb-sdk
run: pnpm run build:main
- name: install dependencies nocodb
working-directory: ./packages/nocodb
run: pnpm install --frozen-lockfile
- name: run unit tests - name: run unit tests
working-directory: ./packages/nocodb working-directory: ./packages/nocodb
run: pnpm run unit-test run: pnpm run unit-test

6
.github/workflows/update-sdk-path.yml

@ -23,11 +23,7 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- run: | - run: |
cd packages/nocodb pnpm bootstrap
pnpm install --ignore-scripts nocodb-sdk
cd ../..
cd packages/nc-gui
pnpm install --ignore-scripts nocodb-sdk
- name: Create Pull Request - name: Create Pull Request
id: cpr id: cpr

Loading…
Cancel
Save