Merge pull request #1249 from rapidpro/update-python #3712
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 | |
runs-on: ubuntu-22.04 | |
env: | |
python-version: "3.12.x" | |
services: | |
redis: | |
image: redis:6.2-alpine | |
ports: | |
- 6379:6379 | |
postgres: | |
image: postgis/postgis:15-3.3-alpine | |
env: | |
POSTGRES_DB: ureport | |
POSTGRES_USER: ureport | |
POSTGRES_PASSWORD: nyaruka | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
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@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true |