-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (72 loc) · 2.66 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Publish Docker image to DockerHub
on:
push:
branches:
- develop
jobs:
perform_pytest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install http
pip install pytest
pip install fastapi.testclient
pip install request
#if [ -f requirements.txt ]; then cat requirements.txt | xargs -n 1 pip install; fi #pip install -r requirements.txt; fi
- name: Lint with Ruff
run: |
pip install ruff
ruff --format=github --target-version=py310 .
continue-on-error: true
- name: Test with pytest
run: |
coverage run -m pytest ./tests/api_test/ -v -s
- name: Generate Coverage Report
run: |
coverage report -m
push_app_to_registry:
name: Push APP Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: 1 Copy repository
uses: actions/checkout@v2
- name: 2 Docker login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: 3 Build APP IMAGE
run: docker build -t app -f ./src/app/backend/dockerfile_api .
- name: 4 Tag
run: |
docker tag app ${{ secrets.DOCKER_USER }}/app:${{ github.sha }}
docker tag app ${{ secrets.DOCKER_USER }}/app:latest
- name: 5 SPush
run: |
docker push ${{ secrets.DOCKER_USER }}/app:${{ github.sha }}
docker push ${{ secrets.DOCKER_USER }}/app:latest
push_web_to_registry:
name: Push WEB Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: 1 Copy repository
uses: actions/checkout@v2
- name: 2 Docker login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: 3 Build APP IMAGE
run: docker build -t web -f ./src/app/frontend/dockerfile_web .
- name: 4 Tag
run: |
docker tag web ${{ secrets.DOCKER_USER }}/web:${{ github.sha }}
docker tag web ${{ secrets.DOCKER_USER }}/web:latest
- name: 5 SPush
run: |
docker push ${{ secrets.DOCKER_USER }}/web:${{ github.sha }}
docker push ${{ secrets.DOCKER_USER }}/web:latest