timestamp for bg #32
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
# Taken from: https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-python | |
name: Release Api | |
on: [push] | |
jobs: | |
build: | |
name: Run code tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.8] | |
mongodb-version: [6.0] | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
- name: Setting up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Start MongoDB | |
uses: supercharge/mongodb-github-action@1.8.0 | |
with: | |
mongodb-version: ${{ matrix.mongodb-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Lint the code with flake8 | |
run: | | |
# make folders | |
mkdir tests/flake8 | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 src --count --select=E9,F63,F7,F82 --show-source --statistics > tests/flake8/syntax_errors.txt | |
# exit-zero treats all errors as warnings. The PyCharm editor is 120 chars wide | |
flake8 src --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics > tests/flake8/lint.txt | |
- name: Archive code link txt report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: code-lint-report | |
path: tests/flake8 | |
- name: Run Unit Tests and generate coverage report | |
run: | | |
python -m unittest discover | |
coverage run -m unittest | |
coverage html --omit="*/test*" -d tests/coverage | |
- name: Archive code coverage html report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: code-coverage-report | |
path: tests/coverage |