Skip to content

PHPC-2233: Split Windows Builds #1460

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

Merged
merged 4 commits into from
Sep 2, 2023

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Aug 23, 2023

PHPC-2233

This pull request adds a new workflow to run tests on Windows, splitting the process into two jobs: one to build the driver and store the built DLL, another to run tests. The previous job sometimes caused issues, as errors while running tests (typically during the setup phase of tests) would cause other builds to be aborted, potentially stopping the compilation before all artifacts were stored. Build artifacts are shared between the builds using the cache action to avoid having to unpack and move around build files. For the release builds (and consumption of "nightly" builds), artifacts are created and stored on GitHub for three days as was previously done.

To make the release process easier and less error-prone, the workflow also reacts to push tags. This ensures that the windows-release-build workflow will find build artifacts for a tag even when the tagged commit has not been pushed individually. When pushing a tag, tests are not run as they are not necessary.

@alcaeus alcaeus requested a review from jmikola August 23, 2023 15:27
id: get-build-dir
shell: cmd
# The last echo command to set the output variable intentionally omits a space between the environment variable
# and the output redirector to avoid a trailing space in the generated output variable. Do not add a space.
Copy link
Member

Choose a reason for hiding this comment

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

Good comment.

for /F "usebackq tokens=*" %%i in (`get-build-dir.bat`) do set BUILD_DIR=%%i
echo BUILD_DIR=%BUILD_DIR%
@chcp 65001>nul
echo build_dir=%BUILD_DIR%>> %GITHUB_OUTPUT%
Copy link
Member

Choose a reason for hiding this comment

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

Was this script adapted from another action, or did you come up with this yourself?

Copy link
Member Author

Choose a reason for hiding this comment

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

The first two lines were present previously in the steps that publish the DLL as build artifact. The second lines took me a while to figure out, as the syntax to set an output variable for a step depends on the shell being used. This StackOverflow answer ultimately showed me the correct syntax for this to work in cmd.

jobs:
build:
name: "Build Windows DLLs"
runs-on: windows-2022
Copy link
Member

Choose a reason for hiding this comment

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

Is there any way to enforce that this is standardized between both jobs?

jobs.<job_id>.runs-on suggests that this can be a variable.

Not sure this is needed since we only have two jobs, but wanted to ask anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

Per the Workflow syntax documentation, the only other place where to put such values is env. However, values set there can't be arrays, so even though we could reference an environment variable in the matrix definition, we can't set the list of PHP versions in an environment variable to reuse it in both matrixes.

@alcaeus alcaeus force-pushed the phpc-2233-split-windows-builds branch from b63096a to 5fcc821 Compare August 29, 2023 13:39
@alcaeus alcaeus merged commit 790e20b into mongodb:master Sep 2, 2023
@alcaeus alcaeus deleted the phpc-2233-split-windows-builds branch September 2, 2023 07:40
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