1- name : Build and push Dockerfile
1+ name : Build and push Docker image
22
33# Only run if Dockerfile or docker-ci.yml changed
44on :
55 push :
66 paths :
7- - dockerfiles/**
8- - .github/workflows/docker-ci.yml
7+ - dockerfiles/**
8+ - uv.lock
9+ - pyproject.toml
10+ - .github/workflows/docker-ci.yml
911 pull_request :
1012 branches :
11- - master
12- - develop
13+ - master
14+ - develop
1315
1416env :
15- VERSION_NUMBER : ' 1.0.2 '
16- LATEST_PYTHON_VERSION : ' 3.11 '
17- LATEST_SC2_VERSION : ' 4.10'
18- EXPERIMENTAL_PYTHON_VERSION : ' 3.11.0b1 '
17+ VERSION_NUMBER : " 1.0.6 "
18+ LATEST_PYTHON_VERSION : " 3.13 "
19+ LATEST_SC2_VERSION : " 4.10"
20+ EXPERIMENTAL_PYTHON_VERSION : " 3.14 "
1921
2022jobs :
2123 run_test_docker_image :
@@ -28,20 +30,19 @@ jobs:
2830 os : [ubuntu-latest]
2931
3032 steps :
31- - uses : actions/checkout@v2
33+ - uses : actions/checkout@v3
3234
33- - name : Enable experimental docker features
34- run : |
35- echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
36- sudo systemctl restart docker.service
35+ - name : Enable experimental docker features
36+ run : |
37+ echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
38+ sudo systemctl restart docker.service
3739
38- - name : Run shell script
39- env :
40- VERSION_NUMBER : ${{ env.VERSION_NUMBER }}
41- PYTHON_VERSION : ${{ env.LATEST_PYTHON_VERSION }}
42- SC2_VERSION : ${{ env.LATEST_SC2_VERSION }}
43- run : |
44- sh dockerfiles/test_docker_image.sh
40+ - name : Run shell script
41+ env :
42+ VERSION_NUMBER : ${{ env.VERSION_NUMBER }}
43+ PYTHON_VERSION : ${{ env.LATEST_PYTHON_VERSION }}
44+ SC2_VERSION : ${{ env.LATEST_SC2_VERSION }}
45+ run : sh dockerfiles/test_docker_image.sh
4546
4647 run_test_new_python_version :
4748 name : Run test_new_python_candidate.sh
@@ -53,21 +54,20 @@ jobs:
5354 os : [ubuntu-latest]
5455
5556 steps :
56- - uses : actions/checkout@v2
57-
58- - name : Enable experimental docker features
59- run : |
60- echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
61- sudo systemctl restart docker.service
62-
63- - name : Run shell script
64- continue-on-error : true
65- env :
66- VERSION_NUMBER : ${{ env.VERSION_NUMBER }}
67- PYTHON_VERSION : ${{ env.EXPERIMENTAL_PYTHON_VERSION }}
68- SC2_VERSION : ${{ env.LATEST_SC2_VERSION }}
69- run : |
70- sh dockerfiles/test_new_python_candidate.sh
57+ - uses : actions/checkout@v3
58+
59+ - name : Enable experimental docker features
60+ run : |
61+ echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
62+ sudo systemctl restart docker.service
63+
64+ - name : Run shell script
65+ continue-on-error : true
66+ env :
67+ VERSION_NUMBER : ${{ env.VERSION_NUMBER }}
68+ PYTHON_VERSION : ${{ env.EXPERIMENTAL_PYTHON_VERSION }}
69+ SC2_VERSION : ${{ env.LATEST_SC2_VERSION }}
70+ run : sh dockerfiles/test_new_python_candidate.sh
7171
7272 docker_build :
7373 name : Build docker image
@@ -77,62 +77,65 @@ jobs:
7777 fail-fast : false
7878 matrix :
7979 os : [ubuntu-latest]
80- python-version : ['3.7', '3.8', '3.9', '3.10', '3.11' ]
81- sc2-version : [' 4.10' ]
80+ python-version : ["3.9", "3.10", "3.11", "3.12", "3.13" ]
81+ sc2-version : [" 4.10" ]
8282 env :
8383 IMAGE_NAME : burnysc2/python-sc2-docker:py_${{ matrix.python-version }}-sc2_${{ matrix.sc2-version }}
8484 BUILD_ARGS : --build-arg PYTHON_VERSION=${{ matrix.python-version }} --build-arg SC2_VERSION=${{ matrix.sc2-version }}
8585
8686 steps :
87- - uses : actions/checkout@v2
88-
89- - name : Build docker image
90- run : |
91- docker build -t $IMAGE_NAME-v$VERSION_NUMBER $BUILD_ARGS - < dockerfiles/Dockerfile
92-
93- - name : Enable experimental docker features
94- run : |
95- echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
96- sudo systemctl restart docker.service
97-
98- - name : Build squashed image
99- run : |
100- docker build -t $IMAGE_NAME-v$VERSION_NUMBER-squashed --squash $BUILD_ARGS - < dockerfiles/Dockerfile
101-
102- - name : Run test bots on squashed image
103- if : matrix.python-version != '3.7'
104- run : |
105- echo "Start container, override the default entrypoint"
106- docker run -i -d \
107- --name test_container \
108- --mount type=bind,source="$(pwd)",destination=/root/python-sc2,readonly \
109- --entrypoint /bin/bash \
110- $IMAGE_NAME-v$VERSION_NUMBER-squashed
111- echo "Install python-sc2"
112- docker exec -i test_container bash -c "pip install poetry \
113- && cd python-sc2 && poetry install --no-dev"
114- echo "Run various test bots"
115- docker exec -i test_container bash -c "cd python-sc2 && poetry run python test/travis_test_script.py test/autotest_bot.py"
116- docker exec -i test_container bash -c "cd python-sc2 && poetry run python test/run_example_bots_vs_computer.py"
117-
118- - name : Login to DockerHub
119- uses : docker/login-action@v2
120- with :
121- username : ${{ secrets.DOCKERHUB_USERNAME }}
122- password : ${{ secrets.DOCKERHUB_TOKEN }}
123-
124- - name : Upload docker image
125- if : github.ref == 'refs/heads/develop' && github.event_name == 'push'
126- run : |
127- docker push $IMAGE_NAME-v$VERSION_NUMBER
128-
129- - name : Upload squashed docker image
130- if : github.ref == 'refs/heads/develop' && github.event_name == 'push'
131- run : |
132- docker push $IMAGE_NAME-v$VERSION_NUMBER-squashed
133-
134- - name : Upload squashed docker image as latest tag
135- if : github.ref == 'refs/heads/develop' && github.event_name == 'push' && matrix.python-version == env.LATEST_PYTHON_VERSION && matrix.sc2-version == env.LATEST_SC2_VERSION
136- run : |
137- docker tag $IMAGE_NAME-v$VERSION_NUMBER-squashed burnysc2/python-sc2-docker:latest
138- docker push burnysc2/python-sc2-docker:latest
87+ - uses : actions/checkout@v3
88+
89+ - name : Build docker image
90+ run : docker build -t $IMAGE_NAME-v$VERSION_NUMBER $BUILD_ARGS - < dockerfiles/Dockerfile
91+
92+ - name : Enable experimental docker features
93+ run : |
94+ echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
95+ sudo systemctl restart docker.service
96+
97+ - name : Build squashed image
98+ run : docker build -t $IMAGE_NAME-v$VERSION_NUMBER-squashed --squash $BUILD_ARGS - < dockerfiles/Dockerfile
99+
100+ - name : Run test bots on squashed image
101+ if : matrix.python-version != '3.7'
102+ run : |
103+ echo "Start container, override the default entrypoint"
104+ docker run -i -d \
105+ --name test_container \
106+ --env 'PYTHONPATH=/root/python-sc2/' \
107+ --entrypoint /bin/bash \
108+ $IMAGE_NAME-v$VERSION_NUMBER-squashed
109+ echo "Install python-sc2"
110+ docker exec -i test_container mkdir -p /root/python-sc2
111+ docker cp pyproject.toml test_container:/root/python-sc2/
112+ docker cp uv.lock test_container:/root/python-sc2/
113+ docker cp sc2 test_container:/root/python-sc2/sc2
114+ docker cp test test_container:/root/python-sc2/test
115+ docker cp examples test_container:/root/python-sc2/examples
116+ docker exec -i test_container bash -c "pip install uv \
117+ && cd python-sc2 && uv sync --frozen --no-cache --no-install-project"
118+ echo "Run various test bots"
119+ docker exec -i test_container bash -c "cd python-sc2 && uv run python test/travis_test_script.py test/autotest_bot.py"
120+ docker exec -i test_container bash -c "cd python-sc2 && uv run python test/run_example_bots_vs_computer.py"
121+
122+ - name : Login to DockerHub
123+ if : github.ref == 'refs/heads/develop'
124+ uses : docker/login-action@v2
125+ with :
126+ username : ${{ secrets.DOCKERHUB_USERNAME }}
127+ password : ${{ secrets.DOCKERHUB_TOKEN }}
128+
129+ - name : Upload docker image
130+ if : github.ref == 'refs/heads/develop' && github.event_name == 'push'
131+ run : docker push $IMAGE_NAME-v$VERSION_NUMBER
132+
133+ - name : Upload squashed docker image
134+ if : github.ref == 'refs/heads/develop' && github.event_name == 'push'
135+ run : docker push $IMAGE_NAME-v$VERSION_NUMBER-squashed
136+
137+ - name : Upload squashed docker image as latest tag
138+ if : github.ref == 'refs/heads/develop' && github.event_name == 'push' && matrix.python-version == env.LATEST_PYTHON_VERSION && matrix.sc2-version == env.LATEST_SC2_VERSION
139+ run : |
140+ docker tag $IMAGE_NAME-v$VERSION_NUMBER-squashed burnysc2/python-sc2-docker:latest
141+ docker push burnysc2/python-sc2-docker:latest
0 commit comments