From 001adc3e39cd920bdfc62dec0f9b7b9275665b69 Mon Sep 17 00:00:00 2001 From: Benj Fassbind Date: Tue, 12 Nov 2019 18:39:14 +0100 Subject: [PATCH] build: use tox and combine workflows combine workflows so that tests are executed before a container is deployed --- .github/workflows/backend-test.yml | 36 -------------------- .github/workflows/{docker.yml => docat.yml} | 37 +++++++++++++++++++-- backend/tox.ini | 18 +++++----- 3 files changed, 45 insertions(+), 46 deletions(-) delete mode 100644 .github/workflows/backend-test.yml rename .github/workflows/{docker.yml => docat.yml} (52%) diff --git a/.github/workflows/backend-test.yml b/.github/workflows/backend-test.yml deleted file mode 100644 index a4015c035..000000000 --- a/.github/workflows/backend-test.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Python package - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - max-parallel: 4 - matrix: - python-version: [3.8] - - steps: - - uses: actions/checkout@v1 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - - name: Lint with flake8 - working-directory: backend - run: | - pip install flake8 - flake8 --show-source app.py - - name: Lint with black - working-directory: backend - run: | - pip install black - black --check app.py - - name: Lint with isort - working-directory: backend - run: | - pip install isort - isort --check-only app.py diff --git a/.github/workflows/docker.yml b/.github/workflows/docat.yml similarity index 52% rename from .github/workflows/docker.yml rename to .github/workflows/docat.yml index b8a5e1c79..585216721 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docat.yml @@ -1,11 +1,44 @@ -name: docker ci +name: docat ci on: [push] jobs: - build: + test: + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + matrix: + python-version: [3.8] + + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + + - name: install dependencies + run: | + python -m pip install --upgrade pip + pip install tox + + - name: lint with flake8 + working-directory: backend + run: | + tox -e flake8 + + - name: lint with black + working-directory: backend + run: | + tox -e black + + - name: lint with isort + working-directory: backend + run: | + tox -e isort + docker: runs-on: ubuntu-latest steps: diff --git a/backend/tox.ini b/backend/tox.ini index a10a93d4a..e1e658c74 100644 --- a/backend/tox.ini +++ b/backend/tox.ini @@ -1,12 +1,14 @@ [tox] -envlist = lint -skip_missing_interpreters = True skipsdist = True -[testenv:lint] +[testenv:flake8] deps = flake8 - black - isort -commands = flake8 --show-source app.py - black --check app.py - isort --check-only app.py +commands = flake8 --show-source app.py {posargs} + +[testenv:black] +deps = black +commands = black --check app.py {posargs} + +[testenv:isort] +deps = isort +commands = isort --check-only app.py {posargs}