Skip to content

Commit 9e6616d

Browse files
author
Bytekeeper
committed
Added integration test:
* Marine Hell (jbwapibot) vs Sitting Duck -> Marine Hell should win * Using sc-docker to run this test * Adding more bots should be easy and pom files could be used as basis for new bots
1 parent ca01859 commit 9e6616d

File tree

9 files changed

+187
-1
lines changed

9 files changed

+187
-1
lines changed

.travis.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
1-
language: java
1+
dist: trusty
2+
language: python
3+
python:
4+
- "3.6"
5+
services:
6+
- docker
7+
before_install:
8+
- jdk_switcher use oraclejdk8
9+
before_script:
10+
- git clone https://github.com/Bytekeeper/sc-docker.git
11+
- cp it/sc-docker-support/*.dockerfile sc-docker/docker/dockerfiles
12+
- pushd sc-docker
13+
- python3 setup.py bdist_wheel
14+
- pip3 install dist/scbw*.whl
15+
- cd docker
16+
- ./build_images.sh
17+
- popd
18+
- scbw.play --install
19+
script:
20+
- sh mvnw clean install
21+
- sh mvnw -f it/bots/pom.xml package
22+
- for bot in $(ls -d it/bots/*/); do BOTNAME=$(basename $bot); echo "Setting up $BOTNAME"; mkdir -p "$HOME/.scbw/bots/$BOTNAME/AI" "$HOME/.scbw/bots/$BOTNAME/read" "$HOME/.scbw/bots/$BOTNAME/write"; cp it/sc-docker-support/BWAPI.dll "$HOME/.scbw/bots/$BOTNAME"; cp "$bot/target/"*-with-dependencies.jar "$HOME/.scbw/bots/$BOTNAME/AI"; cp "$bot/bot.json" "$HOME/.scbw/bots/$BOTNAME"; done
23+
- scbw.play --headless --bots jbwapibot SittingDuck --timeout 180 --docker_image starcraft:game 2>&1 | grep 'Winner is BotPlayer:jbwapibot:T' || (cat $HOME/.scbw/games/*/logs_0/* && false)

it/bots/SittingDuck/bot.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"SittingDuck","race":"Zerg","botType":"JAVA_MIRROR"}

it/bots/SittingDuck/pom.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<name>Sitting duck for integration tests</name>
8+
9+
<parent>
10+
<groupId>jbwapi.it</groupId>
11+
<artifactId>bots</artifactId>
12+
<version>0.6</version>
13+
</parent>
14+
15+
<artifactId>SittingDuck</artifactId>
16+
17+
<build>
18+
<plugins>
19+
<plugin>
20+
<groupId>org.apache.maven.plugins</groupId>
21+
<artifactId>maven-assembly-plugin</artifactId>
22+
<version>3.1.0</version>
23+
<configuration>
24+
<archive>
25+
<manifest>
26+
<mainClass>SittingDuck</mainClass>
27+
</manifest>
28+
</archive>
29+
<descriptorRefs>
30+
<descriptorRef>jar-with-dependencies</descriptorRef>
31+
</descriptorRefs>
32+
</configuration>
33+
<executions>
34+
<execution>
35+
<phase>package</phase>
36+
<goals>
37+
<goal>single</goal>
38+
</goals>
39+
</execution>
40+
</executions>
41+
</plugin>
42+
</plugins>
43+
</build>
44+
</project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import bwapi.DefaultBWListener;
2+
3+
public class SittingDuck extends DefaultBWListener {
4+
}

it/bots/jbwapibot/bot.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"jbwapibot","race":"Terran","botType":"JAVA_MIRROR"}

it/bots/jbwapibot/pom.xml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<name>MarineHell test build for integration test</name>
8+
9+
<parent>
10+
<groupId>jbwapi.it</groupId>
11+
<artifactId>bots</artifactId>
12+
<version>0.6</version>
13+
</parent>
14+
15+
<artifactId>MarineHell</artifactId>
16+
17+
<properties>
18+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
19+
</properties>
20+
21+
<build>
22+
<plugins>
23+
<plugin>
24+
<groupId>org.apache.maven.plugins</groupId>
25+
<artifactId>maven-assembly-plugin</artifactId>
26+
<configuration>
27+
<archive>
28+
<manifest>
29+
<mainClass>MarineHell</mainClass>
30+
</manifest>
31+
</archive>
32+
<descriptorRefs>
33+
<descriptorRef>jar-with-dependencies</descriptorRef>
34+
</descriptorRefs>
35+
</configuration>
36+
<executions>
37+
<execution>
38+
<phase>package</phase>
39+
<goals>
40+
<goal>single</goal>
41+
</goals>
42+
</execution>
43+
</executions>
44+
</plugin>
45+
</plugins>
46+
<sourceDirectory>${maven.multiModuleProjectDirectory}/src/test/java/marinehell</sourceDirectory>
47+
</build>
48+
</project>

it/bots/pom.xml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<packaging>pom</packaging>
7+
8+
<name>IT Bots parent</name>
9+
10+
<groupId>jbwapi.it</groupId>
11+
<artifactId>bots</artifactId>
12+
<version>0.6</version>
13+
14+
<properties>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
</properties>
17+
18+
<modules>
19+
<module>jbwapibot</module>
20+
<module>SittingDuck</module>
21+
</modules>
22+
23+
<build>
24+
<plugins>
25+
<plugin>
26+
<groupId>org.apache.maven.plugins</groupId>
27+
<artifactId>maven-compiler-plugin</artifactId>
28+
<version>3.8.0</version>
29+
<configuration>
30+
<source>8</source>
31+
<target>8</target>
32+
</configuration>
33+
</plugin>
34+
<plugin>
35+
<groupId>org.apache.maven.plugins</groupId>
36+
<artifactId>maven-assembly-plugin</artifactId>
37+
<version>3.1.0</version>
38+
</plugin>
39+
</plugins>
40+
</build>
41+
42+
<dependencies>
43+
<dependency>
44+
<groupId>jbwapi</groupId>
45+
<artifactId>jbwapi</artifactId>
46+
<version>0.6</version>
47+
</dependency>
48+
</dependencies>
49+
</project>

it/sc-docker-support/BWAPI.dll

579 KB
Binary file not shown.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM starcraft:play
2+
LABEL maintainer="Michal Sustr <michal.sustr@aic.fel.cvut.cz>"
3+
4+
5+
ENV JAVA_DIR="$APP_DIR/java"
6+
7+
#####################################################################
8+
USER starcraft
9+
WORKDIR $APP_DIR
10+
11+
ADD --chown=starcraft:users https://d2znqt9b1bc64u.cloudfront.net/amazon-corretto-8.202.08.2-windows-x86-jre.zip jre.zip
12+
RUN set -x \
13+
&& unzip jre.zip\
14+
&& mv jre1.8.0_202/ $JAVA_DIR/ \
15+
&& rm jre.zip
16+
17+
COPY scripts/win_java32 /usr/bin/win_java32

0 commit comments

Comments
 (0)