Skip to content

Docs/php win build local and remote #12179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

Lewiscowles1986
Copy link
Contributor

This is mostly documentation. It should not substantively affect the Github actions runner. It's part of my investigations into "[How] does Windows build work?"

permalink

Comment on lines +300 to +301
Firebird.zip
hMailServer.exe
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two uglies showed up on my local

@@ -91,16 +92,16 @@ rem work-around for failing to dl(mysqli) with OPcache (https://github.com/php/p
if "%OPCACHE%" equ "1" set OPCACHE_OPTS=%OPCACHE_OPTS% -d extension=mysqli

rem prepare for enchant
mkdir %~d0\usr\local\lib\enchant-2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%~d0 apparently means current drive. I believe using C:\ will make this more readable

@@ -77,7 +78,7 @@ if "%PLATFORM%" == "x64" (
if /i "%GITHUB_ACTIONS%" equ "True" (
rmdir /s /q %OPENSSLDIR% >nul 2>&1
)
mkdir %OPENSSLDIR%
if NOT exist %OPENSSLDIR% mkdir %OPENSSLDIR%
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is what passes for mkdir -p in windows 🤮

@@ -54,7 +55,7 @@ set PDOTEST_DSN=odbc:%ODBC_TEST_DSN%

rem setup Firebird related exts
curl -sLo Firebird.zip https://github.com/FirebirdSQL/firebird/releases/download/v3.0.9/Firebird-3.0.9.33560-0_x64.zip
7z x -oC:\Firebird Firebird.zip
7z x -yoC:\Firebird Firebird.zip
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be able to run multiple times, I just tell 7zip (undocumented dependency btw) to answer yes to all (overwrites existing)

if %errorlevel% neq 0 exit /b 3

rem setup PostgreSQL related exts
set PGUSER=postgres
set PGPASSWORD=Password12!
rem set PGSQL_TEST_CONNSTR=host=127.0.0.1 dbname=test port=5432 user=postgres password=Password12!
git checkout "./ext/pgsql/tests/config.inc"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without this the config.inc gets constantly appended to. This ensures there is one line 😄

Comment on lines +44 to +46
set PATH=%PATH%;%PGBIN%
psql -U postgres -c "DROP SCHEMA IF EXISTS test"
psql -U postgres -c "CREATE SCHEMA IF NOT EXISTS test"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll see this pattern copied with mysql. Basically the createdb command does not exist on my local install of postgres. This makes sure there is a schema and that it's fresh. It also uses path so if the path explicitly supplied did exist, then we can use that set of binaries. But respects user paths if not.

Comment on lines +33 to +34
set PATH=%PATH%;C:\mysql\bin
mysql.exe --host=%PDO_MYSQL_TEST_HOST% --port=%MYSQL_TEST_PORT% --user=%MYSQL_TEST_USER% --password=%MYSQL_TEST_PASSWD% -e "CREATE DATABASE IF NOT EXISTS test"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea why C:\mysql is expected, but chocolatey doesn't set it up, so here is a workaround to allow GH actions to work at the same time as allowing any mysql cli binary to be executed

powershell -Command wget http://windows.php.net/downloads/qa/appveyor/ext/enchant/dict.zip -OutFile dict.zip
unzip dict.zip
unzip -o dict.zip
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overwrite files when unzipping

@Lewiscowles1986 Lewiscowles1986 force-pushed the docs/php-win-build-local-and-remote branch from 0900d37 to bbdf4f4 Compare September 11, 2023 22:21
set OPCACHE=1

set GITHUB_ACTIONS=True
set BRANCH=master
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjust to whatever command you like; I forgot the one-liner to get the currently checked out git branch is all

@Lewiscowles1986
Copy link
Contributor Author

No idea what travis is doing, but it seems to be running different checks on this run, to last run

@Lewiscowles1986 Lewiscowles1986 force-pushed the docs/php-win-build-local-and-remote branch from d8c7ae0 to 599eb2b Compare September 14, 2023 06:10
@Lewiscowles1986 Lewiscowles1986 force-pushed the docs/php-win-build-local-and-remote branch from 599eb2b to 99740ef Compare September 14, 2023 07:09
@iluuu1994
Copy link
Member

@Lewiscowles1986 Are you using this PR for testing purposes? Since you've never contributed GitHub actions requires manual triggering of CI. It might be easier in this case if you open a PR against your own fork. GitHub actions should work there.

@Lewiscowles1986
Copy link
Contributor Author

Hey, well I'm running on my computer and it's working, but as I don't have access to your runners, or all the setup, this is trying to work out why it's failing. You'll notice ARM and FREEBSD are now failing, but this runs from windows. I have not touched any shared files. The CI is a bin-fire.

@iluuu1994
Copy link
Member

@Lewiscowles1986 The cirrus jobs are broken atm. I can trigger GitHub actions for you, but this will have to be done for every commit until you are a contributor (i.e. the first PR has been merged), which is why I'm suggesting to open it against your own fork.

@iluuu1994
Copy link
Member

I changed our policy, if your GitHub account isn't new the actions should run from now on.

@Lewiscowles1986 Lewiscowles1986 marked this pull request as ready for review September 19, 2023 14:20
@Lewiscowles1986
Copy link
Contributor Author

Right this builds on my local as well as on Windows here (no idea what the flakes for OSX are); Anyone care to review (and discuss as necessary)?

If this is acceptable, then I can start to work on notes for folks that want to build.

@@ -54,7 +55,7 @@ set PDOTEST_DSN=odbc:%ODBC_TEST_DSN%

rem setup Firebird related exts
curl -sLo Firebird.zip https://github.com/FirebirdSQL/firebird/releases/download/v3.0.9/Firebird-3.0.9.33560-0_x64.zip
7z x -oC:\Firebird Firebird.zip
7z x -y -oC:\Firebird Firebird.zip
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this flag answers yes to overwriting files if run more than once. As a result the cleanup.bat and other such scripts provide improvement (can't remove or overwrite if firebird exists, which it never will in GitHub actions)

@iluuu1994
Copy link
Member

Can you clarify what the goal is? The bat scripts you added are never called.

@Lewiscowles1986
Copy link
Contributor Author

I Can remove the batch files I never called.

  • .github/scripts/windows/env.bat sets up and controls the environment for local dev)
  • .github/scripts/windows/cleanup.bat for closing down services and deleting inter-test files, services and noise

@Lewiscowles1986
Copy link
Contributor Author

MACOS_DEBUG_NTS
The hosted runner: GitHub Actions 5 lost communication with the server. Anything in your workflow that terminates the runner process, starves it for CPU/Memory, or blocks its network access can cause this error.

Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still somewhat lost on what the purpose of these changes are. Are they for simpler building on Windows on a local machine? If so, I'm not sure they should live under .github. Furthermore, in that case we should document how/when to run those scripts, rather than just dumping them in the project. Please provide some more information on the intent.

powershell -Command wget http://windows.php.net/downloads/qa/appveyor/ext/enchant/dict.zip -OutFile dict.zip
unzip dict.zip
unzip -o dict.zip
del /q dict.zip
popd
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to use this locally we should separate installation (i.e. downloading of libs, unzipping, etc.) into a separate script that doesn't have to be run every time PHP is built.

@Lewiscowles1986
Copy link
Contributor Author

Closing this out in favor of other PR's

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants