PHPC-2180: Allow applications to register a log message subscriber #30
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Windows Tests" | |
on: | |
pull_request: | |
branches: | |
- "v*.*" | |
- "master" | |
- "feature/*" | |
push: | |
tags: | |
- "*" | |
branches: | |
- "v*.*" | |
- "master" | |
- "feature/*" | |
jobs: | |
build: | |
name: "Build Windows DLLs" | |
runs-on: windows-2022 | |
defaults: | |
run: | |
shell: cmd | |
strategy: | |
# This matrix intentionally uses fail-fast: false to ensure other builds are finished | |
fail-fast: false | |
matrix: | |
php: [ "7.4", "8.0", "8.1", "8.2" ] | |
arch: [ x64, x86 ] | |
ts: [ ts, nts ] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
submodules: true | |
- name: Prepare build environment | |
id: prepare-build | |
uses: ./.github/workflows/windows/prepare-build | |
with: | |
version: ${{ matrix.php }} | |
arch: ${{ matrix.arch }} | |
ts: ${{ matrix.ts }} | |
- name: Build driver | |
run: nmake /nologo | |
- name: Cache build artifacts for subsequent builds | |
id: cache-build-artifacts | |
uses: actions/cache/save@v3 | |
with: | |
key: ${{ github.sha }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.arch }} | |
path: | | |
${{ steps.prepare-build.outputs.build-dir }}\php_mongodb.dll | |
${{ steps.prepare-build.outputs.build-dir }}\php_mongodb.pdb | |
- name: Copy DLL and PDB files to CWD | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
cp .github/workflows/get-build-dir.bat . | |
for /F "usebackq tokens=*" %%i in (`get-build-dir.bat`) do set BUILD_DIR=%%i | |
echo BUILD_DIR=%BUILD_DIR% | |
cp %BUILD_DIR%\php_mongodb.dll . | |
cp %BUILD_DIR%\php_mongodb.pdb . | |
- name: Upload DLL and PDB files as build artifacts | |
if: ${{ github.event_name == 'push' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: php_mongodb-${{ github.sha }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.arch }} | |
path: | | |
php_mongodb.dll | |
php_mongodb.pdb | |
retention-days: 3 | |
test: | |
name: "Windows Tests" | |
runs-on: windows-2022 | |
# Run tests only when pushing to a branch. When pushing a tag, we're only interested in building the DLLs. | |
if: ${{ github.ref_type == 'branch' }} | |
needs: build | |
defaults: | |
run: | |
shell: cmd | |
strategy: | |
fail-fast: true | |
matrix: | |
php: [ "7.4", "8.0", "8.1", "8.2" ] | |
arch: [ x64, x86 ] | |
ts: [ ts, nts ] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
submodules: true | |
- name: Prepare build environment | |
id: prepare-build | |
uses: ./.github/workflows/windows/prepare-build | |
with: | |
version: ${{ matrix.php }} | |
arch: ${{ matrix.arch }} | |
ts: ${{ matrix.ts }} | |
- name: Restore cached build artifacts | |
id: cache-build-artifacts | |
uses: actions/cache/restore@v3 | |
with: | |
fail-on-cache-miss: true | |
key: ${{ github.sha }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.arch }} | |
path: | | |
${{ steps.prepare-build.outputs.build-dir }}\php_mongodb.dll | |
${{ steps.prepare-build.outputs.build-dir }}\php_mongodb.pdb | |
- name: Start MongoDB | |
run: | | |
sc config MongoDB start= auto | |
sc start MongoDB | |
- name: Wait until MongoDB is available | |
run: .github/workflows/wait-for-mongodb.bat | |
- name: Run Tests | |
run: nmake /nologo test | |
env: | |
NO_INTERACTION: 1 | |
REPORT_EXIT_STATUS: 1 | |
TESTS: --show-diff |