-
-
Notifications
You must be signed in to change notification settings - Fork 5
123 lines (101 loc) Β· 3.13 KB
/
ci.yml
File metadata and controls
123 lines (101 loc) Β· 3.13 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: "CI"
on:
push:
branches:
- master
- main
pull_request:
workflow_dispatch:
jobs:
python:
name: "Python π"
runs-on: ubuntu-latest
steps:
- name: ποΈ Checkout
uses: actions/checkout@v6
- name: π Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.14'
cache: 'pip'
- name: π₯ Install dependencies
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: π Lint with flake8
run: |
flake8 --ignore=W292,W503 --max-line-length=127 --show-source --statistics *.py app/*.py app/routes/*.py app/services/*.py app/clients/*.py app/utils/*.py tests/*.py tests/integration/*.py tests/unit/*.py
- name: π§ͺ Run tests
run: |
python -m pytest tests/ --cov
terraform:
name: "Terraform ποΈ"
runs-on: ubuntu-latest
defaults:
run:
working-directory: gcp
steps:
- name: ποΈ Checkout
uses: actions/checkout@v6
- name: ποΈ Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: π Terraform Format
run: terraform fmt -check -recursive
- name: π Terraform Init
run: terraform init -backend=false
- name: π Terraform Validate
run: terraform validate
- name: π Setup TFLint
uses: terraform-linters/setup-tflint@v6
with:
tflint_version: latest
- name: π Run TFLint
run: tflint
- name: π‘οΈ Run tfsec
uses: aquasecurity/tfsec-action@v1.0.3
with:
working_directory: gcp
shell:
name: "Shell π"
runs-on: ubuntu-latest
steps:
- name: ποΈ Checkout
uses: actions/checkout@v6
- name: π ShellCheck
run: |
shellcheck tools/*.sh && shellcheck gcp/*.sh && shellcheck gcp/startup/*.sh
docker:
name: "Docker π³"
needs: [python, terraform, shell]
runs-on: ubuntu-latest
steps:
- name: ποΈ Checkout
uses: actions/checkout@v6
- name: ποΈ Build Docker image
run: |
docker build -t google-cloud-github-runner .
- name: π Start Docker container
run: |
docker run -d --name google-cloud-github-runner -p 8080:8080 google-cloud-github-runner
- name: β³ Wait for container to be ready
run: |
# Wait for up to 30 seconds for the service to respond
for i in {1..30}; do
if curl -s http://localhost:8080 > /dev/null; then
echo "Container is ready!"
exit 0
fi
echo "Waiting for container... ($i/30)"
sleep 1
done
echo "Container failed to start in time"
docker logs google-cloud-github-runner
exit 1
- name: π Access Container web app via curl
run: |
curl -v http://localhost:8080
- name: π§Ή Cleanup
if: always()
run: |
docker stop google-cloud-github-runner || true
docker rm google-cloud-github-runner || true