Run code checks #3634
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
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 |