diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 40b58675..a9480613 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -219,7 +219,7 @@ jobs: shell: bash run: | set -eux - ARGS="--build-dir=build/ ${{ steps.setup-godot.outputs.EXTRA_RUN_TESTS_ARGS }} -- --headless" + ARGS="--build-dir=build/ ${{ steps.setup-godot.outputs.EXTRA_RUN_TESTS_ARGS }} --copy-gdextension-api -- --headless" python tests/run.py 0-gdscript $ARGS python tests/run.py 1-gdextension $ARGS python tests/run.py 2-pythonscript-init $ARGS diff --git a/tests/run.py b/tests/run.py index 085c9bc9..4f2c6f7a 100644 --- a/tests/run.py +++ b/tests/run.py @@ -114,7 +114,9 @@ def symlink(src: Path, dst: Path) -> None: os.symlink(str(src.resolve()), str(dst.resolve())) -def create_test_workdir(test_dir: Path, distrib_workdir: Path, test_workdir: Path) -> None: +def create_test_workdir( + test_dir: Path, distrib_workdir: Path, test_workdir: Path, copy_gdextension_api: bool +) -> None: print( f"{YELLOW}{test_dir.name}: Create&populate test workdir in {test_workdir}{NO_COLOR}", flush=True, @@ -123,7 +125,10 @@ def create_test_workdir(test_dir: Path, distrib_workdir: Path, test_workdir: Pat symlink(distrib_workdir / "addons", test_workdir / "addons") shutil.copy(distrib_workdir / "pythonscript.gdextension", test_workdir) # GDExtension headers are needed to compile Cython modules - symlink(build_dir / "gdextension_api", test_workdir / "gdextension_api") + if copy_gdextension_api: + shutil.copytree(build_dir / "gdextension_api", test_workdir / "gdextension_api") + else: + symlink(build_dir / "gdextension_api", test_workdir / "gdextension_api") build_script = test_workdir / "build.py" if build_script.exists(): @@ -236,6 +241,11 @@ def run_test( if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("tests", nargs="*", help="Filter the tests to run") + parser.add_argument( + "--copy-gdextension-api", + action="store_true", + help="Copy GDExtension API folder instead of symlink (useful if you have issues on Windows)", + ) parser.add_argument( "--build-dir", type=Path, @@ -312,5 +322,6 @@ def test_workdir_factory(): test_dir=test_dir, distrib_workdir=distrib_workdir, test_workdir=test_workdir, + copy_gdextension_api=args.copy_gdextension_api, ) run_test(test_dir.name, test_workdir, godot_binary_path, godot_extra_args)