Skip to content

Made site more mobile friendly and fixed test #837

Made site more mobile friendly and fixed test

Made site more mobile friendly and fixed test #837

Workflow file for this run

name: Lint and test
on:
push:
branches:
- main
- dev
pull_request:
types: [opened, reopened, synchronize]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install backend dependencies
run: pip install -r ./backend/requirements.txt -r ./backend/requirements-dev.txt
- name: Lint backend
run: ruff check ./backend
- name: Black format check
uses: psf/black@stable
with:
options: '--check --verbose'
src: './backend'
version: '24.3.0'
- name: Install frontend packages
working-directory: ./frontend
run: npm ci
- name: Run tests on frontend
working-directory: ./frontend
run: npm run test
- name: Lint frontend
working-directory: ./frontend
run: npm run lint
test:
runs-on: ubuntu-latest
env:
DB_USER: dirtviz
DB_PASS: password
DB_HOST: localhost
DB_PORT: 5432
DB_DATABASE: dirtviz
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install backend dependencies
run: pip install -r ./backend/requirements.txt -r ./backend/requirements-dev.txt
- name: Install frontend packages
working-directory: ./frontend
run: npm ci
- name: Install k6
run: |
curl https://github.com/loadimpact/k6/releases/download/v0.26.2/k6-v0.26.2-linux64.tar.gz -L | tar xvz --strip-components 1
- name: Start services
run: docker compose up -d
- name: Wait for services to start
run: sleep 10s
- name: Save timestamp
id: timestamp
run: echo "start_time=$(date -Is)" >> $GITHUB_OUTPUT
- name: Apply migrations
run: flask --app backend.api db upgrade -d ./backend/api/migrations
- name: Import example data
run: python import_example_data.py
- name: Run smoke test
run: ./k6 run tests/basic.js
- name: Run backend tests
run: pytest --cov
- name: Run frontend tests + coverage
working-directory: ./frontend
run: npm run coverage
- name: Save all logs
if: always()
run: docker compose logs -t > dirtviz.log
- name: Save short logs
if: always()
run: docker compose logs -t --since ${{ steps.timestamp.outputs.start_time }} > dirtviz_short.log
- name: Check for errors
run: "! grep -i 'error' dirtviz_short.log"
- name: Upload log artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: DirtViz Logs
path: |
dirtviz.log
dirtviz_short.log
- name: Upload backend coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
flags: backend
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload frontend coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
files: ./frontend/coverage/coverage-final.json
flags: frontend
token: ${{ secrets.CODECOV_TOKEN }}