-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (81 loc) · 3.3 KB
/
ci-tests.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: CI Tests
on:
push:
workflow_dispatch:
jobs:
build-and-test-frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build frontend Docker container
run: |
cd ./frontend/
docker compose --env-file .env.dev up --build -d
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push frontend Docker images
run: |
docker tag dps_training_k-frontend ghcr.io/hpi-sam/dps_training_k-frontend:dev
docker push ghcr.io/hpi-sam/dps_training_k-frontend:dev
build-and-test-backend:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build backend Docker containers
run: |
cd ./backend/dps_training_k/
docker compose --env-file .env.dev up --build -d
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push backend Docker images
run: |
docker tag dps_training_k-django ghcr.io/hpi-sam/dps_training_k-django:dev
docker push ghcr.io/hpi-sam/dps_training_k-django:dev
docker tag dps_training_k-celeryworker ghcr.io/hpi-sam/dps_training_k-celeryworker:dev
docker push ghcr.io/hpi-sam/dps_training_k-celeryworker:dev
docker tag dps_training_k-celerybeat ghcr.io/hpi-sam/dps_training_k-celerybeat:dev
docker push ghcr.io/hpi-sam/dps_training_k-celerybeat:dev
docker tag dps_training_k-nginx ghcr.io/hpi-sam/dps_training_k-nginx:dev
docker push ghcr.io/hpi-sam/dps_training_k-nginx:dev
docker tag dps_training_k-postgres ghcr.io/hpi-sam/dps_training_k-postgres:dev
docker push ghcr.io/hpi-sam/dps_training_k-postgres:dev
# Skip redis as it is just the public Docker Hub image anyway and therefore should be directly pulled from there
- name: Run backend tests
run: docker exec K-dPS-django python3 manage.py test
test-integration:
needs: [build-and-test-frontend, build-and-test-backend]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run docker containers with deploy dev configuration
run: |
cp backend/dps_training_k/deployment/nginx/nginx_deploy_dev.conf ./nginx_dev.conf
docker compose -f docker-compose.dev.yml up -d
- name: Run integration tests
run: |
cd ./frontend/
npm install cypress --save-dev
npx cypress run --e2e