-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (71 loc) · 2.54 KB
/
deploy.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
name: Deploy
on:
push:
branches: [ "main" ]
jobs:
move-to-work:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: clear work directory
continue-on-error: true
run: rm -rf /home/poga/sqr-fanaty-serduchki/work/* /home/poga/sqr-fanaty-serduchki/work/.*
- name: move project to work directory
continue-on-error: true
run: mv ./* ./.* /home/poga/sqr-fanaty-serduchki/work
install-dependencies:
runs-on: self-hosted
needs: [ move-to-work ]
steps:
- name: install dependencies
working-directory: /home/poga/sqr-fanaty-serduchki/work
run: python3.11 -m poetry install
run-linter:
runs-on: self-hosted
needs: [ install-dependencies ]
steps:
- name: run linter
working-directory: /home/poga/sqr-fanaty-serduchki/work
run: python3.11 -m poetry run flake8 src/
run-tests:
runs-on: self-hosted
needs: [ install-dependencies ]
steps:
- name: run tests
working-directory: /home/poga/sqr-fanaty-serduchki/work
run: python3.11 -m poetry run pytest
run-bandit:
runs-on: self-hosted
needs: [install-dependencies]
steps:
- name: run bandit
working-directory: /home/poga/sqr-fanaty-serduchki/work
run: python3.11 -m poetry run bandit -c bandit.yaml -r src/
run-complexity-check:
runs-on: self-hosted
needs: [ install-dependencies ]
steps:
- name: run complexity check
working-directory: /home/poga/sqr-fanaty-serduchki/work
run: python3.11 -m poetry run flake8 --max-complexity 10 src/
build-docker-image:
runs-on: self-hosted
needs: [ run-tests, run-linter, run-bandit, run-complexity-check ]
steps:
- name: build docker image
working-directory: /home/poga/sqr-fanaty-serduchki/work
run: docker build --tag lazysplit:local -f deployments/Dockerfile . --network=host
deploy:
runs-on: self-hosted
needs: [ build-docker-image ]
steps:
- name: Export docker image
run: docker save lazysplit > /home/poga/sqr-fanaty-serduchki/work/lazysplit.tar
- name: Import docker image to microk8s
run: microk8s ctr --connect-timeout 10000s image import /home/poga/sqr-fanaty-serduchki/work/lazysplit.tar
- name: Remove previous deployment
continue-on-error: true
run: microk8s kubectl delete deployment/lazysplit
- name: Deploy
working-directory: /home/poga/sqr-fanaty-serduchki/work
run: microk8s kubectl apply -f deployments/deployment.yaml