Skip to content

Merge v1.18 into master #1542

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 2 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/arginfo-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
tools: "phpize"

- name: "Run phpize"
run: phpize
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
tools: "phpize"

- name: "Configure driver"
run: .github/workflows/configure.sh
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/linux/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Linux Build"
description: "Builds the driver"
inputs:
version:
description: "PHP version to build for"
required: true
runs:
using: composite
steps:
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ inputs.version }}"
# Only install required extensions
extensions: "none,date,json,spl,standard,xml"

- name: "Configure driver"
run: .github/workflows/configure.sh
shell: bash

- name: "Build driver"
run: "make all"
shell: bash
110 changes: 110 additions & 0 deletions .github/workflows/package-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: "Package Release"
run-name: "Package Release ${{ github.ref_name }}"

on:
push:
tags:
- "*"

jobs:
build-pecl:
name: "Create PECL package"
runs-on: "ubuntu-latest"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
# Manually specify a ref. When actions/checkout is run for a tag without a ref, it looks up the underlying
# commit and specifically fetches this to the refs/tags/<tag> ref, which denies us access to the tag message
ref: ${{ github.ref }}
submodules: true

- name: "Build Driver"
uses: ./.github/workflows/linux/build
with:
version: "8.3"

- name: "Write changelog file for packaging"
run: git tag -l ${{ github.ref_name }} --format='%(contents)' > changelog

# This will fill in the release notes from the previously generated changelog
- name: "Build package.xml"
run: "make package.xml RELEASE_NOTES_FILE=$(pwd)/changelog"

- name: "Build release archive"
run: "make package"

# PECL always uses the version for the package name.
# Read it from the version file and store in env to use when uploading artifacts
- name: "Read current package version"
run: echo "PACKAGE_VERSION=$(./bin/update-release-version.php get-version)" >> "$GITHUB_ENV"

- name: "Install release archive to verify correctness"
run: sudo pecl install mongodb-${{ env.PACKAGE_VERSION }}.tgz

- name: "Upload artifact"
uses: actions/upload-artifact@v4
with:
name: mongodb-${{ env.PACKAGE_VERSION }}.tgz
path: mongodb-${{ env.PACKAGE_VERSION }}.tgz
retention-days: 3

- name: "Upload release artifact"
run: gh release upload ${{ github.ref_name }} mongodb-${{ env.PACKAGE_VERSION }}.tgz
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-windows:
name: "Create Windows package"
runs-on: windows-2022
defaults:
run:
shell: cmd

strategy:
fail-fast: false
matrix:
# Note: keep this in sync with the Windows matrix in windows-tests.yml
php: [ "7.4", "8.0", "8.1", "8.2", "8.3" ]
arch: [ x64, x86 ]
ts: [ ts, nts ]

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: "Build Driver"
id: build-driver
uses: ./.github/workflows/windows/build
with:
version: ${{ matrix.php }}
arch: ${{ matrix.arch }}
ts: ${{ matrix.ts }}

- name: "Copy DLL and PDB files to CWD"
run: |
cp %BUILD_DIR%\php_mongodb.dll .
cp %BUILD_DIR%\php_mongodb.pdb .
env:
BUILD_DIR: ${{ steps.build-driver.outputs.build-dir }}

- name: "Upload DLL and PDB files as build artifacts"
uses: actions/upload-artifact@v4
with:
name: php_mongodb-${{ github.ref_name }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.arch }}
path: |
php_mongodb.dll
php_mongodb.pdb
retention-days: 3

- name: "Create and upload release artifact"
run: |
set ARCHIVE=php_mongodb-${{ github.ref_name }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.arch }}.zip
zip %ARCHIVE% php_mongodb.dll php_mongodb.pdb CREDITS CONTRIBUTING.md LICENSE README.md THIRD_PARTY_NOTICES
gh release upload ${{ github.ref_name }} %ARCHIVE%
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139 changes: 139 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: "Release New Version"
run-name: "Release ${{ inputs.version }}"

on:
workflow_dispatch:
inputs:
version:
description: "The version to be released. This is checked for consistency with the branch name and configuration"
required: true
type: "string"
jira-version-number:
description: "JIRA version ID (e.g. 54321)"
required: true
type: "string"

env:
# TODO: Use different token
GH_TOKEN: ${{ secrets.MERGE_UP_TOKEN }}
GIT_AUTHOR_NAME: "DBX PHP Release Bot"
GIT_AUTHOR_EMAIL: "[email protected]"
default-release-message: |
The PHP team is happy to announce that version {0} of the [mongodb](https://pecl.php.net/package/mongodb) PHP extension is now available on PECL.

**Release Highlights**

TODO: one or more paragraphs describing important changes in this release

A complete list of resolved issues in this release may be found in [JIRA](https://jira.mongodb.org/secure/ReleaseNote.jspa?version={1}&projectId=12484).

**Documentation**

Documentation is available on [PHP.net](https://php.net/set.mongodb).

**Installation**

You can either download and install the source manually, or you can install the extension with:

```
pecl install mongodb-{0}
```

or update with:

```
pecl upgrade mongodb-{0}
```

Windows binaries are attached to the GitHub release notes.

jobs:
prepare-release:
name: "Prepare release"
runs-on: ubuntu-latest

steps:
- name: "Create release output"
run: echo '🎬 Release process for version ${{ inputs.version }} started by @${{ github.triggering_actor }}' >> $GITHUB_STEP_SUMMARY

- uses: actions/checkout@v4
with:
submodules: true
token: ${{ env.GH_TOKEN }}

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"

- name: "Update version information to stable release"
run: ./bin/update-release-version.php to-stable

- name: "Read current package version"
run: echo "PACKAGE_VERSION=$(./bin/update-release-version.php get-version)" >> "$GITHUB_ENV"

# Sanity check - the version from the input and the one determined by phongo_version.h need to be the same
- name: "Check version for consistency"
if: ${{ inputs.version != env.PACKAGE_VERSION }}
# We exit with an error to abort the workflow. This is only run if the versions don't match
run: |
echo '❌ Release failed due to version mismatch: expected ${{ inputs.version }}, got ${{ env.PACKAGE_VERSION }} from code' >> $GITHUB_STEP_SUMMARY
exit 1

#
# Preliminary checks done - commence the release process
#

- name: "Set git author information"
run: |
git config user.name "${GIT_AUTHOR_NAME}"
git config user.email "${GIT_AUTHOR_EMAIL}"

# Create the "Package x.y.z" commit that will be the base of our tag
- name: "Create release commit"
run: git commit -m "Package ${{ env.PACKAGE_VERSION }}" phongo_version.h

# Create a draft release with a changelog
# TODO: Consider using the API to generate changelog
- name: "Create draft release with generated changelog"
run: gh release create ${{ env.PACKAGE_VERSION }} --target ${{ github.ref_name }} --generate-notes --draft

- name: "Read changelog from draft release"
run: gh release view ${{ env.PACKAGE_VERSION }} --json body --template '{{ .body }}' >> changelog

# TODO: Sign tag
- name: "Create release tag"
run: git tag -a -F changelog ${{ env.PACKAGE_VERSION }}

- name: "Update version information to next patch development release"
run: |
./bin/update-release-version.php to-next-patch-dev
git commit -m "Back to -dev" phongo_version.h

# TODO: Manually merge using ours strategy. This avoids merge-up pull requests being created
# Process is:
# 1. switch to next branch (according to merge-up action)
# 2. merge release branch using --strategy=ours
# 3. push next branch
# 4. switch back to release branch, then push

- name: "Push changes from release branch"
run: git push

- name: "Prepare release message"
run: |
echo "${{ format(env.default-release-message, env.PACKAGE_VERSION, inputs.jira-version-number) }}" > release-message
cat changelog >> release-message

# Update release with correct release information
- name: "Update release information"
run: echo "RELEASE_URL=$(gh release edit ${{ env.PACKAGE_VERSION }} --title "${{ env.PACKAGE_VERSION }}" --notes-file release-message)" >> "$GITHUB_ENV"

# Pushing the release tag starts build processes that then produce artifacts for the release
- name: "Push release tag"
run: git push origin ${{ env.PACKAGE_VERSION }}

- name: "Set summary"
run: |
echo '🚀 Created tag and drafted release for version [${{ inputs.version }}](${{ env.RELEASE_URL }})' >> $GITHUB_STEP_SUMMARY
echo '✍️ You may now update the release notes and publish the release when ready' >> $GITHUB_STEP_SUMMARY
15 changes: 4 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ jobs:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2
submodules: true

- id: setup-mongodb
Expand All @@ -63,17 +62,11 @@ jobs:
version: ${{ matrix.mongodb-version }}
topology: ${{ matrix.topology }}

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
- name: "Build Driver"
id: build-driver
uses: ./.github/workflows/linux/build
with:
php-version: "${{ matrix.php-version }}"
tools: "phpize"

- name: "Configure driver"
run: .github/workflows/configure.sh

- name: "Build driver"
run: "make all"
version: ${{ matrix.php-version }}

- name: "Run Tests"
run: TEST_PHP_ARGS="-q -x --show-diff -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP" make test
Expand Down
37 changes: 0 additions & 37 deletions .github/workflows/windows-release-build.yml

This file was deleted.

Loading