build with env

This commit is contained in:
Elio Bischof
2024-10-16 18:22:55 +02:00
parent ca0e551dd5
commit be84e94926
4 changed files with 20 additions and 18 deletions

View File

@@ -12,23 +12,26 @@ jobs:
- name: Run Docker Compose and Install Dependencies in Parallel - name: Run Docker Compose and Install Dependencies in Parallel
run: | run: |
echo "Start docker-compose in the background" echo "Start docker-compose in the background"
docker compose -f ./acceptance/docker-compose.yaml up -d & docker compose -f ./acceptance/docker-compose.yaml up -d
DOCKER_COMPOSE_PID=$! DOCKER_COMPOSE_PID=$!
echo "Docker Compose PID: $DOCKER_COMPOSE_PID"
echo "Install node_modules in the foreground" echo "Install app dependencies in the foreground"
npm install -g pnpm && pnpm install npm install -g pnpm && pnpm install
echo "Generate and create a production build in the background" echo "Install Test Browsers in the background"
pnpm build &
GENERATE_BUILD_PID=$!
echo "Install Playwright with browsers in the background"
pnpm exec playwright install --with-deps & pnpm exec playwright install --with-deps &
PLAYWRIGHT_INSTALL_PID=$! INSTALL_BROWSERS_PID=$!
echo "Install browsers PID: $INSTALL_BROWSERS_PID"
echo "Wait for all background processes to complete" echo "Generate gRPC stubs in the background"
pnpm generate &
GENERATE_PID=$!
echo "Generate stubs PID: $GENERATE_PID"
echo "Wait for all background processes to finish"
while true; do while true; do
wait -n $DOCKER_COMPOSE_PID $GENERATE_BUILD_PID $PLAYWRIGHT_INSTALL_PID wait -n $DOCKER_COMPOSE_PID $INSTALL_BROWSERS_PID $GENERATE_PID
EXIT_STATUS=$? EXIT_STATUS=$?
if [ $EXIT_STATUS -ne 0 ]; then if [ $EXIT_STATUS -ne 0 ]; then
echo "A background process failed with exit code $EXIT_STATUS." echo "A background process failed with exit code $EXIT_STATUS."
@@ -36,11 +39,14 @@ jobs:
fi fi
# Check if all processes have finished # Check if all processes have finished
if ! kill -0 $DOCKER_COMPOSE_PID 2>/dev/null && \ if ! kill -0 $DOCKER_COMPOSE_PID 2>/dev/null && \
! kill -0 $GENERATE_BUILD_PID 2>/dev/null && \ ! kill -0 $INSTALL_BROWSERS_PID 2>/dev/null && \
! kill -0 $PLAYWRIGHT_INSTALL_PID 2>/dev/null; then ! kill -0 GENERATE_PID 2>/dev/null; then
break break
fi fi
done done
echo "Generate and create a production build in the foreground"
pnpm build
- name: Run Playwright Tests - name: Run Playwright Tests
run: pnpm exec playwright test run: pnpm exec playwright test
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4

View File

@@ -22,7 +22,6 @@
"lint:fix": "prettier --write .", "lint:fix": "prettier --write .",
"lint-staged": "lint-staged", "lint-staged": "lint-staged",
"build": "next build", "build": "next build",
"prestart": "pnpm build",
"start": "next start", "start": "next start",
"clean": "pnpm mock:destroy && rm -rf .turbo && rm -rf node_modules && rm -rf .next" "clean": "pnpm mock:destroy && rm -rf .turbo && rm -rf node_modules && rm -rf .next"
}, },

View File

@@ -6,9 +6,6 @@
"build": { "build": {
"outputs": [ "outputs": [
"dist/**" "dist/**"
],
"dependsOn": [
"@zitadel/proto#generate"
] ]
} }
} }

View File

@@ -75,7 +75,7 @@ export default defineConfig({
webServer: { webServer: {
command: 'pnpm start', command: 'pnpm start',
url: 'http://127.0.0.1:3000', url: 'http://127.0.0.1:3000',
reuseExistingServer: false, //!process.env.CI, reuseExistingServer: !process.env.CI,
timeout: 5 * 60_000, timeout: 5 * 60_000,
}, },
}); });