From a05000fba91c4f7f71851c7909634d581e72184b Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Fri, 9 Feb 2024 00:38:48 +0000 Subject: [PATCH 1/6] Attempt windows builds --- .github/workflows/build.yml | 91 +++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8afbcf6 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,91 @@ +name: Build + +on: + push: + branches: [master] + pull_request: + release: + types: [created] + create: + +jobs: + windows: + runs-on: windows-latest + name: "Windows: Build and test" + defaults: + run: + shell: cmd + strategy: + fail-fast: false + matrix: + php: ["7.3", "7.4", "8.0", "8.1", "8.2"] + arch: [x86, x64] + ts: [nts, ts] + experimental: [false] + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + - name: Extract Version + shell: powershell + run: | + chcp 65001 + $r = Select-String -Path php_ssh2.h -Pattern 'PHP_SSH2_VERSION\s+"(.*)"' + $s = $r.Matches[0].Groups[1] + echo "$s" + $extension_version = 'EXTENSION_VERSION=' + $s + echo $extension_version >> $env:GITHUB_ENV + - name: Setup PHP + id: setup-php + uses: cmb69/setup-php-sdk@v0.7 + with: + version: ${{matrix.php}} + arch: ${{matrix.arch}} + ts: ${{matrix.ts}} + deps: "libssh2" + - name: Enable Developer Command Prompt + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{matrix.arch}} + toolset: ${{steps.setup-php.outputs.toolset}} + - name: Generate Build Files + run: phpize + - name: Configure Build + run: configure --with-ssh2 --with-prefix=${{steps.setup-php.outputs.prefix}} + - name: Build + run: nmake + - name: Define Module Env + shell: powershell + run: | + chcp 65001 + + $dir = (Get-Location).Path + '\' + if ('x64' -eq '${{matrix.arch}}') { $dir = $dir + 'x64\' } + $dir = $dir + 'Release' + if ('ts' -eq '${{matrix.ts}}') { $dir = $dir + '_TS' } + + $artifact_name = 'php_ssh2-${{env.EXTENSION_VERSION}}-${{matrix.php}}' + + if ('7.2' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vc15' } + if ('7.3' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vc15' } + if ('7.4' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vc15' } + if ('8.0' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' } + if ('8.1' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' } + if ('8.2' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' } + + if ('nts' -eq '${{matrix.ts}}') { $artifact_name = $artifact_name + '-nts' } + if ('x64' -eq '${{matrix.arch}}') { $artifact_name = $artifact_name + '-x86_64' } + + $extension_artifact_name = "ARTIFACT_NAME=" + $artifact_name + echo $extension_artifact_name >> $env:GITHUB_ENV + + $from = $dir + '\php_ssh2.dll' + $to = $dir + '\' + $artifact_name + ".dll" + Copy-Item $from -Destination $to + $extension_artifact = "ARTIFACT=" + $to + echo $extension_artifact >> $env:GITHUB_ENV + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: ${{env.ARTIFACT_NAME}} + path: ${{env.ARTIFACT}} From 91d111060162abc4871d11a89ff619798565d5e7 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Fri, 9 Feb 2024 00:48:58 +0000 Subject: [PATCH 2/6] Add zlib dep and 8.3 --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8afbcf6..a186303 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - php: ["7.3", "7.4", "8.0", "8.1", "8.2"] + php: ["7.3", "7.4", "8.0", "8.1", "8.2", "8.3"] arch: [x86, x64] ts: [nts, ts] experimental: [false] @@ -41,7 +41,7 @@ jobs: version: ${{matrix.php}} arch: ${{matrix.arch}} ts: ${{matrix.ts}} - deps: "libssh2" + deps: "libssh2,zlib" - name: Enable Developer Command Prompt uses: ilammy/msvc-dev-cmd@v1 with: @@ -71,6 +71,7 @@ jobs: if ('8.0' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' } if ('8.1' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' } if ('8.2' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' } + if ('8.3' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' } if ('nts' -eq '${{matrix.ts}}') { $artifact_name = $artifact_name + '-nts' } if ('x64' -eq '${{matrix.arch}}') { $artifact_name = $artifact_name + '-x86_64' } From 59b3081b8b957e4ed3636af6e2bb4fd5a70f15f3 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Fri, 9 Feb 2024 00:49:34 +0000 Subject: [PATCH 3/6] v0.8 of setup-php-sdk --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a186303..0b26786 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,7 +36,7 @@ jobs: echo $extension_version >> $env:GITHUB_ENV - name: Setup PHP id: setup-php - uses: cmb69/setup-php-sdk@v0.7 + uses: php/setup-php-sdk@v0.8 with: version: ${{matrix.php}} arch: ${{matrix.arch}} From c49160e929b87c346af7ba3f34e11a0635651efb Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Fri, 9 Feb 2024 00:54:37 +0000 Subject: [PATCH 4/6] We also need openssl --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b26786..2c59f33 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,7 +41,7 @@ jobs: version: ${{matrix.php}} arch: ${{matrix.arch}} ts: ${{matrix.ts}} - deps: "libssh2,zlib" + deps: "libssh2,openssl,zlib" - name: Enable Developer Command Prompt uses: ilammy/msvc-dev-cmd@v1 with: From 486c13eebbe51f5483b662826550373992cb81e8 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Fri, 9 Feb 2024 09:45:52 +0000 Subject: [PATCH 5/6] Also attach artefacts to release tags, if we have one --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2c59f33..dde5508 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -90,3 +90,9 @@ jobs: with: name: ${{env.ARTIFACT_NAME}} path: ${{env.ARTIFACT}} + - name: Publish Binaries to Release + if: ${{ startsWith(github.ref, 'refs/tags') }} + uses: svenstaro/upload-release-action@v2 + with: + asset_name: ${{env.ARTIFACT_NAME}}.dll + file: ${{env.ARTIFACT}} From 26219a690d097fcba4d6bf504fedd2616ee74be8 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Fri, 9 Feb 2024 09:47:55 +0000 Subject: [PATCH 6/6] Bump checkout action as it's outdated --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dde5508..198095a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: experimental: [false] steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Extract Version shell: powershell run: |