-
Notifications
You must be signed in to change notification settings - Fork 3
103 lines (83 loc) · 2.17 KB
/
server-ci-dev.yml
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
name: Python CI
on:
push:
paths:
- "server/**"
branches:
- dev
pull_request:
paths:
- "server/**"
branches:
- dev
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./server
steps:
- name: Checkout the Git Repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: |
pytest tests/
- name: Run security checks with bandit
uses: mdegis/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
path: "."
level: high
confidence: high
exit_zero: true
- name: Start application
run: |
flask run &
sleep 5 # give Flask time to start
- name: Check application is running
run: |
curl localhost:5000
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
continue-on-error: true
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: your-dockerhub-username/your-repo-name:latest
continue-on-error: true
deploy:
runs-on: ubuntu-latest
needs: docker-build
steps:
- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
continue-on-error: true
- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v2
with:
app-name: 'your-app-name'
slot-name: 'production'
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
images: 'your-dockerhub-username/your-repo-name:latest'
continue-on-error: true