improve docs #1029
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
| # Based on https://github.com/actions/starter-workflows/blob/main/ci/django.yml | |
| name: Continuous Integration | |
| on: | |
| pull_request: | |
| branches: | |
| - "*" | |
| push: | |
| branches: [dev, master] | |
| env: | |
| PYTHON_TARGET: "3.12" | |
| DJANGO_SETTINGS_MODULE: tcf_core.settings.dev | |
| SECRET_KEY: ci-secret-key-not-for-production | |
| # CI database (GitHub Actions postgres service) | |
| DB_NAME: tcf_db | |
| DB_USER: postgres | |
| DB_PASSWORD: postgres | |
| DB_HOST: localhost | |
| DB_PORT: 5432 | |
| jobs: | |
| ruff: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_TARGET }} | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: uv sync --frozen --group dev --no-install-project | |
| - name: Ruff check | |
| run: uv run ruff check . | |
| - name: Ruff format | |
| run: uv run ruff format --check . | |
| djlint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_TARGET }} | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: uv sync --frozen --group dev --no-install-project | |
| - name: djLint templates | |
| run: uv run djlint tcf_website/templates --check --lint | |
| ty: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_TARGET }} | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: uv sync --frozen --group dev --no-install-project | |
| - name: Run ty | |
| run: uv run ty check | |
| django: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| code-coverage: ${{ steps.coverage.outputs.percentage }} | |
| services: | |
| postgres: | |
| image: postgres:15.4 | |
| env: | |
| POSTGRES_USER: ${{ env.DB_USER }} | |
| POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }} | |
| POSTGRES_DB: ${{ env.DB_NAME }} | |
| ports: | |
| - 5432:5432 | |
| options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_TARGET }} | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: uv sync --frozen --group dev --no-install-project | |
| - name: Migrations & Tests | |
| run: | | |
| uv run python manage.py migrate | |
| uv run coverage run manage.py test | |
| - name: Get code coverage | |
| id: coverage | |
| run: | | |
| echo "percentage=$(uv run coverage report | grep -o '[0-9]\+%' | tail -1)" >> "$GITHUB_OUTPUT" | |
| eslint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: "npm" | |
| - name: Install npm packages | |
| run: npm ci | |
| - name: Run ESLint | |
| run: npx eslint -c .config/.eslintrc.yml tcf_website/static/ |