Skip to content

Commit

Permalink
🔧 add github actions definition
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanbekker committed Dec 29, 2023
1 parent 67b4e4e commit 90eeda6
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: CI Pipeline

on:
push:
branches:
- '**'
paths:
- '**/*.py'
- '**/*.txt'
- '**/*.yml'
- '**/Dockerfile'
- '**/.trigger'

env:
FLASK_APP: "app:create_app"
FLASK_DEBUG: "False"
PIP_CACHE_DIR: "${{ github.workspace }}/.cache/pip"
PIP_REQUIREMENTS_FILE: "${{ github.workspace }}/requirements.txt"
PYLINT_RC: "${{ github.workspace }}/.pylintrc"
PYDOCSTYLE_RC: "${{ github.workspace }}/.pydocstyle"
PYCODECOVERAGE_RC: "${{ github.workspace }}/.coveragerc"
ENABLE_TEST_STEPS: "1"

jobs:
setup:
runs-on: ubuntu-latest
if: github.ref && (env.ENABLE_TEST_STEPS == '1')
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Install Dependencies
run: |
python3 -m venv venv
source venv/bin/activate
pip install -r $PIP_REQUIREMENTS_FILE
env:
PIP_REQUIREMENTS_FILE: ${{env.PIP_REQUIREMENTS_FILE}}

static-analysis:
needs: setup
runs-on: ubuntu-latest
container: python:3.8
steps:
- name: Run Static Analysis
run: |
echo "Installing dependencies"
python3 -m pylint ./
prospector --profile .prospector.yaml
python3 -m bandit -r . -ll -x ./venv
tests:
needs: setup
runs-on: ubuntu-latest
container: python:3.8
steps:
- name: Run Unit Tests
run: |
echo "Installing dependencies"
python3 -m unittest discover -s tests
coverage:
needs: setup
runs-on: ubuntu-latest
container: python:3.8
steps:
- name: Run Coverage
run: |
echo "Installing dependencies"
coverage run -m unittest discover -s ./tests
coverage xml
coverage report --show-missing --fail-under=90
deploy:
needs: [static-analysis, tests, coverage]
runs-on: ubuntu-latest
container: busybox
if: github.ref == 'refs/heads/main'
steps:
- name: Deploy to Staging
run: echo "Deploying to staging environment"

0 comments on commit 90eeda6

Please sign in to comment.