Jasper-ketelaar / Asteroids-group-7

Asteroids game for Software Engineering Methods at TU Delft
0 stars 0 forks source link

Travis CI - org.lwjgl.LWJGLException: No display mode extension is available #38

Closed Jasper-ketelaar closed 8 years ago

Jasper-ketelaar commented 8 years ago

org.lwjgl.LWJGLException: No display mode extension is available

Thrown when travis is building because travis allows no display. Attempted a lot of things last night, none sticked. Still a standing issue.

Jasper-ketelaar commented 8 years ago

Mail sent to TA and all of you. Put it here for ease of access.

Dear Jean,

I am unsure of whether or not you have much experience with testing with Slick but I have an issue. https://github.com/Jasper-ketelaar/Asteroids-group-7/issues/38

As described in the above github issue. When running tests for Slick, LWJGL requires a display to be active, now I can create a ‘test’ display in order to test our components and this works perfectly fine locally, however builds on travis fail due to travis not having a display.

There is a way for travis CI to ‘fake’ a display like so:

before_script:
  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"
  - sleep 3 # give xvfb some time to start

However I’ve tried this and it doesn’t seem to do anything. I’ve tried a lot of things but to no avail. Is there a solution you may be able to come up with? Or maybe an alternative option?

Kind regards, Jasper.

Jasper-ketelaar commented 8 years ago

Looks like we'll need the following in our pom to exclude display tests from Travis CI as even the developers of the Slick2D library have no other solution:

 +     <profile>
 +  <!-- Disable unit tests that require a display when run under Travis CI-->
 +      <activation>
 +          <property>
 +              <name>env.TRAVIS_CI</name>
 +          </property>
 +      </activation>
 +      <build>
 +          <plugins>
 +              <plugin>
 +                  <groupId>org.apache.maven.plugins</groupId>
 +                  <artifactId>maven-surefire-plugin</artifactId>
 +                  <configuration>
 +                      <excludedGroups>display</excludedGroups>
 +                  </configuration>
 +              </plugin>
 +          </plugins>
 +      </build>
 +  </profile>

Adding the following to travis yml:

env:
    - TRAVIS_CI=true

Tagging display tests using: @Test(groups="display")

I will create an example test on this branch, update the pom.xml and merge with master somewhere this afternoon. Consider this issue 'solved'.

Jasper-ketelaar commented 8 years ago

Reference by the way: https://github.com/nguillaumin/slick2d-maven/pull/18/commits/bbbcdb67cfbe01e8c72e1722dc72ff3c252a8a7b (From official slick repo)

Jasper-ketelaar commented 8 years ago

Closed.. I guess