Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Changing Oolite...

General discussion for players of Oolite.

Moderators: winston, another_commander

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6570
Joined: Wed Feb 28, 2007 7:54 am

Re: Changing Oolite...

Post by another_commander »

I believe Oolite can be checked out anywhere. As long as you cd to the oolite root checkout folder before executing the make command, you should be good to go.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6570
Joined: Wed Feb 28, 2007 7:54 am

Re: Changing Oolite...

Post by another_commander »

@hiran: I see you are attempting to execute msys.bat from within Powershell. Instead of this:

Code: Select all

$workspace = $env:GITHUB_WORKSPACE
Invoke-Command -FilePath "$(workspace)\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat"
do this:

Code: Select all

& "$env:GITHUB_WORKSPACE\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat"
Note the ampersand at the beginning of the command.
User avatar
hiran
Theorethicist
Posts: 2195
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: Changing Oolite...

Post by hiran »

another_commander wrote: Sat Jan 08, 2022 8:04 pm
@hiran: I see you are attempting to execute msys.bat from within Powershell. Instead of this:

Code: Select all

$workspace = $env:GITHUB_WORKSPACE
Invoke-Command -FilePath "$(workspace)\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat"
do this:

Code: Select all

& "$env:GITHUB_WORKSPACE\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat"
Note the ampersand at the beginning of the command.
I was just about to give up when I saw your hint. It is active now...
... but does not do much?

I am unfamiliar to Powershell, thus I was fighting with simple stuff that I cannot try out elsewhere.
But it seems we are still not getting forward. Something is missing.
Sunshine - Moonlight - Good Times - Oolite
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6570
Joined: Wed Feb 28, 2007 7:54 am

Re: Changing Oolite...

Post by another_commander »

It does not do much because running msys.bat on its own just opens up a shell. You need to actually execute the make command mentioned earlier and the best way to do this is to add it at the end of the etc/profile file.

Oh, and make sure that when checking out oolite the project submodules are also checked out.
User avatar
hiran
Theorethicist
Posts: 2195
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: Changing Oolite...

Post by hiran »

another_commander wrote: Sat Jan 08, 2022 9:18 pm
It does not do much because running msys.bat on its own just opens up a shell. You need to actually execute the make command mentioned earlier and the best way to do this is to add it at the end of the etc/profile file.

Oh, and make sure that when checking out oolite the project submodules are also checked out.
I'd back off from hardcoding that command in the

Code: Select all

oolite-windows-build-env
repository. This would render it unusable for other builders.
Yet we have to change something to remove the need for interactivity.

How about we change the batch file such that it allows one parameter. If that is not set, it behaves the same way it does now. But when set, it would just run this command, similarly as if it were the last line of the profile command.
It would leave more flexibility in using that stuff. What do you think?

Regarding the submodules: How do I ensure they get checked out as well?
Sunshine - Moonlight - Good Times - Oolite
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6570
Joined: Wed Feb 28, 2007 7:54 am

Re: Changing Oolite...

Post by another_commander »

hiran wrote: Sat Jan 08, 2022 9:24 pm
How about we change the batch file such that it allows one parameter. If that is not set, it behaves the same way it does now. But when set, it would just run this command, similarly as if it were the last line of the profile command.
It would leave more flexibility in using that stuff. What do you think?
Or maybe read an environment variable in profile and, if set, execute the make command? I believe you can initialize such an env var at the start of the build workflow.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6570
Joined: Wed Feb 28, 2007 7:54 am

Re: Changing Oolite...

Post by another_commander »

You can actually read the already existing GITHUB_WORKFLOW environment variable.

Just add this to the end of etc/profile:

Code: Select all

if [ ! -z "$GITHUB_WORKFLOW" ]; then
  cd "$GITHUB_WORKSPACE"
  make -fMakefile pkg-win-snapshot
fi
If someone wants to use the dev environment to build and debug or develop the game further, they can do it just fine. But when run from a github action, the above will execute an automatic build.

Now, if the build starts but you get errors after that, then this will probably mean that the submodules were not checked out. I am not sure how github actions ensure that any eventual submodules can be checked out together with the main project repository. This will be left as an exercise for the reader.
User avatar
hiran
Theorethicist
Posts: 2195
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: Changing Oolite...

Post by hiran »

another_commander wrote: Sat Jan 08, 2022 11:06 pm
You can actually read the already existing GITHUB_WORKFLOW environment variable.

Just add this to the end of etc/profile:

Code: Select all

if [ ! -z "$GITHUB_WORKFLOW" ]; then
  cd "$GITHUB_WORKSPACE"
  make -fMakefile pkg-win-snapshot
fi
If someone wants to use the dev environment to build and debug or develop the game further, they can do it just fine. But when run from a github action, the above will execute an automatic build.

Now, if the build starts but you get errors after that, then this will probably mean that the submodules were not checked out. I am not sure how github actions ensure that any eventual submodules can be checked out together with the main project repository. This will be left as an exercise for the reader.
I managed to get the submodules.
A added your suggestion to the profile script.

My gut feeling is that the compile step should generate more output than it actually does...

Code: Select all

Run & "$env:GITHUB_WORKSPACE\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat"
  & "$env:GITHUB_WORKSPACE\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat"
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
Sunshine - Moonlight - Good Times - Oolite
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6570
Joined: Wed Feb 28, 2007 7:54 am

Re: Changing Oolite...

Post by another_commander »

hiran wrote: Sun Jan 09, 2022 5:28 pm
My gut feeling is that the compile step should generate more output than it actually does...

Code: Select all

Run & "$env:GITHUB_WORKSPACE\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat"
  & "$env:GITHUB_WORKSPACE\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat"
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
Hmm... Please try substituting the line

Code: Select all

& "$env:GITHUB_WORKSPACE\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat"
inside build-windows.yml, with

Code: Select all

%GITHUB_WORKSPACE%\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat
I hope this will make it work.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6570
Joined: Wed Feb 28, 2007 7:54 am

Re: Changing Oolite...

Post by another_commander »

It failed...

Can you try one thing please? Just hard-code the path in the run command for the compile. Like this:

Code: Select all

D:\a\oolite\oolite\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat
Can't think of a way to translate that GITHUB_WORKSPACE to D:\a\oolite\oolite. Just try this to see if it works.

Edit: You can also try adding shell: cmd in the run section of the compile action like this:

Code: Select all

- run: |
    ...
  shell: cmd
to try to avoid the powershell shenanigans.
User avatar
hiran
Theorethicist
Posts: 2195
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: Changing Oolite...

Post by hiran »

another_commander wrote: Sun Jan 09, 2022 6:15 pm
Hmm... Please try substituting the line

Code: Select all

& "$env:GITHUB_WORKSPACE\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat"
inside build-windows.yml, with

Code: Select all

%GITHUB_WORKSPACE%\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat
I hope this will make it work.

Code: Select all

2022-01-09T18:49:18.4927847Z ##[group]Run %GITHUB_WORKSPACE%\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat
2022-01-09T18:49:18.4929236Z [36;1m%GITHUB_WORKSPACE%\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat[0m
2022-01-09T18:49:18.5004768Z shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
2022-01-09T18:49:18.5005411Z ##[endgroup]
2022-01-09T18:49:20.5103692Z [91m%GITHUB_WORKSPACE%\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat: [0mD:\a\_temp\33675a18-99bb-4fef-8c14-c8dc77a583e5.ps1:2
2022-01-09T18:49:20.5106209Z [96mLine |
2022-01-09T18:49:20.5107715Z [96m   2 | [0m [96m%GITHUB_WORKSPACE%\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat[0m
Maybe we should switch the shell, but command.com is not available (no surprise here)...
https://docs.github.com/en/actions/lear ... stepsshell
How about cmd.exe?



Edit: I'm afraid that did not help either.

Code: Select all

2022-01-09T19:13:33.9797715Z ##[group]Run %GITHUB_WORKSPACE%\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat
2022-01-09T19:13:33.9799446Z [36;1m%GITHUB_WORKSPACE%\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat[0m
2022-01-09T19:13:33.9850708Z shell: C:\Windows\system32\cmd.EXE /D /E:ON /V:OFF /S /C "CALL "{0}""
2022-01-09T19:13:33.9851313Z ##[endgroup]
Sunshine - Moonlight - Good Times - Oolite
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6570
Joined: Wed Feb 28, 2007 7:54 am

Re: Changing Oolite...

Post by another_commander »

Just as a test, please hard-code the full path for the compile command:

Code: Select all

D:\a\oolite\oolite\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat
User avatar
hiran
Theorethicist
Posts: 2195
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: Changing Oolite...

Post by hiran »

another_commander wrote: Sun Jan 09, 2022 7:29 pm
Just as a test, please hard-code the full path for the compile command:

Code: Select all

D:\a\oolite\oolite\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat
Build running....
Sunshine - Moonlight - Good Times - Oolite
User avatar
hiran
Theorethicist
Posts: 2195
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: Changing Oolite...

Post by hiran »

hiran wrote: Sun Jan 09, 2022 7:38 pm
another_commander wrote: Sun Jan 09, 2022 7:29 pm
Just as a test, please hard-code the full path for the compile command:

Code: Select all

D:\a\oolite\oolite\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.bat
Build running....
same result as it seems
Sunshine - Moonlight - Good Times - Oolite
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6570
Joined: Wed Feb 28, 2007 7:54 am

Re: Changing Oolite...

Post by another_commander »

I think the environment does run, but we don't get to see its output. Probably the build fails at some point and therefore no resulting artifact files are generated. Not sure what to do here, I'm afraid.

The only suggestion I have at this poibt is to remove the path:oolite line from the Checkout Oolite job. It seems to result in the subnodules getting installed in D:\a\oolite\oolite\oolite, which is not right (they should go in D:\a\oolite\oolite, like everything else). Maybe this is why the build might be failing. Give it a try.
Post Reply