Implement tests on the image #7
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: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- "main" | |
env: | |
TEST_TAG: jomik/screeps-server:test | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
node: [10, 12] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3 | |
- name: Build | |
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5 | |
with: | |
context: . | |
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: | | |
set -eu | |
docker run --rm -dPi --env STEAM_KEY --name screeps -v ${CONFIG_FILE}:/screeps/config.yml ${TEST_TAG} | |
until docker container inspect --format "{{json .State.Health.Status }}" screeps | \ | |
grep -m 1 "healthy"; \ | |
do sleep 1; \ | |
done | |
env: | |
STEAM_KEY: ${{ secrets.STEAM_KEY }} | |
CONFIG_FILE: ${{ format('{0}/{1}', github.workspace, 'test-config.yml') }} | |
- name: Test | |
run: | | |
docker ps |