Skip to content

Commit

Permalink
feat: support postgres db (#177)
Browse files Browse the repository at this point in the history
* feat: support postgres db

* fix: postgres install date time

* fix: unit test

* chore: yarn.lock

* feat: add Makefile script

* chore: merge conflicts

* test: integration tests

* chore(deps): update yarn to v4.0.0-rc.42

---------

Co-authored-by: pengap <[email protected]>
  • Loading branch information
Pengap and Pengap authored Oct 8, 2023
1 parent 8d022dc commit 4c27e38
Show file tree
Hide file tree
Showing 143 changed files with 12,388 additions and 9,890 deletions.
9 changes: 6 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# All node_modules directories
node_modules
**/node_modules
dist

# All secrets
**/.env.local
Expand Down Expand Up @@ -34,8 +35,8 @@ tsconfig.tsbuildinfo
# Docker related
.dockerignore
Dockerfile
docker-compose.*.yml
docker-compose.yml
dockers/docker-compose.*.yml
dockers/docker-compose.yml
docker

# Log files
Expand All @@ -47,6 +48,8 @@ tmp
*.tmp

# IDE related

.idea
.vscode

# other
.DS_Store
8 changes: 4 additions & 4 deletions .github/actions/yarn-nm-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ runs:
using: 'composite'

steps:
- name: Expose yarn config as "$GITHUB_OUTPUT"
- name: ⚙️ Expose yarn config as "$GITHUB_OUTPUT"
id: yarn-config
shell: bash
run: |
echo "CACHE_FOLDER=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
# Yarn rotates the downloaded cache archives, @see https://github.com/actions/setup-node/issues/325
# Yarn cache is also reusable between arch and os.
- name: Restore yarn cache
- name: ♻️ Restore yarn cache
uses: actions/cache@v3
id: yarn-download-cache
with:
Expand All @@ -43,14 +43,14 @@ runs:
yarn-download-cache-
# Save install_state (invalidated on yarn.lock changes)
- name: Restore yarn install state
- name: ♻️ Restore yarn install state
id: yarn-install-state-cache
uses: actions/cache@v3
with:
path: .yarn/ci-cache/
key: ${{ runner.os }}-yarn-install-state-cache-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}

- name: Install dependencies
- name: 📥 Install dependencies
shell: bash
run: |
yarn install --immutable --inline-builds
Expand Down
File renamed without changes.
40 changes: 40 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Integration Tests

on:
push:
branches:
- develop
pull_request:
branches:
- develop

jobs:
build:
runs-on: ubuntu-latest
name: Integration Tests

strategy:
fail-fast: false
matrix:
node-version: [18.x]
database-type: [postgres, sqlite]

steps:
- uses: actions/checkout@v4

- name: ♻️ Restore docker layer cache
uses: satackey/[email protected]
continue-on-error: true
with:
key: ${{ runner.os }}-docker-cache-${{ hashFiles('packages/**.[jt]sx?', 'apps/**.[jt]sx?') }}
restore-keys: |
${{ runner.os }}-docker-cache-
- name: 🧪 Run Tests
run: |
make ${{ matrix.database-type }}.integration.test
- name: ⛔ Stop Database(s)
run: |
make docker.down
if: matrix.database-type != 'sqlite'
52 changes: 52 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Linting and Types

on:
push:
branches:
- develop
pull_request:
branches:
- develop

jobs:
build:
runs-on: ubuntu-latest
name: Linting and Types

strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: 📥 Monorepo install
uses: ./.github/actions/yarn-nm-install

- name: ♻️ Restore packages cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/.cache
${{ github.workspace }}/**/tsconfig.tsbuildinfo
key: ${{ runner.os }}-packages-cache-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/**.[jt]sx?', 'packages/**.json') }}
restore-keys: |
${{ runner.os }}-packages-cache-${{ hashFiles('**/yarn.lock') }}-
- name: 🏗 Run build
run: |
yarn workspaces foreach -tv --exclude '@teable-group/(app|backend)' run build
- name: 🕵️ Typecheck
run: |
yarn workspaces foreach -tv --include '@teable-group/*' run typecheck
- name: 🔬 Linter
run: |
yarn workspaces foreach -tv --include '@teable-group/*' run lint
yarn workspaces foreach -tv --include '@teable-group/*' run lint-styles
47 changes: 47 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Unit Tests

on:
push:
branches:
- develop
pull_request:
branches:
- develop

jobs:
build:
runs-on: ubuntu-latest
name: Unit Tests

strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: 📥 Monorepo install
uses: ./.github/actions/yarn-nm-install

- name: ♻️ Restore packages cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/.cache
${{ github.workspace }}/**/tsconfig.tsbuildinfo
key: ${{ runner.os }}-packages-cache-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/**.[jt]sx?', 'packages/**.json') }}
restore-keys: |
${{ runner.os }}-packages-cache-${{ hashFiles('**/yarn.lock') }}-
- name: 🏗 Run build
run: |
yarn workspaces foreach -tv --exclude '@teable-group/(app|backend)' run build
- name: 🧪 Run Tests
run: |
yarn workspaces foreach -tv --include '@teable-group/*' run test-unit
28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.1.cjs

This file was deleted.

876 changes: 876 additions & 0 deletions .yarn/releases/yarn-4.0.0-rc.42.cjs

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ nodeLinker: node-modules

npmRegistryServer: 'https://registry.npmjs.org/'

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'

supportedArchitectures:
cpu:
- current
os:
- current
libc:
- current

yarnPath: .yarn/releases/yarn-3.6.1.cjs
yarnPath: .yarn/releases/yarn-4.0.0-rc.42.cjs
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ WORKDIR /workspace-install

COPY yarn.lock .yarnrc.yml ./
COPY .yarn/ ./.yarn/
COPY sh/ ./sh/
COPY scripts/ ./scripts/

# Specific to monerepo's as docker COPY command is pretty limited
# we use buidkit to prepare all files that are necessary for install
Expand Down Expand Up @@ -81,7 +81,7 @@ COPY --from=deps /workspace-install ./

# Optional: if the app depends on global /static shared assets like images, locales...
RUN yarn workspace @teable-group/app share-static-hardlink && yarn g:build
RUN yarn workspace @teable-group/db-main-prisma prisma-db-push
RUN yarn workspace @teable-group/db-main-prisma prisma-generate
# Does not play well with buildkit on CI
# https://github.com/moby/buildkit/issues/1673
RUN SKIP_POSTINSTALL=1 \
Expand Down
Loading

0 comments on commit 4c27e38

Please sign in to comment.