Skip to content

Remove instruction to copy s2clientprotocol #277

Remove instruction to copy s2clientprotocol

Remove instruction to copy s2clientprotocol #277

Workflow file for this run

name: Build and push Docker image
# Only run if Dockerfile or docker-ci.yml changed
on:
push:
paths:
- dockerfiles/**
- uv.lock
- pyproject.toml
- .github/workflows/docker-ci.yml
pull_request:
branches:
- master
- develop
env:
VERSION_NUMBER: "1.0.7"
LATEST_PYTHON_VERSION: "3.14"
LATEST_SC2_VERSION: "4.10"
EXPERIMENTAL_PYTHON_VERSION: "3.15"
jobs:
download_sc2_maps:
name: Download and cache sc2 maps
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Cache sc2 maps
uses: actions/cache@v4
id: cache-sc2-maps
with:
path: |
dockerfiles/maps
key: ${{ runner.os }}-maps-${{ hashFiles('dockerfiles/maps/**') }}
restore-keys: |
${{ runner.os }}-maps-
- name: Download sc2 maps
run: sh dockerfiles/download_maps.sh
if: steps.cache-sc2-maps.outputs.cache-hit != 'true'
run_test_docker_image:
name: Run test_docker_image.sh
needs: [download_sc2_maps]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Cache sc2 maps
uses: actions/cache@v4
id: cache-sc2-maps
with:
path: |
dockerfiles/maps
key: ${{ runner.os }}-maps-${{ hashFiles('dockerfiles/maps/**') }}
restore-keys: |
${{ runner.os }}-maps-
- name: Download sc2 maps
run: sh dockerfiles/download_maps.sh
if: steps.cache-sc2-maps.outputs.cache-hit != 'true'
- name: Run shell script
env:
VERSION_NUMBER: ${{ env.VERSION_NUMBER }}
PYTHON_VERSION: ${{ env.LATEST_PYTHON_VERSION }}
SC2_VERSION: ${{ env.LATEST_SC2_VERSION }}
run: sh dockerfiles/test_docker_image.sh
run_test_new_python_version:
name: Run test_new_python_candidate.sh
needs: [download_sc2_maps]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Cache sc2 maps
uses: actions/cache@v4
id: cache-sc2-maps
with:
path: |
dockerfiles/maps
key: ${{ runner.os }}-maps-${{ hashFiles('dockerfiles/maps/**') }}
restore-keys: |
${{ runner.os }}-maps-
- name: Download sc2 maps
run: sh dockerfiles/download_maps.sh
if: steps.cache-sc2-maps.outputs.cache-hit != 'true'
- name: Run shell script
continue-on-error: true
env:
VERSION_NUMBER: ${{ env.VERSION_NUMBER }}
PYTHON_VERSION: ${{ env.EXPERIMENTAL_PYTHON_VERSION }}
SC2_VERSION: ${{ env.LATEST_SC2_VERSION }}
run: sh dockerfiles/test_new_python_candidate.sh
docker_build:
name: Build docker image
needs: [download_sc2_maps]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
sc2-version: ["4.10"]
env:
IMAGE_NAME: burnysc2/python-sc2-docker:py_${{ matrix.python-version }}-sc2_${{ matrix.sc2-version }}
BUILD_ARGS: --build-arg PYTHON_VERSION=${{ matrix.python-version }} --build-arg SC2_VERSION=${{ matrix.sc2-version }}
steps:
- uses: actions/checkout@v3
- name: Cache sc2 maps
uses: actions/cache@v4
id: cache-sc2-maps
with:
path: |
dockerfiles/maps
key: ${{ runner.os }}-maps-${{ hashFiles('dockerfiles/maps/**') }}
restore-keys: |
${{ runner.os }}-maps-
- name: Download sc2 maps
run: sh dockerfiles/download_maps.sh
if: steps.cache-sc2-maps.outputs.cache-hit != 'true'
- name: Build docker image
run: docker build -f dockerfiles/Dockerfile -t $IMAGE_NAME-v$VERSION_NUMBER $BUILD_ARGS .
- name: Run test bots on image
run: |
echo "Start container, override the default entrypoint"
docker run -i -d \
--name test_container \
--env 'PYTHONPATH=/root/python-sc2/' \
--entrypoint /bin/bash \
$IMAGE_NAME-v$VERSION_NUMBER
echo "Install python-sc2"
docker exec -i test_container mkdir -p /root/python-sc2
docker cp pyproject.toml test_container:/root/python-sc2/
docker cp uv.lock test_container:/root/python-sc2/
docker cp sc2 test_container:/root/python-sc2/sc2
docker cp test test_container:/root/python-sc2/test
docker cp examples test_container:/root/python-sc2/examples
docker exec -i test_container bash -c "pip install uv \
&& cd python-sc2 && uv sync --frozen --no-cache --no-install-project"
echo "Run various test bots"
docker exec -i test_container bash -c "cd python-sc2 && uv run python test/travis_test_script.py test/autotest_bot.py"
docker exec -i test_container bash -c "cd python-sc2 && uv run python test/run_example_bots_vs_computer.py"
- name: Login to DockerHub
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Upload docker image
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
run: docker push $IMAGE_NAME-v$VERSION_NUMBER
- name: Upload docker image as latest tag
if: github.ref == 'refs/heads/develop' && github.event_name == 'push' && matrix.python-version == env.LATEST_PYTHON_VERSION && matrix.sc2-version == env.LATEST_SC2_VERSION
run: |
docker tag $IMAGE_NAME-v$VERSION_NUMBER burnysc2/python-sc2-docker:latest
docker push burnysc2/python-sc2-docker:latest