Skip to content

PHPC-1121: Added Appveyor config / PHPC-1114: Add template.rc file #764

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
Feb 27, 2018

Conversation

derickr
Copy link
Contributor

@derickr derickr commented Feb 21, 2018

@derickr derickr force-pushed the PHPC-1121-appveyor branch 12 times, most recently from 530c7c5 to ebd6b0e Compare February 23, 2018 12:02
@derickr derickr changed the title [WIP] Added Appveyor config PHPC-1121: Added Appveyor config / PHPC-1114: Add template.rc file Feb 23, 2018
.appveyor.yml Outdated

cache:
- c:\build-cache -> .appveyor.yml
- c:\build-cache\sdk -> .appveyor.yml
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this redundant if c:\build-cache will already be invalidated when .appveyor.yml changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think so. But it was in the original example that Anatol had for me.

@@ -0,0 +1,82 @@
image: Visual Studio 2015
version: '{branch}.{build}'
Copy link
Member

Choose a reason for hiding this comment

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

What is this used for? Does {build} increment with each invocation of Appveyor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes — it creates the "build name" on the right hand side at: https://ci.appveyor.com/project/derickr/mongo-php-driver/history

.appveyor.yml Outdated
ARCHITECTURE: x86
ZTS_STATE: disable
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
PHP_BUILD_CRT: vc14
Copy link
Member

Choose a reason for hiding this comment

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

Appveyor has a VS 2013 build environment. Is there any reason we can't use that for PHP 5.5 and 5.6?

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 real reason, except that we'd be creating binaries for outdated PHP versions, and building binaries takes a looong time on AppVeyor already.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's worth adding that if we're to rely on this instead of manually creating test builds for PHP 5.5 and 5.6 before releasing.

If build times are very long, I'd also be amenable to disabling Appveyor for PRs and simply having it monitor branches on the mongodb repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The new SDK only supports 2015 and 2017: https://github.com/Microsoft/php-sdk-binary-tools#requirements

.appveyor.yml Outdated
version: '{branch}.{build}'

cache:
- c:\build-cache -> .appveyor.yml
Copy link
Member

Choose a reason for hiding this comment

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

Given that you've offloaded most of the work to scripts in .appveyor/, shouldn't you also invalidate if any of those change, too? It looks like Appveyor would support this, per Multiple build cache dependencies.

- c:\build-cache -> .appveyor.yml, appveyor\*.cmd

I'm thinking ahead, but this might avoid needing to manually invalidate the cache.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've never had the cache create a problem for me with Xdebug, so didn't really think much about this.


if %errorlevel% neq 0 exit /b 3

cmd /c configure.bat --disable-all --with-mp=auto --enable-cli --%ZTS_STATE%-zts --enable-json --with-openssl --enable-mongodb=shared --enable-object-out-dir=%PHP_BUILD_OBJ_DIR% --with-config-file-scan-dir=%APPVEYOR_BUILD_FOLDER%\build\modules.d --with-prefix=%APPVEYOR_BUILD_FOLDER%\build --with-php-build=%DEPS_DIR%
Copy link
Member

@jmikola jmikola Feb 23, 2018

Choose a reason for hiding this comment

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

Other than the "mongodb" replacements here, was this basically copied from another project?

Second question: are you only compiling the DLL, or do you still have to build php.exe each time as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, copied from Xdebug, which was copied from something else.

We're still building php.exe too. I think that's fine for now, as "it works", and messing with this just takes too long for it to be worthwhile.

Copy link
Member

Choose a reason for hiding this comment

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

Ok. IIRC, @weltling was talking about in #php.pecl:

<weltling> Derick, btw. perhaps you could check the phpize based approach https://github.com/krakjoe/apcu/blob/master/appveyor.yml 
<weltling> you can spare some time per single job by not building all the php, still need to fetch deps in your case
<weltling> see the build_script: section in the yml file
<weltling> for the tests - also of course php is needed, but in that case it fetches the precompiled version, too
<weltling> so except the extension itself, in most case nothing needs to be compiled
<weltling> with some exts i was helping out, the build time dropped reasonably
<weltling> here it fetches https://github.com/krakjoe/apcu/blob/master/appveyor.yml#L99
<weltling> basically, there it fetches the dev package, generates a job file and runs it, all packed into yml
<weltling> if there are no external deps, it's a way easier and faster approach, with deps might need some more lines

If you don't want to handle this in this PR, I would suggest creating a PHPC ticket so we can track this for later. Feel free to copy/paste that chat log into the ticket for future reference, too.


#define PHP_MONGODB_VERSION "1.5.0-dev"
#define PHP_MONGODB_STABILITY "devel"
#define PHP_MONGODB_VERSION_DESC 1,5,0,0
Copy link
Member

Choose a reason for hiding this comment

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

Instructions for bumping the version in CONTRIBUTING.md should be updated in the same commit (assuming that still refers to php_phongo.h).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, will fix that (thought I had).

template.rc Outdated
VALUE "FileDescription", FILE_DESCRIPTION "\0"
VALUE "FileVersion", PHP_MONGODB_VERSION
VALUE "InternalName", FILE_NAME "\0"
VALUE "LegalCopyright", "Copyright � 2014-2018 MongoDB, Inc.\0"
Copy link
Member

Choose a reason for hiding this comment

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

Why do I see a Unicode replacement character here?

I'd also suggest using "present" as the upper bound, per DRIVERS-329. This could be rewritten as:

Copyright 2014-present MongoDB, 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.

The file encoding is win-1252 (see line 12), I guess GitHub doesn't get that.

Copy link
Member

Choose a reason for hiding this comment

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

Ok. I think we should still use "present" as the date's upper bound, though. That will ensure this never goes out of date.

template.rc Outdated
VALUE "Comments", THANKS_GUYS "\0"
VALUE "CompanyName", "MongoDB, Inc.\0"
VALUE "FileDescription", FILE_DESCRIPTION "\0"
VALUE "FileVersion", PHP_MONGODB_VERSION
Copy link
Member

Choose a reason for hiding this comment

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

Is this being pulled directly from phongo_version.h? If so, both it and THANKS_GUYS are declared with #define. Why do you add a "\0" to THANKS_GUYS but not here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't know. I copied this from Xdebug where it worked for the past 10 years :-)

- .appveyor\install.cmd

build_script:
- .appveyor\build.cmd
Copy link
Member

Choose a reason for hiding this comment

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

This currently runs now tests and is only verifying that we can build the DLL, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does run tests that don't need a mongod server, but right now I'm not making the build fail due to failing tests. We need to follow up on that.

if not exist "%PHP_BUILD_CACHE_SDK_DIR%" (
echo Cloning remote SDK repository
rem git clone -q --depth=1 --branch %SDK_BRANCH% %SDK_REMOTE% "%PHP_BUILD_CACHE_SDK_DIR%" 2>&1
git clone --branch %SDK_BRANCH% %SDK_REMOTE% "%PHP_BUILD_CACHE_SDK_DIR%" 2>&1
Copy link
Member

Choose a reason for hiding this comment

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

Why does the commented command above have -q --depth=1. You use those arguments for cloning PHP below, so why not for the SDK as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Snippet I got from Anatol. I guess the rem line can go.

Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest adding -q --depth=1 to this git clone, though. I don't see any reason you need the full commit history, and -q will make the output a bit quieter. Since progress won't be reported to stderr, we can probably remove the redirection with 2>&1 as well.

)

if "%PHP_REL%"=="master" (
echo git clone -q --depth=1 --branch=%PHP_REL% https://github.com/php/php-src C:\projects\php-src
Copy link
Member

Choose a reason for hiding this comment

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

Just pointing out that these echo lines are inconsistent with those for the SDK repository. Would it be preferable to write "Cloning remote PHP repository (%PHP_REL%)"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe. I don't care enough to go through another hours long iteration for this.

) else (
echo git clone -q --depth=1 --branch=PHP-%PHP_REL% https://github.com/php/php-src C:\projects\php-src
git clone -q --depth=1 --branch=PHP-%PHP_REL% https://github.com/php/php-src C:\projects\php-src
)
Copy link
Member

Choose a reason for hiding this comment

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

Any reason we can't cache the php-src repository as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The cache is limited in space, you can't just chuck everything in it.

Copy link
Member

Choose a reason for hiding this comment

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

Noted. I was expecting this wouldn't be massive, since you're only using a depth of 1.

In any event, I suppose we can revisit this when optimizing later to not recompile php.exe each time.

) else (
echo git clone -q --depth=1 --branch=PHP-%PHP_REL% https://github.com/php/php-src C:\projects\php-src
git clone -q --depth=1 --branch=PHP-%PHP_REL% https://github.com/php/php-src C:\projects\php-src
)
Copy link
Member

Choose a reason for hiding this comment

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

Noted. I was expecting this wouldn't be massive, since you're only using a depth of 1.

In any event, I suppose we can revisit this when optimizing later to not recompile php.exe each time.

if not exist "%PHP_BUILD_CACHE_SDK_DIR%" (
echo Cloning remote SDK repository
rem git clone -q --depth=1 --branch %SDK_BRANCH% %SDK_REMOTE% "%PHP_BUILD_CACHE_SDK_DIR%" 2>&1
git clone --branch %SDK_BRANCH% %SDK_REMOTE% "%PHP_BUILD_CACHE_SDK_DIR%" 2>&1
Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest adding -q --depth=1 to this git clone, though. I don't see any reason you need the full commit history, and -q will make the output a bit quieter. Since progress won't be reported to stderr, we can probably remove the redirection with 2>&1 as well.

```

The above would be changed to:

```
#define PHP_MONGODB_VERSION "1.1.9-dev"
#define PHP_MONGODB_STABILITY "devel"
#define PHP_MONGODB_VERSION_DESC 1,1,9,0
Copy link
Member

Choose a reason for hiding this comment

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

How do we increment this if going from 1.4.0-beta1 back to 1.4.0-dev and later to 1.4.0-rc1? I assume the value might transition from the following states:

  • 1,4,0,0 (original 1.4.0-dev)
  • 1,4,0,1 (first beta)
  • 1,4,0,2 (reverted back to dev)
  • 1,4,0,3 (first RC)

If so, can we summarize this in the "Note: If this is an alpha, beta, or RC release..." paragraph below?

template.rc Outdated
VALUE "FileDescription", FILE_DESCRIPTION "\0"
VALUE "FileVersion", PHP_MONGODB_VERSION
VALUE "InternalName", FILE_NAME "\0"
VALUE "LegalCopyright", "Copyright � 2014-2018 MongoDB, Inc.\0"
Copy link
Member

Choose a reason for hiding this comment

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

Ok. I think we should still use "present" as the date's upper bound, though. That will ensure this never goes out of date.


if %errorlevel% neq 0 exit /b 3

mkdir c:\tests_tmp
Copy link
Member

Choose a reason for hiding this comment

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

I missed that the test suite was being executed here.

I think this really belongs in its own test_script.cmd file, which can be run from the test_script phase in appveyor.yml. https://www.appveyor.com/docs/appveyor-yml/ has an example of this:

# to run your custom scripts instead of automatic tests
test_script:
  - echo This is my custom test script

Copy link
Member

Choose a reason for hiding this comment

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

If this poses problems with making the build fail (as you mentioned in #764 (comment)), which can't be resolved by Allow Failing Jobs, then we can leave this as-is. Please make a PHPC ticket to revisit this later, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem was more that in order to run the tests in a separate script, you'd have to store the output of the build tasks, and basically restore things for every task. Not worth the effort, as this works just fine™. I wouldn't even want to add a PHPC ticket for this.


if not exist "%PHP_BUILD_CACHE_SDK_DIR%" (
echo Cloning remote SDK repository
git clone --branch %SDK_BRANCH% %SDK_REMOTE% "%PHP_BUILD_CACHE_SDK_DIR%" 2>&1
Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest adding -q --depth=1 to this git clone, though. I don't see any reason you need the full commit history, and -q will make the output a bit quieter. Since progress won't be reported to stderr, we can probably remove the redirection with 2>&1 as well.

Copy link
Member

@jmikola jmikola left a comment

Choose a reason for hiding this comment

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

I created PHPC-1131 to track the outstanding task of refactoring to avoid full php.exe compilation.

LGTM to copyright date changes below.

@@ -0,0 +1,24 @@
/*
* Copyright 2014-2018 MongoDB, Inc.
Copy link
Member

Choose a reason for hiding this comment

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

Since this file was just created, the date should start at 2018. This should read "2018-present" per DRIVERS-329.

template.rc Outdated
VALUE "FileDescription", FILE_DESCRIPTION "\0"
VALUE "FileVersion", PHP_MONGODB_VERSION "\0"
VALUE "InternalName", FILE_NAME "\0"
VALUE "LegalCopyright", "Copyright � 2014-2018 MongoDB, Inc.\0"
Copy link
Member

Choose a reason for hiding this comment

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

This should read "2018-present" per DRIVERS-329.

My last comment on this appears to have been hidden by recent diffs.

@derickr derickr merged commit a7576aa into mongodb:master Feb 27, 2018
derickr added a commit that referenced this pull request Feb 27, 2018
jmikola added a commit to jmikola/mongo-php-driver that referenced this pull request Jul 8, 2020
These are not present in PHP's own template.rc file and only exist here because they were copied from Xdebug (see: mongodb#764 (comment)).
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