Skip to content

Commit 55d99b1

Browse files
committed
Ran tests in published images
1 parent dee5c44 commit 55d99b1

File tree

2 files changed

+62
-1
lines changed

2 files changed

+62
-1
lines changed

.github/workflows/docker-publish.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,64 @@ jobs:
8080
# yamllint enable rule:line-length
8181
tags: ${{ steps.meta.outputs.tags }}
8282
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+
# yamllint disable rule:line-length
127+
- name: Download Django source
128+
run: |
129+
if [ "${{ matrix.django_version }}" = "main" ]; then
130+
branch=main
131+
dirname=django-main
132+
else
133+
branch=stable/${{ matrix.django_version }}.x
134+
dirname=django-stable-${{ matrix.django_version }}.x
135+
fi
136+
curl -L https://github.com/django/django/archive/refs/heads/$branch.tar.gz | tar xz
137+
mv $dirname django-src
138+
# yamllint enable rule:line-length
139+
- name: Run tests for ${{ matrix.test_service }}
140+
run: |
141+
export DOCKER_BOX_IMAGE=${{ env.REGISTRY_PATH }}:${{ env.IMAGE_TAG }}
142+
export DJANGO_PATH=./django-src/
143+
docker compose run --rm ${{ matrix.test_service }}

compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22

33
x-base: &base
4-
image: django-docker-box:${PYTHON_IMPLEMENTATION}-${PYTHON_VERSION}
4+
image: ${DOCKER_BOX_IMAGE:-django-docker-box:${PYTHON_IMPLEMENTATION}-${PYTHON_VERSION}} # yamllint disable-line rule:line-length
55
build:
66
context: .
77
dockerfile: ./Containerfile

0 commit comments

Comments
 (0)