Check if the web build is working every time a commit is pushed

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
MynameisBI
Prole
Posts: 7
Joined: Sun Dec 15, 2019 1:16 pm

Check if the web build is working every time a commit is pushed

Post by MynameisBI »

In the past couple of days, I've been trying to make it so every time someone push their commit to the repository, it will automatically check if the web build have any errors.

What I've done so far is creating a workflow that builds a web package with Davidobot/love.js and host it with a python http.server. What I've been struggling is I don't really know how to check whether the application has any error since it print out the error in the web console instead of the command line so the workflow can't detect the error.

The Command Prompt and Console for the bug-free version and the error version.

How can I achieve this automatic check and travel to the CI/CD dimension.
User avatar
dusoft
Party member
Posts: 635
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Check if the web build is working every time a commit is pushed

Post by dusoft »

Maybe use a tool like shot-scraper or other headless solution.
Xugro
Party member
Posts: 114
Joined: Wed Sep 29, 2010 8:14 pm

Re: Check if the web build is working every time a commit is pushed

Post by Xugro »

You can start chrome (or chromium based browsers) with debug output enabled (source):

Code: Select all

chromium --log-level=0 --enable-logging=stderr
Then everything that is printed in the web console is also printed to the command line where chrome was started.

Here an simple example javascript in a file called love.js:

Code: Select all

console.log("Hello World!");
And here the command line output:

Code: Select all

[13375:13375:1206/212614.492854:INFO:CONSOLE(1)] "Hello World!", source: http://0.0.0.0:8000/love.js (1)
You can also pipe the debug output into a file:

Code: Select all

chromium --log-level=0 --enable-logging=stderr > /tmp/ci/cd/chrome.log
And analyse that file later.

But this will only tell you if the game is starting at all. It does not tell you if the game works. The game could crash after clicking the first button. If you want to test you game in the pipeline you have to write a bot, that can play it. If it is a turn based game, this could work by taking screenshots, using image recognition (e.g. with OpenCV) and then clicking/typing like a user would. For the browser you could use browser automation tools like Selenium. If it is a real time game this will get very difficult.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 4 guests