Skip to content

1.1.1: Add GitHub Actions for publishing Windows dlls on a release #234

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
34 changes: 22 additions & 12 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,42 +32,52 @@ environment:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ARCH: x86
VC: vs16
PHP_VER: 8.1.0
PHP_VER: 8.2.0RC4
TS: 1
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ARCH: x64
VC: vs16
PHP_VER: 8.1.0
PHP_VER: 8.2.0RC4
TS: 0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ARCH: x86
VC: vs16
PHP_VER: 8.1.11
TS: 1
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ARCH: x64
VC: vs16
PHP_VER: 8.1.11
TS: 1
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ARCH: x86
VC: vs16
PHP_VER: 8.1.0
PHP_VER: 8.1.11
TS: 0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ARCH: x64
VC: vs16
PHP_VER: 8.1.0
PHP_VER: 8.1.11
TS: 0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ARCH: x86
VC: vs16
PHP_VER: 8.0.13
PHP_VER: 8.0.24
TS: 1
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ARCH: x64
VC: vs16
PHP_VER: 8.0.13
PHP_VER: 8.0.24
TS: 1
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ARCH: x86
VC: vs16
PHP_VER: 8.0.13
PHP_VER: 8.0.24
TS: 0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ARCH: x64
VC: vs16
PHP_VER: 8.0.13
PHP_VER: 8.0.24
TS: 0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
ARCH: x64
Expand Down Expand Up @@ -112,22 +122,22 @@ environment:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
ARCH: x64
VC: vc15
PHP_VER: 7.4.26
PHP_VER: 7.4.32
TS: 0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
ARCH: x64
VC: vc15
PHP_VER: 7.4.26
PHP_VER: 7.4.32
TS: 1
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
ARCH: x86
VC: vc15
PHP_VER: 7.4.26
PHP_VER: 7.4.32
TS: 0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
ARCH: x86
VC: vc15
PHP_VER: 7.4.26
PHP_VER: 7.4.32
TS: 1

build_script:
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/build_dlls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build DLLs
# Based on https://github.com/TysonAndre/var_representation/blob/main/.github/workflows/build_dlls.yml
# which is based on https://github.com/krakjoe/apcu/blob/master/.github/workflows/config.yml
# Builds DLLs for 64-bit php.
# See https://windows.php.net/ - At this time, the windows PHP team no longer has access to the machine used to build dlls.

on:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
release:
types: [published]

jobs:
windows:
defaults:
run:
shell: cmd
strategy:
matrix:
version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]
arch: [x64]
ts: [nts, ts]
runs-on: windows-latest
steps:
- name: Checkout ast
uses: actions/checkout@v2
- name: Setup PHP
id: setup-php
uses: cmb69/[email protected]
with:
version: ${{matrix.version}}
arch: ${{matrix.arch}}
ts: ${{matrix.ts}}
- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{matrix.arch}}
toolset: ${{steps.setup-php.outputs.toolset}}
- name: phpize
run: phpize
- name: configure
run: configure --enable-ast --enable-debug-pack --with-prefix=${{steps.setup-php.outputs.prefix}}
- name: make
run: nmake
# Run tests, failing if they fail. REPORT_EXIT_STATUS=1 is the default for tests in php 7.2+
- name: test
run: nmake test TESTS="--show-diff tests"
- name: package
run: |
md .install
copy LICENSE README.md .install
if exist x64 (
if exist x64\Release (set prefix=x64\Release) else set prefix=x64\Release_TS
) else (
if exist Release (set prefix=Release) else set prefix=Release_TS
)
copy %prefix%\php_ast.dll .install
copy %prefix%\php_ast.pdb .install
- name: Upload artifacts
uses: actions/[email protected]
with:
name: ast-${{github.ref_name}}-Windows-php-${{matrix.version}}-${{matrix.arch}}-${{matrix.ts}}
path: .install
Copy link
Owner

Choose a reason for hiding this comment

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

Can this be integrated into the normal workflow, like in apcu?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It can be - largely, I don't want dlls available for non-release versions in case we change our minds about how a feature is implemented before a release - it's a difference of what triggers the build

on:
  # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
  release:
    types: [published]
on: [push, pull_request]

2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- PHP_VERSION: '7.4'
- PHP_VERSION: '8.0'
- PHP_VERSION: '8.1'
- PHP_VERSION: '8.2.0beta2'
- PHP_VERSION: '8.2.0RC4'

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down
3 changes: 2 additions & 1 deletion RELEASE_CHECKLIST
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* Run `pecl package package.xml`.
* Run `pecl install ast-XXX.tgz`.
* Commit.
* Create a tag.
* Create a release on github.
* Attach Windows artifacts from GitHub Actions to the release.
* Bump version in php_ast.h and add dev suffix.
* Copy release in package.xml into changelog.
* Clear current changelog, bump versions and add dev suffix.
Expand Down
14 changes: 8 additions & 6 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<package packagerversion="1.9.1" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
<name>ast</name>
<channel>pecl.php.net</channel>
<summary>Extension exposing PHP 7 abstract syntax tree</summary>
<description>php-ast exports the AST internally used by PHP 7.
<summary>Extension exposing PHP 7+ abstract syntax tree</summary>
<description>php-ast exports the AST internally used by PHP 7+.
php-ast is significantly faster than PHP-Parser, because the AST construction is implemented in C.
However, php-ast may only parse code that is syntactically valid on the version of PHP it runs on.</description>
<lead>
Expand All @@ -18,18 +18,20 @@
<email>[email protected]</email>
<active>yes</active>
</lead>
<date>2022-08-09</date>
<date>2022-10-18</date>
<version>
<release>1.1.1dev</release>
<api>1.1.1dev</api>
<release>1.1.1</release>
<api>1.1.1</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="https://github.com/nikic/php-ast/blob/master/LICENSE">BSD-3-Clause</license>
<notes>
- TBD
- Set up actions to generate DLLs for Windows in CI on https://github.com/nikic/php-ast

NOTE: The PHP for Windows team is working on getting dlls built again for pecl extensions. Those should be used instead on Windows once they are available. See https://windows.php.net/
</notes>
<contents>
<dir name="/">
Expand Down
2 changes: 1 addition & 1 deletion php_ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
extern zend_module_entry ast_module_entry;
#define phpext_ast_ptr &ast_module_entry

#define PHP_AST_VERSION "1.1.1-dev"
#define PHP_AST_VERSION "1.1.1"

#ifdef PHP_WIN32
# define PHP_AST_API __declspec(dllexport)
Expand Down