Skip to content

Commit 3c92eff

Browse files
committed
windows CI
1 parent d987d57 commit 3c92eff

File tree

1 file changed

+85
-74
lines changed

1 file changed

+85
-74
lines changed

.github/workflows/ci.yml

Lines changed: 85 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -16,85 +16,96 @@ jobs:
1616
matrix:
1717
os: [ubuntu-latest, windows-latest, macos-latest]
1818

19-
steps:
20-
- uses: actions/checkout@v4
21-
22-
# PHP installation and setup using built-in tools
23-
- name: Setup PHP (Ubuntu)
24-
if: matrix.os == 'ubuntu-latest'
25-
run: |
26-
sudo add-apt-repository ppa:ondrej/php
27-
sudo apt-get update
28-
sudo apt-get install -y php8.2 php8.2-cli php8.2-xml php8.2-curl php8.2-mbstring
29-
php -v
30-
shell: bash
31-
32-
- name: Setup PHP (macOS)
33-
if: matrix.os == 'macos-latest'
34-
run: |
35-
brew install [email protected]
36-
brew link [email protected] --force
37-
php -v
38-
shell: bash
39-
40-
- name: Setup PHP (Windows)
41-
if: matrix.os == 'windows-latest'
42-
run: |
43-
choco install php --version=8.2 --params '"/ExtensionList:mbstring,curl,openssl,xml"'
44-
refreshenv
45-
php -v
46-
shell: pwsh
47-
48-
- name: Install Composer
49-
run: |
50-
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
51-
if [ "$RUNNER_OS" == "Windows" ]; then
19+
test:
20+
name: PHP Tests - ${{ matrix.os }}
21+
runs-on: ${{ matrix.os }}
22+
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
os: [ ubuntu-latest, windows-latest, macos-latest ]
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
# PHP installation and setup using built-in tools
32+
- name: Setup PHP (Ubuntu)
33+
if: matrix.os == 'ubuntu-latest'
34+
run: |
35+
sudo add-apt-repository ppa:ondrej/php
36+
sudo apt-get update
37+
sudo apt-get install -y php8.2 php8.2-cli php8.2-xml php8.2-curl php8.2-mbstring
38+
php -v
39+
shell: bash
40+
41+
- name: Setup PHP (macOS)
42+
if: matrix.os == 'macos-latest'
43+
run: |
44+
brew install [email protected]
45+
brew link [email protected] --force
46+
php -v
47+
shell: bash
48+
49+
- name: Setup PHP (Windows)
50+
if: matrix.os == 'windows-latest'
51+
run: |
52+
choco install php --version=8.2
53+
refreshenv
54+
php -v
55+
56+
- name: Install Composer (Windows)
57+
if: matrix.os == 'windows-latest'
58+
run: |
59+
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
5260
php composer-setup.php
61+
php -r "unlink('composer-setup.php');"
5362
mkdir -p C:\tools\composer
5463
move composer.phar C:\tools\composer\composer
5564
echo "C:\tools\composer" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
56-
else
57-
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
58-
fi
59-
php -r "unlink('composer-setup.php');"
60-
composer --version
61-
shell: bash
62-
63-
- name: Validate composer.json
64-
run: composer validate
65-
shell: bash
66-
67-
- name: Cache Composer packages
68-
uses: actions/cache@v3
69-
with:
70-
path: vendor
71-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
72-
restore-keys: |
73-
${{ runner.os }}-php-
65+
shell: pwsh
7466

75-
- name: Install dependencies (Windows)
76-
if: matrix.os == 'windows-latest'
77-
run: composer install --prefer-dist --no-progress --ignore-platform-req=ext-pcntl
78-
shell: bash
79-
80-
- name: Install dependencies (Unix)
81-
if: matrix.os != 'windows-latest'
82-
run: composer install --prefer-dist --no-progress
83-
shell: bash
84-
85-
- name: Run test suite
86-
run: vendor/bin/phpunit
87-
shell: bash
88-
89-
- name: Upload test artifacts
90-
if: always()
91-
uses: actions/upload-artifact@v3
92-
with:
93-
name: test-results-${{ matrix.os }}
94-
path: |
95-
./build/logs
96-
./phpunit.xml
97-
./coverage.xml
67+
- name: Install Composer (Unix)
68+
if: matrix.os != 'windows-latest'
69+
run: |
70+
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
71+
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
72+
php -r "unlink('composer-setup.php');"
73+
shell: bash
74+
75+
- name: Validate composer.json
76+
run: composer validate
77+
shell: bash
78+
79+
- name: Cache Composer packages
80+
uses: actions/cache@v3
81+
with:
82+
path: vendor
83+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
84+
restore-keys: |
85+
${{ runner.os }}-php-
86+
87+
- name: Install dependencies
88+
run: composer install --prefer-dist --no-progress
89+
shell: bash
90+
91+
- name: Run test suite
92+
run: vendor/bin/phpunit
93+
shell: bash
94+
95+
- name: Verify binary installation
96+
run: |
97+
php -r "require 'vendor/autoload.php'; new VoltTest\Platform();"
98+
shell: bash
99+
100+
- name: Upload test artifacts
101+
if: always()
102+
uses: actions/upload-artifact@v3
103+
with:
104+
name: test-results-${{ matrix.os }}
105+
path: |
106+
./build/logs
107+
./phpunit.xml
108+
./coverage.xml
98109
99110
static-analysis:
100111
name: Static Analysis

0 commit comments

Comments
 (0)