Merge branch 'dev' #52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |