|
| 1 | +version: 2.1 |
| 2 | + |
| 3 | +orbs: |
| 4 | + docker: circleci/[email protected] |
| 5 | + cypress: cypress-io/[email protected] |
| 6 | + |
| 7 | +parameters: |
| 8 | + GH_TOKEN: |
| 9 | + type: string |
| 10 | + default: ${GH_TOKEN} |
| 11 | + |
| 12 | +executors: |
| 13 | + docker-executor: |
| 14 | + docker: |
| 15 | + - image: cimg/base:2024.01 |
| 16 | + environment: |
| 17 | + FRONTEND_REPO_URL: "github.com/perfetti/react1-app.git" |
| 18 | + BACKEND_REPO_URL: "github.com/perfetti/react2-app.git" |
| 19 | + API_REPO_URL: "github.com/perfetti/rails-app.git" |
| 20 | + FRONTEND_REF: "main" |
| 21 | + BACKEND_REF: "main" |
| 22 | + API_REF: "main" |
| 23 | + FRONTEND_PUBLIC_URL: "//localhost:8089/" |
| 24 | + BACKEND_PUBLIC_URL: "//localhost:8089/backend/" |
| 25 | + WDS_SOCKET_PORT: "8089" |
| 26 | + POSTGRES_USER: "postgres" |
| 27 | + POSTGRES_PASSWORD: "postgres" |
| 28 | + POSTGRES_DB: "perfetti" |
| 29 | + RAILS_HOST: "api" |
| 30 | + RAILS_ENV: "test" |
| 31 | + DATABASE_HOST: "db" |
| 32 | + DATABASE_USERNAME: "postgres" |
| 33 | + RAILS_RELATIVE_URL_ROOT: "/api" |
| 34 | + |
| 35 | +jobs: |
| 36 | + test: |
| 37 | + machine: |
| 38 | + image: ubuntu-2204:2023.10.1 |
| 39 | + steps: |
| 40 | + - checkout |
| 41 | + |
| 42 | + - docker/install-docker-compose: |
| 43 | + version: "2.14.2" |
| 44 | + |
| 45 | + - run: |
| 46 | + name: Build and start Docker Compose services |
| 47 | + command: bash ./build_github.sh |
| 48 | + |
| 49 | + - run: |
| 50 | + name: Check DNS and network |
| 51 | + command: | |
| 52 | + cat /etc/hosts |
| 53 | + netstat -tulpn |
| 54 | +
|
| 55 | + - run: |
| 56 | + name: Check service ports |
| 57 | + command: | |
| 58 | + docker ps --format "table {{.Names}}\t{{.Ports}}" |
| 59 | + docker compose ps |
| 60 | +
|
| 61 | + - run: |
| 62 | + name: Wait for services |
| 63 | + command: sleep 2 |
| 64 | + |
| 65 | + - cypress/run-tests: |
| 66 | + working-directory: test |
| 67 | + cypress-command: npx cypress run --config pageLoadTimeout=100000,baseUrl=http://localhost:8089 |
| 68 | + |
| 69 | + - store_artifacts: |
| 70 | + path: build |
| 71 | + destination: build |
| 72 | + |
| 73 | + - run: |
| 74 | + name: Tear down Docker Compose services |
| 75 | + command: docker-compose down |
| 76 | + when: always |
| 77 | + |
| 78 | +workflows: |
| 79 | + version: 2 |
| 80 | + test-workflow: |
| 81 | + jobs: |
| 82 | + - test: |
| 83 | + filters: |
| 84 | + branches: |
| 85 | + only: |
| 86 | + - main |
0 commit comments