|
80 | 80 | # yamllint enable rule:line-length |
81 | 81 | tags: ${{ steps.meta.outputs.tags }} |
82 | 82 | labels: ${{ steps.meta.outputs.labels }} |
| 83 | + |
| 84 | + test-image: |
| 85 | + needs: build-push-image |
| 86 | + runs-on: ubuntu-latest |
| 87 | + strategy: |
| 88 | + matrix: |
| 89 | + python_implementation: [python] |
| 90 | + python_version: ["3.12", "3.13"] |
| 91 | + django_version: ["5.2", "main"] |
| 92 | + test_service: |
| 93 | + - mariadb |
| 94 | + - mysql |
| 95 | + - oracle |
| 96 | + - postgresql |
| 97 | + - sqlite |
| 98 | + - mariadb-gis |
| 99 | + - mysql-gis |
| 100 | + - oracle-gis |
| 101 | + - postgresql-gis |
| 102 | + - sqlite-gis |
| 103 | + fail-fast: false |
| 104 | + env: |
| 105 | + REGISTRY: ghcr.io |
| 106 | + REGISTRY_PATH: ghcr.io/${{ github.repository_owner }}/django-docker-box |
| 107 | + # yamllint disable rule:line-length |
| 108 | + IMAGE_TAG: ${{ matrix.python_implementation }}-${{ matrix.python_version }}-django-${{ matrix.django_version }} |
| 109 | + # yamllint enable rule:line-length |
| 110 | + steps: |
| 111 | + - name: Checkout repository |
| 112 | + uses: actions/checkout@v4 |
| 113 | + with: |
| 114 | + ref: ${{ github.event.workflow_run.head_sha }} |
| 115 | + - name: Log into registry ${{ env.REGISTRY }} |
| 116 | + uses: docker/login-action@v3 |
| 117 | + with: |
| 118 | + registry: ${{ env.REGISTRY }} |
| 119 | + username: ${{ github.actor }} |
| 120 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 121 | + - name: Set up Docker Buildx |
| 122 | + uses: docker/setup-buildx-action@v3 |
| 123 | + - name: Pull image |
| 124 | + run: | |
| 125 | + docker pull ${{ env.REGISTRY_PATH }}:${{ env.IMAGE_TAG }} |
| 126 | + - name: Download Django source |
| 127 | + run: | |
| 128 | + if [ "${{ matrix.django_version }}" = "main" ]; then |
| 129 | + branch=main |
| 130 | + dirname=django-main |
| 131 | + else |
| 132 | + branch=stable/${{ matrix.django_version }}.x |
| 133 | + dirname=django-stable-${{ matrix.django_version }}.x |
| 134 | + fi |
| 135 | + curl -L https://github.com/django/django/archive/refs/heads/$branch.tar.gz | tar xz |
| 136 | + mv $dirname django-src |
| 137 | + - name: Run tests for ${{ matrix.test_service }} |
| 138 | + run: | |
| 139 | + export DOCKER_BOX_IMAGE=${{ env.REGISTRY_PATH }}:${{ env.IMAGE_TAG }} |
| 140 | + export DJANGO_PATH=./django-src/ |
| 141 | + docker compose run --rm ${{ matrix.test_service }} |
0 commit comments