Skip to content

Commit

Permalink
configure workflow to run tests when deploying to production
Browse files Browse the repository at this point in the history
  • Loading branch information
Emilorv committed Mar 31, 2025
1 parent 70f3b31 commit 5d588d2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Deploy to TDT4242 server development

on:
push:
branches: [ "main" ]
branches: [ "production" ]
pull_request:
branches: [ "main" ]
branches: [ "production" ]

jobs:
deploy:
Expand All @@ -21,9 +21,6 @@ jobs:
with:
export-variables: true
keys-case: bypass

- name: Get name
run: whoami

- name: Check status of config file
run: |
Expand All @@ -32,6 +29,12 @@ jobs:
cd $GITHUB_WORKSPACE
docker compose -f $COMPOSE_FILE --verbose config && printf "OK\n" || exit 1
- name: Run tests
run: |
docker-compose -f docker-compose.stag.yml up --build –d
docker exec secfit_stag_backend python manage.py test tests || exit 1
docker-compose -f docker-compose.stag.yml down
- name: Build and run docker image
run: docker compose -f $COMPOSE_FILE up --force-recreate --build -d
Expand Down

0 comments on commit 5d588d2

Please sign in to comment.