Skip to content

Update nn desc

Update nn desc #115

Workflow file for this run

# Workflow responsible for core acceptance testing.
# Tests Currently Run:
# - flake8-linter
# - image-build-test
#
# This workflow only validates images can build
# but does not push images to any repository.
#
# The build-push-dev-image and build-push-release workflows
# handle the develop and release image storage respectively.
#
#
name: Code-Checks
on:
push:
branches-ignore:
- master
- main
- develop
paths-ignore:
- README.md
- .old_cicd/*
# - .github/*
# - .github/workflows/*
- LICENSE
- .gitignore
- .dockerignore
- .githooks
pull_request:
branches:
- develop
- master
- main
types: [ opened, synchronize ]
jobs:
############################## flake8-linter ##############################
flake8-linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
# Currently actions/setup-python supports caching
# but the cache is not as robust as cache action.
# Here we cache the entire python env which speeds subsequent builds up alot. (alot being scientific term)
# Ref: https://blog.allenai.org/python-caching-in-github-actions-e9452698e98d
- uses: actions/cache@v3
name: Cache Python
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('pyproject.toml') }}
- name: Install Requirements
run: |
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
flake8 --ignore=E,W src
# We continue on error here until the code is clean
# flake8 --ignore=E,W --exit-zero .
continue-on-error: true
############################## test-image-build ##############################
test-image-build:
# needs: flake8-linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: |
network=host
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
logout: true
# Notes on Cache:
# https://docs.docker.com/build/ci/github-actions/examples/#inline-cache
- name: Build Container
uses: docker/build-push-action@v4
with:
context: .
push: false
cache-from: type=registry,ref=${{ github.repository }}:buildcache
cache-to: type=registry,ref=${{ github.repository }}:buildcache,mode=max
################################### PYTEST ###################################
pytest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install Requirements
run: |
pip install -r requirements.txt
pip install coverage
pip install .
- name: Test with pytest
run: |
pytest --doctest-modules src
coverage run -m pytest tests/unit
############################ Bandit ################################
bandit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install Requirements
run: |
pip install -r requirements.txt
pip install bandit
pip install .
# Only report high security issues
- name: Test with Bandit
run: |
bandit -r src -n3 -lll