Skip to content

CI

CI #3540

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
test:
name: Test
strategy:
matrix:
python-version: ["3.11.x"]
env:
redis-version: "6.2"
pg-version: "15"
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- 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@1.1.0
with:
redis version: ${{ env.redis-version }}
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.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@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true