Merge tag 'v8.2.0' of https://github.com/nyaruka/rapidpro into update… #2258
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-latest | |
env: | |
python-version: "3.10.x" | |
node-version: "12" | |
rpindexer-version: "8.2.0" | |
mailroom-version: "8.2.0" | |
DJANGO_SETTINGS_MODULE: temba.settings_ci | |
services: | |
redis: | |
image: redis:6.2-alpine | |
ports: | |
- 6379:6379 | |
postgres: | |
image: postgis/postgis:14-3.3-alpine | |
env: | |
POSTGRES_DB: temba | |
POSTGRES_USER: temba | |
POSTGRES_PASSWORD: temba | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
elastic: | |
image: elasticsearch:7.17.9 | |
ports: | |
- 9200:9200 | |
- 9300:9300 | |
env: | |
discovery.type: single-node | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Linux packages | |
run: | | |
sudo apt update | |
sudo apt install -y --no-install-recommends libgdal-dev ffmpeg | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.python-version }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-in-project: true | |
- name: Install Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.node-version }} | |
- name: Initialize environment | |
run: | | |
poetry install | |
yarn install | |
sudo yarn global add less | |
ln -s ${{ github.workspace }}/temba/settings.py.dev ${{ github.workspace }}/temba/settings.py | |
poetry run python manage.py migrate | |
# fetch and extract rp-indexer | |
wget https://github.com/nyaruka/rp-indexer/releases/download/v${{ env.rpindexer-version }}/rp-indexer_${{ env.rpindexer-version }}_linux_amd64.tar.gz | |
tar -xvf rp-indexer_${{ env.rpindexer-version }}_linux_amd64.tar.gz rp-indexer | |
# fetch, extract and start mailroom | |
wget https://github.com/nyaruka/mailroom/releases/download/v${{ env.mailroom-version }}/mailroom_${{ env.mailroom-version }}_linux_amd64.tar.gz | |
tar -xvf mailroom_${{ env.mailroom-version }}_linux_amd64.tar.gz mailroom | |
./mailroom -db=postgres://temba:temba@localhost:5432/temba?sslmode=disable -redis=redis://localhost:6379/10 -log-level=info > mailroom.log & | |
- name: Run pre-test checks | |
run: | | |
# test that everything is well formatted, no missing migrations etc | |
poetry run python code_check.py --debug | |
# check we can collect and compress all static files | |
poetry run python manage.py collectstatic --noinput --verbosity=0 | |
poetry run python manage.py compress --extension=".haml" --settings=temba.settings_compress | |
- name: Run tests | |
run: | | |
poetry run coverage run manage.py test --keepdb --noinput --verbosity=2 | |
poetry run coverage report -i | |
poetry run coverage xml | |
poetry run coverage html | |
- name: Save coverage report as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: coverage-report | |
path: htmlcov/ | |
- name: Mailroom log | |
if: failure() | |
run: cat mailroom.log | |
- name: Upload coverage | |
if: success() | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true |