Skip to content

Commit 3957457

Browse files
committed
Trying to cypress orb
1 parent 5e4a463 commit 3957457

File tree

1 file changed

+26
-66
lines changed

1 file changed

+26
-66
lines changed

.circleci/config.yml

Lines changed: 26 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,36 @@
11
version: 2.1
22

33
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-
- run:
43-
name: Build and start Docker Compose services
44-
command: bash ./build_github.sh
45-
46-
- run:
47-
name: Check service ports
48-
command: |
49-
docker ps --format "table {{.Names}}\t{{.Ports}}"
50-
docker compose ps
51-
52-
- run:
53-
name: Wait for services
54-
command: sleep 2
55-
56-
- cypress/run-tests:
57-
working-directory: test
58-
cypress-command: npx cypress run --config pageLoadTimeout=100000,baseUrl=http://localhost:8089
59-
60-
- store_artifacts:
61-
path: build
62-
destination: build
63-
64-
- run:
65-
name: Tear down Docker Compose services
66-
command: docker-compose down
67-
when: always
4+
cypress: cypress-io/[email protected]
685

696
workflows:
70-
version: 2
717
test-workflow:
728
jobs:
73-
- test:
9+
- cypress/run:
10+
executor: cypress/default
11+
steps:
12+
- run:
13+
name: Build and start Docker Compose services
14+
command: bash ./build_github.sh
15+
- run:
16+
name: Wait for service to be ready
17+
command: |
18+
timeout=300
19+
while ! curl -s http://localhost:8089 > /dev/null; do
20+
timeout=$((timeout - 1))
21+
if [ $timeout -le 0 ]; then
22+
echo "Service failed to start within 5 minutes"
23+
exit 1
24+
fi
25+
sleep 1
26+
done
27+
working-directory: test
28+
cypress-command: npx cypress run --config pageLoadTimeout=100000,baseUrl=http://localhost:8089
29+
post-steps:
30+
- run:
31+
name: Tear down Docker Compose services
32+
command: docker-compose down
33+
when: always
7434
filters:
7535
branches:
7636
only:

0 commit comments

Comments
 (0)