diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2de7ab57350c2d14978258dcf0d8c48f02c9770f..b0c882ea7b0c1da1e384a87a5706b7b616bd6743 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,27 +1,32 @@ name: Main -on: - push: - branches: - - master +on: [push] jobs: - test: - name: test - runs-on: ubuntu-latest - container: python:3.8 - steps: - - run: cd backend/secfit - - run: apt-get update -qy - - run: pip install -r requirements.txt + build: - staging: - name: staging runs-on: ubuntu-latest - container: ruby - needs: [test] + steps: - - run: apt-get update -qy - - run: apt-get install -y ruby-dev - - run: gem install dpl - - run: dpl --provider=heroku --app=tdt4242-base-frontend --api-key=${{secrets.HEROKU_STAGING_API_KEY}} - - run: dpl --provider=heroku --app=tdt4242-base-backend --api-key=${{secrets.HEROKU_STAGING_API_KEY}} + - uses: actions/checkout@v2 + - run: | + git fetch --prune --unshallow + - name: Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Lint with flake8 + run: | + pip install flake8 + # 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: | + pip install pytest + export PYTHONPATH=src + pytest