[Snyk] Security upgrade django from 3.2.19 to 4.2.17 #308
This file contains 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: Unit tests | |
# pull requests: | |
# push: | |
# run on every push, which is when something gets merged also | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- master | |
- dev | |
env: | |
DD_DOCKER_REPO: defectdojo | |
docker-image: django # we only need to build the django image for unit tests | |
jobs: | |
unit_tests: | |
name: unit tests | |
runs-on: ubuntu-latest | |
steps: | |
# - name: Login to DockerHub | |
# uses: docker/login-action@v1 | |
# with: | |
# username: ${{ secrets.DOCKERHUB_USERNAME }} | |
# password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
# - name: Read Docker Image Identifiers | |
# id: read-docker-image-identifiers | |
# run: echo "IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
buildkitd-flags: --debug | |
driver-opts: image=moby/buildkit:master # needed to get the fix for https://github.com/moby/buildkit/issues/2426 | |
- name: Build | |
id: docker_build | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: false | |
load: true | |
tags: | | |
${{ env.DD_DOCKER_REPO }}/defectdojo-${{ env.docker-image }}:latest | |
file: Dockerfile.${{ env.docker-image }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# run tests with docker-compose | |
- name: Set unit-test mode | |
run: docker/setEnv.sh unit_tests_cicd | |
# phased startup so we can use the exit code from unit test container | |
- name: Start MySQL | |
run: docker-compose --env-file ./docker/environments/mysql-redis.env up -d mysql | |
# no celery or initializer needed for unit tests | |
- name: Unit tests | |
run: docker-compose --profile mysql-redis --env-file ./docker/environments/mysql-redis.env up --no-deps --exit-code-from uwsgi uwsgi | |
- name: Logs | |
if: failure() | |
run: docker-compose --profile mysql-redis --env-file ./docker/environments/mysql-redis.env logs --tail="2500" uwsgi | |
- name: Shutdown | |
if: always() | |
run: docker-compose --profile mysql-redis --env-file ./docker/environments/mysql-redis.env down |