variables: - &node_image "node:22-alpine" - &playwright_image "mcr.microsoft.com/playwright:v1.59.1-jammy" - &branch "master" # Spustit na všech větvích a pull requestech. # Docker build probíhá jen na master větvi (viz when: v posledních krocích). when: - event: [push, pull_request] services: redis: image: redis/redis-stack-server:7.2.0-RC3 environment: REDIS_ARGS: "--save '' --loglevel warning" steps: - name: Generate TypeScript types image: *node_image commands: - cd types - yarn install --frozen-lockfile - yarn openapi-ts - name: Install server dependencies image: *node_image commands: - cd server - yarn install --frozen-lockfile depends_on: [Generate TypeScript types] - name: Install client dependencies image: *node_image commands: - cd client - yarn install --frozen-lockfile depends_on: [Generate TypeScript types] - name: Install e2e dependencies image: *playwright_image commands: - cd e2e - yarn install --frozen-lockfile depends_on: [Generate TypeScript types] - name: Server unit tests image: *node_image environment: NODE_ENV: test JWT_SECRET: test-secret-min-32-chars-aaaaaaa! MOCK_DATA: "true" STORAGE: json commands: - cd server - yarn test depends_on: [Install server dependencies] - name: Build server image: *node_image commands: - cd server - yarn build depends_on: [Install server dependencies] - name: Build client image: *node_image commands: - cd client - yarn build depends_on: [Install client dependencies] - name: Playwright E2E tests image: *playwright_image environment: CI: "true" NODE_ENV: test JWT_SECRET: test-secret-min-32-chars-aaaaaaa! MOCK_DATA: "true" STORAGE: redis REDIS_HOST: redis REDIS_PORT: "6379" HTTP_REMOTE_USER_ENABLED: "true" HTTP_REMOTE_USER_HEADER_NAME: remote-user HTTP_REMOTE_TRUSTED_IPS: "0.0.0.0/0,::/0" commands: # Zkopírujeme build klienta do server/public, aby Express mohl SPA servírovat - cp -r client/dist server/public - cd e2e - yarn playwright install firefox --with-deps - yarn test depends_on: [Build server, Build client, Install e2e dependencies] - name: Build Docker image depends_on: [Build server, Build client] image: woodpeckerci/plugin-docker-buildx when: - event: push branch: *branch settings: dockerfile: Dockerfile-Woodpecker platforms: linux/amd64 registry: from_secret: REPO_URL username: from_secret: REPO_USERNAME password: from_secret: REPO_PASSWORD repo: from_secret: REPO_NAME - name: Discord notification - build image: appleboy/drone-discord depends_on: [Build Docker image] when: - status: [success, failure] event: push branch: *branch settings: webhook_id: from_secret: DISCORD_WEBHOOK_ID webhook_token: from_secret: DISCORD_WEBHOOK_TOKEN message: "{{#success build.status}}✅ Sestavení {{build.number}} proběhlo úspěšně.{{else}}❌ Sestavení {{build.number}} selhalo.{{/success}}\n\nPipeline: {{build.link}}\nPoslední commit: {{commit.message}}Autor: {{commit.author}}"