Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Python CI (Lab03)

on:
push:
branches: [ "main", "master", "lab3", "lab03" ]
paths:
- "app_python/**"
- ".github/workflows/python-ci.yml"
pull_request:
paths:
- "app_python/**"
- ".github/workflows/python-ci.yml"

concurrency:
group: python-ci-${{ github.ref }}
cancel-in-progress: true

jobs:
test-lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: app_python

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: "app_python/requirements.txt"

- name: Install deps
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Lint (ruff)
run: ruff check .

- name: Tests
run: pytest -q

docker-build-push:
needs: test-lint
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || github.ref_name == 'lab3' || github.ref_name == 'lab03')

steps:
- uses: actions/checkout@v4

- name: Set version (CalVer)
run: |
echo "CALVER=$(date +%Y.%m)" >> $GITHUB_ENV
echo "BUILD=${{ github.run_number }}" >> $GITHUB_ENV

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build & Push
uses: docker/build-push-action@v6
with:
context: ./app_python
file: ./app_python/Dockerfile
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/devops-info-service:${{ env.CALVER }}.${{ env.BUILD }}
${{ secrets.DOCKER_USERNAME }}/devops-info-service:latest
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
__pycache__/
*.py[cod]
venv/
__MACOSX/
*.log

.vscode/
.idea/

.obsidian

.DS_Store
.env

terraform/.terraform/
terraform/.terraform.lock.hcl
terraform/terraform.tfstate
terraform/terraform.tfstate.*
**/.terraform/*
**/*.tfstate
**/*.tfstate.*

pulumi/venv/
Loading