generated from Yandex-Practicum/architecture-pro-cinemaabyss
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (59 loc) · 1.77 KB
/
api-tests.yml
File metadata and controls
71 lines (59 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: API Tests
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
inputs:
environment:
description: 'Environment to run tests against'
required: true
default: 'docker'
type: choice
options:
- local
- docker
test_folder:
description: 'Test folder to run (leave empty for all)'
required: false
type: string
jobs:
api-tests:
name: Run API Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Compose
run: |
docker compose --version
- name: Start services with Docker Compose
run: |
docker compose up -d
# Wait for services to be ready
echo "Waiting for services to be ready..."
sleep 120
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: tests/postman/package-lock.json
- name: Install Newman and dependencies
working-directory: tests/postman
run: npm install
- name: Run API tests
working-directory: tests/postman
run: |
docker compose up -d
# Wait for services to be ready
echo "Waiting for services to be ready..."
sleep 15
# Build the Docker image
docker build -t cinemaabyss-api-tests .
# Run the tests in Docker
docker run --network=cinemaabyss-network -v "$(pwd)/reports:/app/reports" cinemaabyss-api-tests
- name: Stop services
if: always()
run: docker compose down