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
run: |
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=$!
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
echo "Generate and create a production build in the background"
pnpm build &
GENERATE_BUILD_PID=$!
echo "Install Playwright with browsers in the background"
echo "Install Test Browsers in the background"
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
wait -n $DOCKER_COMPOSE_PID $GENERATE_BUILD_PID $PLAYWRIGHT_INSTALL_PID
wait -n $DOCKER_COMPOSE_PID $INSTALL_BROWSERS_PID $GENERATE_PID
EXIT_STATUS=$?
if [ $EXIT_STATUS -ne 0 ]; then
echo "A background process failed with exit code $EXIT_STATUS."
@@ -36,11 +39,14 @@ jobs:
fi
# Check if all processes have finished
if ! kill -0 $DOCKER_COMPOSE_PID 2>/dev/null && \
! kill -0 $GENERATE_BUILD_PID 2>/dev/null && \
! kill -0 $PLAYWRIGHT_INSTALL_PID 2>/dev/null; then
! kill -0 $INSTALL_BROWSERS_PID 2>/dev/null && \
! kill -0 GENERATE_PID 2>/dev/null; then
break
fi
done
echo "Generate and create a production build in the foreground"
pnpm build
- name: Run Playwright Tests
run: pnpm exec playwright test
- uses: actions/upload-artifact@v4

View File

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

View File

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

View File

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