-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython-app.yml
More file actions
92 lines (78 loc) · 2.3 KB
/
python-app.yml
File metadata and controls
92 lines (78 loc) · 2.3 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Example: Simple Python Application CI
# This example demonstrates using the reusable Python build workflow for a basic application
name: Python Application CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
permissions:
contents: read
pull-requests: read
checks: write
jobs:
build:
name: Build & Test Application
uses: ./.github/workflows/python-build.yml
with:
# Basic Configuration
python-version: "3.12"
working-directory: "."
project-type: "app"
# Dependencies
requirements-files: '["requirements.txt", "requirements-dev.txt"]'
install-dev-requirements: true
package-manager: "pip"
cache-dependencies: true
# Testing
run-tests: true
test-framework: "pytest"
test-path: "tests"
collect-coverage: true
coverage-threshold: 80
coverage-format: "xml,html"
# Code Quality
run-lint: true
linter: "flake8"
max-line-length: 127
run-format-check: false
run-type-check: false
# Security
run-security-scan: true
security-tools: '["bandit", "safety"]'
security-fail-on-error: false
# Artifacts
upload-artifacts: true
artifact-name: "python-app"
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# Optional: Deploy to staging after successful build
deploy-staging:
name: Deploy to Staging
needs: build
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
runs-on: ubuntu-latest
environment:
name: staging
url: https://staging.example.com
steps:
- name: Deploy Application
run: |
echo "Deploying Python application to staging..."
# Add your deployment commands here
# Example: kubectl, docker, rsync, etc.
# Optional: Deploy to production after successful build on main
deploy-production:
name: Deploy to Production
needs: build
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
environment:
name: production
url: https://example.com
steps:
- name: Deploy Application
run: |
echo "Deploying Python application to production..."
# Add your deployment commands here