From eab1f86c66308b502f47acd37a35e29dc0812a41 Mon Sep 17 00:00:00 2001 From: Mark Powers Date: Mon, 30 Sep 2024 14:04:34 -0500 Subject: [PATCH] Add pytest GHA --- .github/workflows/test.yml | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..006ab676 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,39 @@ +name: Run Tests + +on: + workflow_run: + workflows: ["CI"] + types: + - completed + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + test: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + steps: + - name: Set up Docker + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + flavor: latest=${{ env.BRANCH == 'master' }} + + - name: Pull Docker image + run: docker pull ${{ steps.meta.outputs.tags }} + + - name: Run tests + run: docker run --rm ${{ steps.meta.outputs.tags }} ./manage.py test \ No newline at end of file