-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
67b4e4e
commit 90eeda6
Showing
1 changed file
with
86 additions
and
0 deletions.
There are no files selected for viewing
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
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" |