]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
ci: add docker-compose tests
authorYou-Sheng Yang <vicamo@gmail.com>
Sat, 27 Nov 2021 09:40:15 +0000 (17:40 +0800)
committerStephen Finucane <stephen@that.guru>
Mon, 29 Nov 2021 17:38:25 +0000 (17:38 +0000)
Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
Signed-off-by: Stephen Finucane <stephen@that.guru>
[stephenfin: Removed release note, since this isn't user-facing]

.github/workflows/ci.yaml

index d2061a9191febdd4198bd6afebf6ad7bf9199b7e..f4a33b36a1263d8aee92ec82aaa9865e66f73e32 100644 (file)
@@ -102,3 +102,49 @@ jobs:
           name: html-docs-build
           path: docs/_build/html
           retention-days: 7
+  docker-compose:
+    name: Docker Image tests
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        db: [postgres, mysql]
+    steps:
+      - name: Checkout source code
+        uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+      - name: Set up Python 3.9
+        uses: actions/setup-python@v2
+        with:
+          python-version: 3.9
+      - name: Bring up docker-compose service
+        env:
+          COMPOSE_FILE: ${{ matrix.db == 'mysql' && 'docker-compose.yml' || 'docker-compose-pg.yml' }}
+        run: |
+          docker-compose build --build-arg UID=$(id -u) --build-arg GID=$(id -g)
+          docker-compose up --detach
+
+          for count in $(seq 50); do \
+            if curl --fail --silent "http://localhost:8000"; then \
+              break; \
+            fi; \
+            sleep 1; echo -n .; \
+          done
+          echo
+
+          docker-compose exec -T web \
+              python manage.py createsuperuser \
+              --username patchwork --no-input --email test@example.com
+          { echo patchwork; echo patchwork; } | \
+              docker-compose exec -T web \
+              python manage.py changepassword patchwork
+          docker-compose ps
+      - name: Test client access (git-pw)
+        run: |
+          python -m pip install git-pw
+          git pw --debug \
+              --server http://localhost:8000/api/1.2 --project patchwork \
+              --username patchwork --password patchwork series list
+      - name: Dump container logs
+        if: ${{ always() }}
+        run: docker-compose logs --no-color --timestamps