consolidate images and add paths #987
This file contains hidden or 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: Django CI | |
| on: [push] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| jobs: | |
| build-amd64: | |
| runs-on: ubuntu-latest | |
| services: | |
| # Label used to access the service container | |
| postgres: | |
| # Docker Hub postgres image | |
| image: postgres:15-alpine | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: tally | |
| ports: | |
| - 5432:5432 | |
| # Set health checks to wait until postgres has started | |
| options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
| env: | |
| # Connect Postgres service with custom container image | |
| # https://github.community/t/connect-postgres-service-with-custom-container-image/189994 | |
| POSTGRES_HOST: 127.0.0.1 | |
| POSTGRES_PORT: 5432 | |
| POSTGRES_USER: postgres | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: "3.12" | |
| - name: Cache Dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements/dev.pip') }} | |
| path: ./venv | |
| - name: Install Memcached | |
| run: sudo apt-get update && sudo apt-get install -y memcached | |
| - name: Start Memcached | |
| run: sudo service memcached start | |
| - name: Install Redis | |
| run: sudo apt-get install -y redis-server | |
| - name: Start Redis | |
| run: sudo service redis-server start | |
| - name: Install gettext | |
| run: sudo apt-get install -y gettext | |
| - name: Install reportlab system dependencies | |
| run: sudo apt-get install -y libfreetype6-dev libjpeg-dev zlib1g-dev libfribidi-dev libharfbuzz-dev | |
| - name: Install uv | |
| run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
| # Add uv to the PATH | |
| - run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| - name: Run pre-commit | |
| uses: pre-commit/action@v3.0.1 | |
| - name: Generate Report | |
| run: | | |
| uv venv | |
| source .venv/bin/activate | |
| uv pip install -r requirements/dev.pip | |
| python -m pytest tally_ho --doctest-modules --junitxml=coverage.xml --cov=tally_ho --cov-report=xml --cov-report=html | |
| python manage.py compilemessages -l ar | |
| coverage xml | |
| ls -al | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Upload Coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: true | |
| odk-central-sync: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: odk-central-sync | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| - run: uv python install 3.13 | |
| - run: uv sync --locked | |
| - run: uv run pytest tests/ -v |