Fix tutorial and add automated validation (#711) #10
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: Validate Tutorial | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| validate-tutorial: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: examples/tenant_tutorial | |
| services: | |
| postgres: | |
| image: postgres:15 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: root | |
| POSTGRES_DB: tenant_tutorial | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: "latest" | |
| - name: Change to tutorial directory | |
| run: pwd # Just to verify we're in the right directory | |
| - name: Check dependencies | |
| run: | | |
| ./manage.py check | |
| - name: Verify database connection | |
| run: | | |
| echo "SELECT 1 AS test" | ./manage.py dbshell | |
| - name: Run initial migrations | |
| run: | | |
| ./manage.py migrate_schemas --shared | |
| - name: Create public tenant | |
| run: | | |
| ./manage.py create_client public localhost "Tutorial Public Tenant" --description "Public tenant for tutorial validation" | |
| - name: Create sample tenants | |
| run: | | |
| ./manage.py create_client tenant1 tenant1.example.com "Tenant 1 - Test Company" --description "First test tenant for validation" | |
| ./manage.py create_client tenant2 tenant2.example.com "Tenant 2 - Another Company" --description "Second test tenant for validation" | |
| - name: Verify tenants were created | |
| run: | | |
| ! ./manage.py list_tenants | grep -v -P '^(public|tenant[12])\s' |