Skip to content

Commit

Permalink
ci: improve typecheck without bundle phase
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardoperra committed Aug 10, 2022
1 parent f8735ee commit ce65b55
Show file tree
Hide file tree
Showing 15 changed files with 80 additions and 83 deletions.
117 changes: 53 additions & 64 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,53 @@ jobs:
- name: Lint
run: pnpm lint

typecheck-packages:
if: ${{ needs.install.outputs.libs-change == 'true' }}
name: Typecheck 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: Typecheck packages
run: |
pnpm --filter='./packages/**' --recursive typecheck:ci
typecheck-app:
if: (${{ needs.install.outputs.app-change == 'true' }} || ${{ needs.install.outputs.libs-change == 'true' }})
name: Typecheck app
needs: [ typecheck-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: Typecheck packages
run: |
pnpm --filter='@codeimage/app' typecheck
build-packages:
name: Build packages
needs: [ install ]
Expand Down Expand Up @@ -186,67 +233,6 @@ jobs:
restore-keys: rest-api-bundle-${{ github.run_id }}


typecheck-app:
if: (${{ needs.install.outputs.app-change == 'true' }} || ${{ needs.install.outputs.libs-change == 'true' }})
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
key: packages-${{ github.run_id }}

- name: Typecheck packages
run: |
pnpm --filter='@codeimage/app' typecheck
typecheck-packages:
if: ${{ needs.install.outputs.libs-change == 'true' }}
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
key: packages-${{ github.run_id }}

- name: Typecheck packages
run: |
pnpm --filter='./packages/**' --recursive --parallel typecheck
be-test:
if: ${{ needs.install.outputs.backend-change == 'true' }}
name: Api test
Expand Down Expand Up @@ -310,8 +296,8 @@ jobs:
# lint,
# build-app,
build-api,
# typecheck-packages,
# typecheck-app,
typecheck-packages,
# typecheck-app,
# be-test
]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -339,7 +325,10 @@ jobs:
- name: Deploy
run: |
cd dist/api-bundle
ls
rm -rf .gitignore
touch .gitignore
npm i
ls -al
railway up
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
Expand Down
6 changes: 2 additions & 4 deletions apps/api/Dockerfile.next
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ ENV NODE_ENV=production

ARG CACHEBUST=0

COPY . /app

RUN npm install
RUN ls

ARG CACHEBUST=1
COPY . /app

RUN ls

Expand Down
9 changes: 9 additions & 0 deletions dist/api-bundle/Dockerfile.next
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:18-alpine

ENV NODE_ENV=production

COPY . .

RUN ls

EXPOSE 3000
1 change: 1 addition & 0 deletions packages/atomic-state/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"build-esm": "tsc -p tsconfig.esm.json",
"build-dts": "tsc -p tsconfig.dts.json",
"typecheck": "tsc --noEmit --skipLibCheck --project tsconfig.json",
"typecheck:ci": "tsc --skipLibCheck --project tsconfig.dts.json",
"dev": "chokidar \"src/**/*.{ts,tsx}\" -c \"pnpm build\""
},
"peerDependencies": {
Expand Down
2 changes: 0 additions & 2 deletions packages/atomic-state/tsconfig.dts.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"outDir": "./dist/types"
}
}

3 changes: 2 additions & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"clean": "rimraf dist",
"build-esm": "tsc -p tsconfig.esm.json",
"build-dts": "tsc -p tsconfig.dts.json",
"typecheck": "tsc --noEmit --skipLibCheck --project tsconfig.json",
"typecheck": "tsc --noEmit --skipLibCheck --project tsconfig.dts.json",
"typecheck:ci": "tsc --skipLibCheck --project tsconfig.dts.json",
"dev": "chokidar \"src/**/*.{ts,tsx}\" -c \"pnpm build\""
},
"dependencies": {
Expand Down
4 changes: 1 addition & 3 deletions packages/config/tsconfig.dts.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"declarationMap": false,
"outDir": "./dist/types"
}
}

3 changes: 2 additions & 1 deletion packages/dom-export/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
],
"scripts": {
"lint": "eslint . --ext .js,.jsx,.mjs,.ts,.tsx -c ../../.eslintrc.js",
"build": "vite build"
"build": "vite build",
"typecheck:ci": "tsc --skipLibCheck --project tsconfig.dts.json"
},
"lint-staged": {
"**/*.{js,jsx,tsx,ts,less,md,json}": [
Expand Down
2 changes: 2 additions & 0 deletions packages/dom-export/src/lib/util.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import * as process from 'process';
import {Options} from './options';

Expand Down
3 changes: 1 addition & 2 deletions packages/dom-export/tsconfig.dts.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"outDir": "./dist/types"
"outDir": "./dist"
}
}

1 change: 1 addition & 0 deletions packages/highlight/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"build-esm": "tsc -p tsconfig.esm.json",
"build-dts": "tsc -p tsconfig.dts.json",
"typecheck": "tsc --noEmit --skipLibCheck --project tsconfig.json",
"typecheck:ci": "tsc --skipLibCheck --project tsconfig.dts.json",
"dev": "chokidar \"src/**/*.{ts,tsx}\" -c \"pnpm build\""
},
"dependencies": {
Expand Down
5 changes: 2 additions & 3 deletions packages/highlight/tsconfig.dts.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"declarationMap": false,
"emitDeclarationOnly": true,
"outDir": "./dist/types"
"outDir": "./dist"
}
}

1 change: 1 addition & 0 deletions packages/locale/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"build-esm": "tsc -p tsconfig.esm.json",
"build-dts": "tsc -p tsconfig.dts.json",
"typecheck": "tsc --noEmit --skipLibCheck --project tsconfig.json",
"typecheck:ci": "tsc --skipLibCheck --project tsconfig.dts.json",
"dev": "chokidar \"src/**/*.{ts,tsx}\" -c \"pnpm build\""
},
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/locale/tsconfig.dts.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"outDir": "./dist/types"
"outDir": "./dist"
}
}

3 changes: 2 additions & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"pre-commit-eslint": "eslint --ext .js,.jsx,.mjs,.ts,.tsx -c ../../.eslintrc.js --fix",
"lint": "eslint . --ext .js,.jsx,.mjs,.ts,.tsx -c ../../.eslintrc.js",
"clean": "rimraf dist",
"typecheck": "tsc --noEmit --skipLibCheck --project tsconfig.json"
"typecheck": "tsc --noEmit --skipLibCheck --project tsconfig.json",
"typecheck:ci": "tsc --skipLibCheck --project tsconfig.dts.json"
},
"peerDependencies": {
"@floating-ui/core": "^0.7.3",
Expand Down

0 comments on commit ce65b55

Please sign in to comment.