Skip to content

chore(deps): lock file maintenance #695

chore(deps): lock file maintenance

chore(deps): lock file maintenance #695

Workflow file for this run

name: Test server image
on:
pull_request_target:
branches:
- "main"
env:
TEST_TAG: jomik/screeps-server:test
permissions: "read-all"
jobs:
test-image:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: [22, 24]
steps:
- name: Get merge commit sha
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
id: pr
with:
result-encoding: string
script: |
const { data } = await github.rest.pulls.get({
...context.repo,
pull_number: context.payload.pull_request.number,
});
return data.merge_commit_sha;
- name: Checkout merge commit
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
ref: ${{ steps.pr.outputs.result }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4
- name: Build
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7
with:
context: server
build-args: |
NODE_VERSION=${{ matrix.node }}
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ env.TEST_TAG }}
load: true
- name: Start the container
run: |
docker run -d -p 21025:21025 -p 21028:21028 --env STEAM_KEY --name screeps -v ${CONFIG_FILE}:/screeps/config.yml ${TEST_TAG}
env:
STEAM_KEY: ${{ secrets.STEAM_KEY }}
CONFIG_FILE: ${{ format('{0}/{1}', github.workspace, 'test-config.yml') }}
- name: Wait for container to be healthy
run: |
timeout=60
while [ "$timeout" -gt 0 ]; do
status=$(docker inspect --format='{{.State.Status}}' screeps 2>/dev/null || echo "missing")
if [ "$status" != "running" ] && [ "$status" != "created" ]; then
echo "Container exited unexpectedly (status: $status)"
exit 1
fi
health=$(docker inspect --format='{{.State.Health.Status}}' screeps 2>/dev/null || echo "starting")
if [ "$health" = "healthy" ]; then
echo "Container is healthy"
exit 0
fi
sleep 2
timeout=$((timeout - 2))
done
echo "Container not healthy after 60s (health: $health)"
exit 1
- name: Show container logs
if: always()
run: docker container logs screeps
- name: Check that mods are registered
run: |
set -eu
server_data=$(curl http://localhost:21025/api/version | jq -c '.serverData')
echo $server_data | jq -e '.features | any(.name == "screepsmod-auth")'
echo $server_data | jq -e '.features | any(.name == "screepsmod-admin-utils")'
echo $server_data | jq -e '.features | any(.name == "screepsmod-cli")'
- name: Check that bots are registered
run: |
set -eu
bots=$(curl -X POST http://localhost:21028/cli -d "help(bots)" | grep -A 10 "Bot AIs:")
echo $bots | grep 'simplebot' | grep "screepsbot-zeswarm"
- name: Stop container
if: always()
run: docker container stop screeps