Skip to content

Commit

Permalink
GD-19: Remove custom update Godot project cache scripts
Browse files Browse the repository at this point in the history
# Why
The scripts will not compile when a user has the warning as error set.
It also not needs anymore to do rebuild the cache since Godot provides the option `--quit-after 20``

# What
- Removed the related gd Scripts
- add new step before running the tests to run godot in headles mode to restore the cache
  • Loading branch information
MikeSchulze committed Mar 1, 2024
1 parent cb06c1e commit 60d2de8
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 344 deletions.
99 changes: 0 additions & 99 deletions .gdunit4_action/scripts/build_project.gd

This file was deleted.

146 changes: 0 additions & 146 deletions .gdunit4_action/scripts/console.gd

This file was deleted.

62 changes: 0 additions & 62 deletions .gdunit4_action/unit-test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,70 +24,8 @@ function console_error(...args) {
console.log('\x1b[31m', 'ERROR:', ...args, '\x1b[0m');
}


async function rebuildProjectCache() {
const args = [
"--auto-servernum",
`${process.env.GODOT_BIN}`,
"--headless",
"--audio-driver Dummy",
"-e",
"--path .",
"-s res://.gdunit4_action/scripts/build_project.gd",
];

const child = spawnSync("xvfb-run", args, {
cwd: getProjectPath(),
timeout: 1000 * 60,
encoding: "utf-8",
shell: true,
stdio: ["ignore", "ignore", "ignore"],
env: process.env,
});
return child.status;
}


async function rebuildProjectCache_() {
const args = [
"--auto-servernum",
`${process.env.GODOT_BIN}`,
"--headless",
"--audio-driver Dummy",
"-e",
"--path .",
"-s res://.gdunit4_action/scripts/build_project.gd",
];

// Use spawn instead of spawnSync
const child = spawn("xvfb-run", args, {
cwd: getProjectPath(),
timeout: 1000 * 60,
stdio: ["pipe", "pipe", "ignore"], // Redirect stderr to dev/null
env: process.env,
});

// Return a promise that resolves when the process exits
return new Promise((resolve, reject) => {
child.stdout.on('data', (data) => console.log(data.toString()));
child.on('close', (code) => resolve(code));
child.on('error', (err) => {
reject(`Error spawning process: ${err}`);
});
});
}


async function runTests(exeArgs, core) {
try {
console_info("Start of the recovery of the project cache ...");
let exitCode = await rebuildProjectCache();
if (exitCode !== 0) {
console_error(`Rebuild project cache failed with exit code ${exitCode}. Aborting tests.`);
return exitCode;
}
console_info("Project cache successfully restored.");

const { timeout, paths, arguments, retries } = exeArgs;
// Split by newline or comma, map, trim, and filter empty strings
const pathsArray = paths.split(/[\r\n,]+/).map((entry) => entry.trim()).filter(Boolean);
Expand Down
Loading

0 comments on commit 60d2de8

Please sign in to comment.