Skip to content

Commit

Permalink
Deployment service 11
Browse files Browse the repository at this point in the history
  • Loading branch information
florianfrictus committed Aug 29, 2023
1 parent ea9ed36 commit a7619b4
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 3 deletions.
28 changes: 28 additions & 0 deletions .github/actions/lint-python-app/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Documentation: https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
name: lint_python_app
description: Lint a Python app

inputs:
python-app-path:
description: Python app path
required: true
default: .

runs:
using: composite
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'

- name: Install app dependencies
shell: bash
working-directory: ${{ inputs.python-app-path }}
run: pip3 install -r requirements.txt -r requirements-all.txt

- name: Lint Python code
shell: bash
working-directory: ${{ inputs.python-app-path }}
run: flake8 .
47 changes: 44 additions & 3 deletions .github/workflows/integrity-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,55 @@ on:
branches:
- main
- prod
paths:
- .github/actions/build-and-push-docker-image-to-github/action.yml
- .github/actions/execute-command-on-kubernetes-cluster/action.yml
- .github/actions/lint-python-app/action.yml
- .github/actions/test-python-app/action.yml
- .github/workflows/integrity-checker.yml
- common-code/**/*
- ./**/*

pull_request:
paths:
- .github/actions/build-and-push-docker-image-to-github/action.yml
- .github/actions/execute-command-on-kubernetes-cluster/action.yml
- .github/actions/lint-python-app/action.yml
- .github/actions/test-python-app/action.yml
- .github/workflows/integrity-checker.yml
- common-code/**/*
- ./**/*

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
review:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Lint Python app
uses: ./.github/actions/lint-python-app
with:
python-app-path: ./.

test:
needs: review
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Test Python app
uses: ./.github/actions/test-python-app
with:
python-app-path: ./.
token: ${{ secrets.GITHUB_TOKEN }}

release:
needs: test
runs-on: ubuntu-latest
# Only run on main
if: success() && github.ref == 'refs/heads/main'
Expand All @@ -34,7 +75,7 @@ jobs:
docker-registry-username: ${{ github.actor }}
docker-registry-password: ${{ secrets.GITHUB_TOKEN }}
docker-image-name: ${{ github.repository }}-integrity-checker
docker-image-context: .
docker-image-context: ./.
outputs:
docker-image-tags: ${{ steps.build-and-push-docker-image-to-github.outputs.docker-image-tags }}

Expand Down Expand Up @@ -92,7 +133,7 @@ jobs:

- name: Prepare configuration files
shell: bash
working-directory: kubernetes
working-directory: ./kubernetes
env:
ENVIRONMENT: production
LOG_LEVEL: info
Expand All @@ -116,7 +157,7 @@ jobs:
with:
kube-config: ${{ secrets.KUBE_CONFIG_PROD }}
kube-namespace: csia-pme-prod
kubectl-context: ./kubernetes
kubectl-context: ././kubernetes
kubectl-args: |
apply \
-f integrity-checker.config-map.yml \
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[project]
name = "integrity-checker"

[tool.pytest.ini_options]
pythonpath = [".", "src"]
addopts = "--cov-config=.coveragerc --cov-report xml --cov-report term-missing --cov=./src"

0 comments on commit a7619b4

Please sign in to comment.