chore(deps): lock file maintenance #259
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: [10, 12] | |
steps: | |
- name: Get merge commit sha | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 | |
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
ref: ${{ steps.pr.outputs.result }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3 | |
- name: Build | |
uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d # v6 | |
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 | |
uses: stringbean/docker-healthcheck-action@a958d329225ccbd485766815734e01c335e62bd4 # v3 | |
with: | |
container: screeps | |
wait-time: 60 | |
require-status: running | |
require-healthy: true | |
- 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 |