Skip to content

Commit

Permalink
Fix build and test env in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
solomonhawk committed Nov 2, 2024
1 parent e6ea501 commit 4534cd5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
types: [opened, synchronize]

env:
API_PROXY_URL: ${{ vars.API_PROXY_URL }}
PUBLIC_API_BASE_URL: ${{ vars.PUBLIC_API_BASE_URL }}

jobs:
build:
name: Build and Test
Expand All @@ -17,6 +21,14 @@ jobs:
with:
fetch-depth: 2

- name: Cache turbo build setup
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- uses: jetli/wasm-pack-action@v0.4.0
with:
version: "latest"
Expand All @@ -38,9 +50,6 @@ jobs:

- name: Build
run: npm run build
env:
API_PROXY_URL: ${{ vars.API_PROXY_URL }}
PUBLIC_API_BASE_URL: ${{ vars.PUBLIC_API_BASE_URL }}

- name: Test
run: npm run test
3 changes: 2 additions & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite --clearScreen false --force --open",
"build": "tsc && vite build",
"prebuild": "tsc",
"build": "vite build",
"preview": "vite preview",
"lint": "eslint \"src/**/*.{ts,tsx}\" --max-warnings 0",
"lint:fix": "eslint --fix \"src/**/*.{ts,tsx}\" --max-warnings 0",
Expand Down
10 changes: 8 additions & 2 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
{
"$schema": "https://turbo.build/schema.json",
"ui": "tui",
"globalEnv": ["PORT", "DATABASE_URL"],
"globalEnv": ["DATABASE_URL"],
"globalDependencies": [".env"],
"tasks": {
"dev": {
"cache": false,
"persistent": true,
"inputs": [".env"],
"env": ["DEV", "PROD", "DATABASE_URL"]
"env": ["DEV", "PORT", "DATABASE_URL"]
},
"build": {
"dependsOn": ["^build"],
"inputs": ["$TURBO_DEFAULT$", ".env*"],
"outputs": ["dist/**", "web/dist/**"]
},
"web#build": {
"env": ["API_PROXY_URL", "PUBLIC_API_BASE_URL"]
},
"preview": {
"cache": false,
"persistent": true,
Expand All @@ -32,6 +35,9 @@
"test": {
"cache": false
},
"web#test": {
"env": ["API_PROXY_URL", "PUBLIC_API_BASE_URL"]
},
"test:watch": {
"cache": false,
"persistent": true,
Expand Down

0 comments on commit 4534cd5

Please sign in to comment.