From 4534cd52d00bdbb13d27f7abeb902d51d2dd2fef Mon Sep 17 00:00:00 2001 From: Solomon Hawk Date: Sat, 2 Nov 2024 11:25:25 -0400 Subject: [PATCH] Fix build and test env in CI --- .github/workflows/ci.yml | 15 ++++++++++++--- apps/web/package.json | 3 ++- turbo.json | 10 ++++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 407ec06..2dba9e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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" @@ -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 diff --git a/apps/web/package.json b/apps/web/package.json index cfbbfd3..d9d8350 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -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", diff --git a/turbo.json b/turbo.json index 5fbe1e1..df5790c 100644 --- a/turbo.json +++ b/turbo.json @@ -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, @@ -32,6 +35,9 @@ "test": { "cache": false }, + "web#test": { + "env": ["API_PROXY_URL", "PUBLIC_API_BASE_URL"] + }, "test:watch": { "cache": false, "persistent": true,