forked from inno-devops-labs/DevOps-Core-Course
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (47 loc) · 1.32 KB
/
python-ci.yml
File metadata and controls
58 lines (47 loc) · 1.32 KB
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
name: Python CI
on:
push:
branches: [ master, lab03 ]
paths:
- 'app_python/**'
- '.github/workflows/python-ci.yml'
pull_request:
paths:
- 'app_python/**'
jobs:
test-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "pip"
- name: Install dependencies
run: |
pip install -r app_python/requirements.txt
pip install -r app_python/requirements-dev.txt
- name: Lint
run: ruff check app_python
- name: Run tests
run: pytest app_python/tests
- name: Generate version
run: echo "VERSION=$(date +%Y.%m.%d)" >> $GITHUB_ENV
- name: Login Docker
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Snyk Scan
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
run: snyk test --file=app_python/requirements.txt
- name: Build and Push Docker Image
uses: docker/build-push-action@v6
with:
context: ./app_python
push: true
tags: |
maksimmenshikh/devops-info-service:${{ env.VERSION }}
maksimmenshikh/devops-info-service:latest