Skip to content

fix: added default steam_appid #2

fix: added default steam_appid

fix: added default steam_appid #2

Workflow file for this run

---
name: Unit-test
on:
push:
branches:
- 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 }}'
cancel-in-progress: true
jobs:
unit-test-amd64:
name: Docker - Test Linux-amd64 image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and export to Docker
uses: docker/build-push-action@v6
with:
file: ./Dockerfile
load: true
tags: ${{ github.run_id }}
platforms: linux/amd64
- name: Run server
run: |
docker run -d \
--name sons-of-the-forest-dedicated-server \
-p 8766:8766/udp \
-p 27016:27016/udp \
-p 9700:9700/udp \
-v ./game:/sonsoftheforest/ \
--restart unless-stopped \
--stop-timeout 30 \
${{ github.run_id }}
- name: Wait for server to start
run: |
TIMEOUT_SECONDS=240
START_TIME=$(date +%s)
# Set the timezone to Germany (Central European Time)
export TZ=Europe/Berlin
while ! docker logs sons-of-the-forest-dedicated-server 2>&1 | grep -q "#DSL Dedicated server loaded."; do
CURRENT_TIME=$(date +%s)
ELAPSED_TIME=$((CURRENT_TIME - START_TIME))
if [ $ELAPSED_TIME -gt $TIMEOUT_SECONDS ]; then
echo "Timeout reached. Server failed to start within $TIMEOUT_SECONDS seconds."
printf "\e[0;32m%s\e[0m\n" "*****Container LOGS*****"
docker logs sons-of-the-forest-dedicated-server
exit 1
fi
echo "$(date '+%H:%M:%S') - Waiting for server to start..."
sleep 5
done
- name: Test if port 8766, 27015 and 27016 are listening
run: |
nc -z -u -v 127.0.0.1 8766 || exit 2
nc -z -u -v 127.0.0.1 27016 || exit 3
nc -z -u -v 127.0.0.1 9700 || exit 4
- name: Stop server
if: always()
run: |
docker stop sons-of-the-forest-dedicated-server
docker rm sons-of-the-forest-dedicated-server
docker rmi ${{ github.run_id }}