|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + pull_request: |
| 7 | + release: |
| 8 | + types: [created] |
| 9 | + create: |
| 10 | + |
| 11 | +jobs: |
| 12 | + windows: |
| 13 | + runs-on: windows-latest |
| 14 | + name: "Windows: Build and test" |
| 15 | + defaults: |
| 16 | + run: |
| 17 | + shell: cmd |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + php: ["7.3", "7.4", "8.0", "8.1", "8.2"] |
| 22 | + arch: [x86, x64] |
| 23 | + ts: [nts, ts] |
| 24 | + experimental: [false] |
| 25 | + steps: |
| 26 | + - name: Checkout Repository |
| 27 | + uses: actions/checkout@v3 |
| 28 | + - name: Extract Version |
| 29 | + shell: powershell |
| 30 | + run: | |
| 31 | + chcp 65001 |
| 32 | + $r = Select-String -Path php_mcrypt.h -Pattern 'PHP_MCRYPT_VERSION\s+"(.*)"' |
| 33 | + $s = $r.Matches[0].Groups[1] |
| 34 | + echo "$s" |
| 35 | + $extension_version = 'EXTENSION_VERSION=' + $s |
| 36 | + echo $extension_version >> $env:GITHUB_ENV |
| 37 | + - name: Setup PHP |
| 38 | + id: setup-php |
| 39 | + uses: cmb69/setup-php-sdk@v0.7 |
| 40 | + with: |
| 41 | + version: ${{matrix.php}} |
| 42 | + arch: ${{matrix.arch}} |
| 43 | + ts: ${{matrix.ts}} |
| 44 | + deps: "libmcrypt" |
| 45 | + - name: Enable Developer Command Prompt |
| 46 | + uses: ilammy/msvc-dev-cmd@v1 |
| 47 | + with: |
| 48 | + arch: ${{matrix.arch}} |
| 49 | + toolset: ${{steps.setup-php.outputs.toolset}} |
| 50 | + - name: Generate Build Files |
| 51 | + run: phpize |
| 52 | + - name: Configure Build |
| 53 | + run: configure --with-mcrypt --with-prefix=${{steps.setup-php.outputs.prefix}} |
| 54 | + - name: Build |
| 55 | + run: nmake |
| 56 | + - name: Define Module Env |
| 57 | + shell: powershell |
| 58 | + run: | |
| 59 | + chcp 65001 |
| 60 | +
|
| 61 | + $dir = (Get-Location).Path + '\' |
| 62 | + if ('x64' -eq '${{matrix.arch}}') { $dir = $dir + 'x64\' } |
| 63 | + $dir = $dir + 'Release' |
| 64 | + if ('ts' -eq '${{matrix.ts}}') { $dir = $dir + '_TS' } |
| 65 | +
|
| 66 | + $artifact_name = 'php_mcrypt-${{env.EXTENSION_VERSION}}-${{matrix.php}}' |
| 67 | +
|
| 68 | + if ('7.2' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vc15' } |
| 69 | + if ('7.3' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vc15' } |
| 70 | + if ('7.4' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vc15' } |
| 71 | + if ('8.0' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' } |
| 72 | + if ('8.1' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' } |
| 73 | + if ('8.2' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' } |
| 74 | +
|
| 75 | + if ('nts' -eq '${{matrix.ts}}') { $artifact_name = $artifact_name + '-nts' } |
| 76 | + if ('x64' -eq '${{matrix.arch}}') { $artifact_name = $artifact_name + '-x86_64' } |
| 77 | +
|
| 78 | + $extension_artifact_name = "ARTIFACT_NAME=" + $artifact_name |
| 79 | + echo $extension_artifact_name >> $env:GITHUB_ENV |
| 80 | +
|
| 81 | + $from = $dir + '\php_mcrypt.dll' |
| 82 | + $to = $dir + '\' + $artifact_name + ".dll" |
| 83 | + Copy-Item $from -Destination $to |
| 84 | + $extension_artifact = "ARTIFACT=" + $to |
| 85 | + echo $extension_artifact >> $env:GITHUB_ENV |
| 86 | +
|
| 87 | + - name: Upload artifacts |
| 88 | + uses: actions/upload-artifact@v3 |
| 89 | + with: |
| 90 | + name: ${{env.ARTIFACT_NAME}} |
| 91 | + path: ${{env.ARTIFACT}} |
0 commit comments