-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (50 loc) · 1.58 KB
/
main.yml
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
name: CI/CD Pipeline
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
services:
docker:
image: docker:latest
options: --privileged
ports:
- 5432:5432
- 27017:27017
- 5000:5000
- 5001:5001
- 5002:5002
- 5003:5003
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker images
run: |
docker build -t docker.io/prajjwalyd/api:latest ./api
docker build -t docker.io/prajjwalyd/url-shortener:latest ./url-shortener
docker build -t docker.io/prajjwalyd/qr-code-generator:latest ./qr-code-generator
docker build -t docker.io/prajjwalyd/analytics:latest ./analytics
- name: Start services
run: docker-compose up -d
- name: Run integration tests
run: |
pip install requests
python test_integration.py
- name: Tear down services
run: docker-compose down
- name: Push Docker images
if: success()
run: |
docker push docker.io/prajjwalyd/api:latest
docker push docker.io/prajjwalyd/url-shortener:latest
docker push docker.io/prajjwalyd/qr-code-generator:latest
docker push docker.io/prajjwalyd/analytics:latest