-
Notifications
You must be signed in to change notification settings - Fork 213
PHPC-2661: Use php-windows-builder for Windows extension builds #1907
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
Changes from all commits
dc177a4
7031a52
3267a50
da89f34
1f226df
54ad8e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,10 @@ | ||
| name: "Build DLL files for Windows" | ||
| description: "Prepares the PHP build environment for the MongoDB driver" | ||
| inputs: | ||
| version: | ||
| ref: | ||
| description: Git reference to build | ||
| required: false | ||
| php-version: | ||
| description: "PHP version to build for" | ||
| required: true | ||
| arch: | ||
|
|
@@ -10,24 +13,22 @@ inputs: | |
| ts: | ||
| description: "Thread-safety (nts or ts)" | ||
| required: true | ||
| outputs: | ||
| vs: | ||
| description: "The Visual Studio version" | ||
| value: ${{ steps.prepare-build-env.outputs.vs }} | ||
| build-dir: | ||
| description: "The build directory to be used" | ||
| value: ${{ steps.prepare-build-env.outputs.build-dir }} | ||
| run-tests: | ||
| description: "Whether to run tests after building" | ||
| required: false | ||
| default: "false" | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Prepare build environment | ||
| id: prepare-build-env | ||
| uses: ./.github/actions/windows/prepare-build | ||
| - name: Build extension | ||
| uses: php/php-windows-builder/extension@1.6.0 | ||
| with: | ||
| version: ${{ inputs.version }} | ||
| extension-ref: ${{ inputs.ref }} | ||
| php-version: ${{ inputs.php-version }} | ||
| arch: ${{ inputs.arch }} | ||
| ts: ${{ inputs.ts }} | ||
|
|
||
| - name: Build driver | ||
| shell: cmd | ||
| run: nmake /nologo | ||
| run-tests: ${{ inputs.run-tests == 'true' && true || false }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noted that you just look for a string value here. What is
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a ternary since I don't trust type coercion in YAML. Could potentially be simplified but I didn't want to run the risk of it misbehaving |
||
| test-runner-args: "--show-diff" | ||
| args: "--enable-mongodb --with-mongodb-sasl=yes --with-mongodb-client-side-encryption=yes" | ||
| libs: "openssl" | ||
| test-workers: 1 | ||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| name: "Build Windows Packages" | ||
| run-name: "Build Windows Packages for ${{ inputs.ref }}" | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| version: | ||
| description: "The version being built" | ||
| type: string | ||
| required: true | ||
| ref: | ||
| description: "The git reference to build" | ||
| type: string | ||
| required: true | ||
| upload_release_assets: | ||
| description: "Whether to upload assets to a GitHub release" | ||
| type: boolean | ||
| default: false | ||
|
|
||
| jobs: | ||
| build: | ||
| name: "Build DLL" | ||
| runs-on: ${{ matrix.os }} | ||
| defaults: | ||
| run: | ||
| shell: cmd | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ "windows-2022" ] | ||
| # Note: keep this in sync with the Windows matrix in tests.yml | ||
| php-version: | ||
| - "8.1" | ||
| - "8.2" | ||
| - "8.3" | ||
| - "8.4" | ||
| arch: [ x64, x86 ] | ||
| ts: [ ts, nts ] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: true | ||
| ref: ${{ inputs.ref }} | ||
|
|
||
| - name: "Build Driver" | ||
| id: build-driver | ||
| uses: ./.github/actions/windows/build | ||
| with: | ||
| ref: ${{ inputs.ref }} | ||
| php-version: ${{ matrix.php-version }} | ||
| arch: ${{ matrix.arch }} | ||
| ts: ${{ matrix.ts }} | ||
| run-tests: false | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here you are passing a bool and overriding the default string value ( |
||
|
|
||
| sign-and-upload: | ||
| environment: release | ||
| name: "Sign and create package" | ||
| needs: build | ||
| runs-on: "ubuntu-latest" | ||
| permissions: | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - name: "Generate token and checkout repository" | ||
| uses: mongodb-labs/drivers-github-tools/secure-checkout@v2 | ||
| with: | ||
| app_id: ${{ vars.APP_ID }} | ||
| private_key: ${{ secrets.APP_PRIVATE_KEY }} | ||
| ref: ${{ inputs.ref }} | ||
|
|
||
| - name: "Set up drivers-github-tools" | ||
| uses: mongodb-labs/drivers-github-tools/setup@v2 | ||
| with: | ||
| aws_role_arn: ${{ secrets.AWS_ROLE_ARN }} | ||
| aws_region_name: ${{ vars.AWS_REGION_NAME }} | ||
| aws_secret_id: ${{ secrets.AWS_SECRET_ID }} | ||
|
|
||
| - name: Get artifacts | ||
| uses: actions/download-artifact@v5 | ||
| with: | ||
| path: artifacts | ||
| pattern: php_mongodb-*.zip | ||
| merge-multiple: true | ||
|
|
||
| - name: "Create detached signatures for packages" | ||
| uses: mongodb-labs/drivers-github-tools/gpg-sign@v2 | ||
| with: | ||
| filenames: php_mongodb*.zip | ||
|
|
||
| - name: "Move signatures from release assets folder" | ||
| run: | | ||
| mv ${RELEASE_ASSETS}/php_mongodb*.sig artifacts/ | ||
|
|
||
| - name: "Upload assets to release" | ||
| if: ${{ inputs.upload_release_assets }} | ||
| run: | | ||
| gh release upload ${{ inputs.version }} artifacts/php_mongodb* --clobber | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably not necessary but you could restrict the extension to "zip" and "sig". I assume the directory starts empty, though.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does :) |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a string value instead of a bool?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inputs for composite actions are always strings, I wanted to make this explicit here.