From 64cc5689585e30133eaf03e9d64fd863c271a111 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 26 Mar 2022 14:45:36 +0100 Subject: [PATCH] CI - init tests workflow w/ github actions --- .github/workflows/.tests.yml | 69 ++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/.tests.yml diff --git a/.github/workflows/.tests.yml b/.github/workflows/.tests.yml new file mode 100644 index 00000000..71ff4d65 --- /dev/null +++ b/.github/workflows/.tests.yml @@ -0,0 +1,69 @@ +name: FitTrackee tests + +on: [push, pull_request] + +env: + APP_SETTINGS: fittrackee.config.TestingConfig + DATABASE_TEST_URL: "postgresql://fittrackee:fittrackee@postgres:5432/fittrackee_test" + EMAIL_URL: "smtp://none:none@0.0.0.0:1025" + FLASK_APP: fittrackee/__main__.py + SENDER_EMAIL: fittrackee@example.com + +jobs: + python: + name: python ${{ matrix.python-version }} + runs-on: ubuntu-latest + container: python:${{ matrix.python-version }} + services: + postgres: + image: postgres:latest + env: + POSTGRES_DB: fittrackee_test + POSTGRES_USER: fittrackee + POSTGRES_PASSWORD: fittrackee + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + strategy: + matrix: + python-version: [ "3.7", "3.8", "3.9", "3.10" ] + steps: + - uses: actions/checkout@v2 + - name: Install Poetry and Dependencies + run: | + python -m pip install --upgrade pip + pip install --quiet poetry + poetry config virtualenvs.create false + poetry install --no-interaction --quiet + - name: Lint + if: matrix.python-version == '3.10' + run: pytest --flake8 --isort --black -m "flake8 or isort or black" fittrackee e2e --ignore=fittrackee/migrations -p no:warnings + - name: Mypy + if: matrix.python-version == '3.10' + run: mypy fittrackee + - name: Pytest + run: pytest fittrackee -p no:warnings --cov fittrackee --cov-report term-missing + + javascript: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 17.x + uses: actions/setup-node@v2 + with: + node-version: "17.x" + - name: Install yarn and dependencies + run: | + npm install --global yarn + cd fittrackee_client + yarn install + - name: Lint + run: | + cd fittrackee_client + yarn lint + - name: Tests + run: | + cd fittrackee_client + yarn test:unit