Skip to content

Commit

Permalink
changed deploy-test.yml to include testing in containers and then del…
Browse files Browse the repository at this point in the history
…eting the containers
  • Loading branch information
CodingGirlGargi committed Mar 24, 2025
1 parent c089a22 commit 3ab1e01
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/deploy_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ name: Continuous Development Deploy to TDT4242 server
on:
push:
branches:
- main # Or your development branch
- gargi-production # Trigger deployment on push to the production branch
workflow_dispatch:
inputs:
config:
description: "Which compose config file to deploy"
required: true
default: "docker-compose.dev.yml"
default: "docker-compose.yml" # Default to docker-compose.yml for production
type: choice
options:
- "docker-compose.dev.yml"
Expand All @@ -21,7 +21,7 @@ jobs:
runs-on: self-hosted
env:
REPO_NAME: ${{ github.event.repository.name }}
COMPOSE_FILE: ${{ github.event.inputs.config || 'docker-compose.dev.yml' }} # Use default if not provided
COMPOSE_FILE: ${{ github.event.inputs.config || 'docker-compose.yml' }} # Default to docker-compose.yml for production

steps:
- name: Checkout repository
Expand All @@ -43,6 +43,12 @@ jobs:
- name: Build and run docker image
run: docker compose -f $COMPOSE_FILE up --force-recreate --build -d

- name: Run tests in staging (before production deployment)
run: |
docker compose -f docker-compose.stag.yml up --build -d
docker exec secfit_stag_backend python manage.py test tests
docker compose -f docker-compose.stag.yml down
- name: Print deployment message
run: |
echo "Code has been updated and deployed to the server!"
Expand Down

0 comments on commit 3ab1e01

Please sign in to comment.