forked from inno-devops-labs/S25-core-course-labs
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (47 loc) · 1.25 KB
/
python-app.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
name: Application CI
on:
push:
env:
USERNAME: voronm1522
DOCKER_IMAGE: voronm1522/devops
DOCKER_TAG: python-app
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
- uses: actions/checkout@v3
- name: Set up python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install dependencies and linter
run: |
python -m pip install --upgrade pip
pip install flake8
pip install -r app_python/requirements.txt
- name: Lint with flake8
run: |
flake8 app_python/app.py
- name: Run tests
run: |
python app_python/unittests.py
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ env.USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: app_python
push: true
tags: ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_TAG }}
- name: Run snyk
uses: snyk/actions/python-3.10@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}