Set TEMPLATE_DEBUG=1 to capture template coverage #285
Workflow file for this run
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: test | |
| env: | |
| # yamllint disable-line rule:line-length | |
| TEMPLATE_URL: "https://github.com/lincolnloop/django-layout/zipball/${{ github.ref_name }}" | |
| "on": | |
| schedule: | |
| - cron: '0 5 * * 0' | |
| push: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@5a7eac68fb9809dea845d802897dc5c723910fa3 # v7 | |
| with: | |
| enable-cache: false | |
| ignore-empty-workdir: true | |
| - name: Create Django project from template | |
| run: | | |
| uv run --with django django-admin startproject \ | |
| --template="$TEMPLATE_URL" \ | |
| --extension=py,md,gitignore,yaml,json,toml \ | |
| --name=Makefile,Dockerfile \ | |
| --exclude=.github \ | |
| testproj . | |
| - name: Create blank index.js file | |
| run: | | |
| mkdir -p client/dist | |
| touch client/dist/index.js | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3 | |
| - name: Build and cache | |
| uses: docker/bake-action@3acf805d94d93a86cce4ca44798a76464a75b88c # v6 | |
| with: | |
| load: true | |
| set: | | |
| *.cache-from=type=gha | |
| *.cache-to=type=gha,mode=max | |
| source: . | |
| - name: Initialize project | |
| run: make init | |
| - name: Start dev server | |
| run: docker compose up -d | |
| timeout-minutes: 5 | |
| - name: Show running Docker containers | |
| run: docker ps | |
| - name: curl /testproj-admin/login | |
| run: | | |
| curl -I --retry 10 --retry-all-errors --fail \ | |
| localhost:8000/testproj-admin/login/ | |
| - name: curl /static/index.js | |
| run: | | |
| curl -I --retry 10 --retry-all-errors --fail \ | |
| localhost:8000/static/index.js | |
| - name: Run tests | |
| run: | | |
| docker compose exec app \ | |
| pytest --cov=. --cov-report=xml --junitxml=junit.xml | |
| - name: Upload coverage reports to Codecov | |
| # Publish coverage on success, fail, but not cancel. | |
| if: success() || failure() | |
| uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| slug: ${{ github.repository }} | |
| - name: Upload test results to Codecov | |
| # Upload JUnit test reports for test analytics | |
| if: success() || failure() | |
| uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f # v1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| slug: ${{ github.repository }} | |
| - name: Dump Docker logs | |
| run: | | |
| set -x | |
| docker compose ps | |
| docker compose logs | |
| if: always() |