Skip to content

Run code checks

Run code checks #3126

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
test:
name: Test
env:
python-version: "3.10.x"
redis-version: "6.2"
pg-version: "15"
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Install PostgreSQL
uses: harmon758/postgresql-action@v1
with:
postgresql version: ${{ env.pg-version }}
postgresql db: ureport
postgresql user: ureport
postgresql password: nyaruka
- name: Install Redis
uses: zhulik/redis-action@v1.0.0
with:
redis version: ${{ env.redis-version }}
- name: Install Python
uses: actions/setup-python@v1
with:
python-version: ${{ env.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-in-project: true
- name: Initialize environment
run: |
poetry install --no-root
sudo npm install -g coffee-script less
ln -s ${{ github.workspace }}/ureport/settings.py.postgres ${{ github.workspace }}/ureport/settings.py
poetry run pip show smartmin | awk '/Location:/ { print $2 "/smartmin ${{ github.workspace }}/smartmin" }' | xargs ln -s
poetry run pip show rapidpro-dash | awk '/Location:/ { print $2 "/dash ${{ github.workspace }}/dash" }' | xargs ln -s
- name: Run pre-test checks
run: |
sudo apt-get install gettext
poetry run ./code_check.py --debug
- name: Run tests
run: |
poetry run coverage run manage.py test --verbosity=2 --noinput
poetry run coverage xml
- name: Upload coverage
if: success()
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true