Skip to content

Commit 9d67756

Browse files
authored
Lab3
1 parent 098ecd5 commit 9d67756

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: python-app
2+
3+
on:
4+
push:
5+
paths:
6+
- '.github/workflows/app-python-ci.yaml'
7+
- 'app_python/**'
8+
9+
defaults:
10+
run:
11+
working-directory: ./app_python
12+
13+
jobs:
14+
checks:
15+
runs-on: ubuntu-22.04
16+
permissions:
17+
security-events: write
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Python setup
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: 3.11
24+
cache: 'pip'
25+
cache-dependency-path: ./app_python/requirements.txt
26+
27+
- name: Dependencies installation
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install -r requirements.txt
31+
32+
- name: Lint with flake8
33+
run: |
34+
pip install flake8
35+
flake8 .
36+
37+
- name: Run tests
38+
run: |
39+
python ./src/test.py
40+
41+
- uses: snyk/actions/setup@master
42+
- name: Snyk test for vulnerabilities
43+
continue-on-error: true
44+
run: |
45+
snyk test --sarif-file-output=snyk.sarif
46+
env:
47+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
48+
49+
build_deploy:
50+
needs: checks
51+
runs-on: ubuntu-22.04
52+
steps:
53+
- uses: actions/checkout@v3
54+
55+
- name: Docker login
56+
uses: docker/login-action@v1
57+
with:
58+
username: ${{ secrets.DOCKERHUB_USERNAME }}
59+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
60+
61+
- name: Buildx setup
62+
uses: docker/setup-buildx-action@v1
63+
64+
- name: Build and push
65+
run: |
66+
docker buildx build -t artkochergin/devops-course:app_python .
67+
docker buildx build --push -t artkochergin/devops-course:app_python .
68+
working-directory: ./app_python

0 commit comments

Comments
 (0)