forked from inno-devops-labs/DevOps-Core-Course
-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (48 loc) · 1.53 KB
/
Copy pathpython-ci.yml
File metadata and controls
57 lines (48 loc) · 1.53 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
name: python-lab03
on:
pull_request:
types: [opened, reopened]
branches:
- master
paths:
- '.github/workflows/python-ci.yml'
- app_python/
- '!app_python/docs/**'
- '!app_python/README.md'
jobs:
Check-code-and-docker-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.14'
cache: pip
- name: Install dependencies
run: cd app_python/; pip install -r requirements.txt
- name: Lint
run: flake8 app_python/app.py app_python/tests/
- name: Test
run: pytest app_python/tests/
# snyk can't find required packages, even after installing dependencies, don't know the reason
# - name: Check for vulnerabilities
# uses: snyk/actions/python@master
# env:
# SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
# with:
# args: app_python/
- name: Generate version
id: gen-ver
run: echo "VERSION=$(date +%Y.%m.%d)" >> $GITHUB_OUTPUT
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/setup-buildx-action@v3
- name: Docker build and push
uses: docker/build-push-action@v6
with:
context: ./app_python
push: true
tags: kosmogor/devops:latest,kosmogor/devops:${{ steps.gen-ver.outputs.VERSION }}