update workflow

This commit is contained in:
Andreas Zweili 2021-12-28 16:30:49 +01:00
parent 69f980efd9
commit 342f460f8b
2 changed files with 25 additions and 27 deletions

View File

@ -3,6 +3,28 @@ on:
branches: [master]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/local.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest -nauto --ds=network_inventory.settings.local --nomigrations
publish:
# Ensure test job passes before pushing image.
needs: tests
@ -13,6 +35,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: "Remove any .pyc files"
run: find . \( -name __pycache__ -o -name "*.pyc" \) -delete
- name: Build image
run: docker build . --file Dockerfile --tag $IMAGE_NAME

View File

@ -1,27 +0,0 @@
on:
push:
branches: [master]
pull_request:
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/local.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest -nauto --ds=network_inventory.settings.local --nomigrations