Skip to content

Commit

Permalink
refactored unittests and workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
jammsen committed Jan 26, 2025
1 parent 6ce1033 commit 15af830
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
name: docker-build-and-push-ci
name: docker-build-and-push-develop-ci

on:
push:
branches:
- 'refactor-steam-user-jail'
workflow_run:
workflows:
- Unit-test # Wait for the "Unit-test" workflow to complete
types:
- completed # Trigger only when "Unit-test" completes

jobs:
docker-build-gameserver-image:
if: ${{ github.event.workflow_run.conclusion == 'success' && github.ref == 'refs/heads/develop' }} # Run only if tests pass and branch is "develop"
runs-on: ubuntu-latest
steps:
-
Expand All @@ -29,4 +32,4 @@ jobs:
uses: docker/build-push-action@v4
with:
push: true
tags: jammsen/the-forest-dedicated-server:refactor-steam-user-jail
tags: jammsen/the-forest-dedicated-server:develop
11 changes: 7 additions & 4 deletions .github/workflows/docker-build-and-push-prod.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
name: docker-build-and-push-ci
name: docker-build-and-push-master-ci

on:
push:
branches:
- 'master'
workflow_run:
workflows:
- Unit-test # Wait for the "Unit-test" workflow to complete
types:
- completed # Trigger only when "Unit-test" completes

jobs:
docker-build-gameserver-image:
if: ${{ github.event.workflow_run.conclusion == 'success' && github.ref == 'refs/heads/master' }} # Run only if tests pass and branch is "develop"
runs-on: ubuntu-latest
steps:
-
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
---
name: Unit-test
on:
push: # Triggers the workflow on every commit to any branch
on:
push:
branches:
- '**'
pull_request: # Triggers the workflow on every pull request
- develop # Run tests on commit to the develop branch
- master # Run tests on commit to the master branch
pull_request: # Run tests on all pull requests
workflow_call: # Allow this workflow to be called by other workflows

concurrency:
group: '${{ github.workflow }} @ ${{ github.ref }}'
Expand Down Expand Up @@ -47,6 +49,9 @@ jobs:
TIMEOUT_SECONDS=180
START_TIME=$(date +%s)
# Set the timezone to Germany (Central European Time)
export TZ=Europe/Berlin
while ! docker logs the-forest-dedicated-server 2>&1 | grep -q "Game autosave started"; do
CURRENT_TIME=$(date +%s)
ELAPSED_TIME=$((CURRENT_TIME - START_TIME))
Expand All @@ -58,7 +63,7 @@ jobs:
exit 1
fi
echo "Waiting for server to start..."
echo "$(date '+%H:%M:%S') - Waiting for server to start..."
sleep 5
done
Expand Down

0 comments on commit 15af830

Please sign in to comment.