Skip to content

Commit

Permalink
ci: improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardoperra committed Aug 7, 2022
1 parent 61e2648 commit 6f7b493
Show file tree
Hide file tree
Showing 2 changed files with 164 additions and 56 deletions.
46 changes: 0 additions & 46 deletions .github/workflows/build-container.yml

This file was deleted.

174 changes: 164 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,85 @@ jobs:
- name: Lint
run: pnpm lint

build:
name: Build
build-packages:
name: Build packages
needs: install
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2.2.2
with:
version: 7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install

- name: Prisma migrate
run: |
cd apps/api
pnpm exec prisma generate
pnpm --filter=@codeimage/prisma-models build
- name: Build packages
run: |
pnpm libs:build
- name: Cache packages
uses: actions/cache@v3
with:
path: |
packages/highlight/dist
packages/locale/dist
packages/prisma-models/
packages/atomic-state/dist
packages/config/dist
packages/dom-export/dist
packages/ui/dist
key: packages-${{ github.run_id }}

build-app:
name: Build App
needs: build-packages
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2.2.2
with:
version: 7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install

- name: Restore dist
uses: actions/cache@v3
with:
path: |
packages/highlight/dist
packages/locale/dist
packages/prisma-models
packages/atomic-state/dist
packages/config/dist
packages/dom-export/dist
packages/ui/dist
key: packages-${{ github.run_id }}

- name: Build app
run: |
pnpm --filter=@codeimage/app build
build-api:
name: Build Api
needs: install
runs-on: ubuntu-latest

Expand All @@ -75,17 +152,84 @@ jobs:
- name: Build
run: |
pnpm build:prod
pnpm --filter=@codeimage/api build:ts
typecheck-app:
name: Typecheck app
needs: build-packages
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2.2.2
with:
version: 7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install

- name: Restore dist
uses: actions/cache@v3
with:
path: |
packages/highlight/dist
packages/locale/dist
packages/prisma-models
packages/atomic-state/dist
packages/config/dist
packages/dom-export/dist
packages/ui/dist
key: packages-${{ github.run_id }}

- name: Typecheck packages
run: |
pnpm --filter='@codeimage/app' typecheck
# TODO: fix
# - name: Typecheck
# run: |
# pnpm typecheck
typecheck-packages:
name: Typecheck packages
needs: build-packages
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2.2.2
with:
version: 7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install

- name: Restore dist
uses: actions/cache@v3
with:
path: |
packages/highlight/dist
packages/locale/dist
packages/prisma-models
packages/atomic-state/dist
packages/config/dist
packages/dom-export/dist
packages/ui/dist
key: packages-${{ github.run_id }}

- name: Typecheck packages
run: |
pnpm --filter='./packages/**' --recursive --parallel typecheck
be-test:
name: Test
name: Api test
needs: install
runs-on: ubuntu-latest
strategy:
fail-fast: false

services:
postgres:
Expand Down Expand Up @@ -127,8 +271,18 @@ jobs:
pnpm exec prisma generate
pnpm --filter=@codeimage/prisma-models build
- name: Typescript
run: pnpm --filter=@codeimage/api build:ts
- name: Restore dist
uses: actions/cache@v3
with:
path: |
packages/highlight/dist
packages/locale/dist
packages/prisma-models
packages/atomic-state/dist
packages/config/dist
packages/dom-export/dist
packages/ui/dist
key: packages-${{ github.run_id }}

- name: Test
run: pnpm --filter=@codeimage/api test
Expand Down

0 comments on commit 6f7b493

Please sign in to comment.