forked from shivammathur/homebrew-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
executable file
·70 lines (69 loc) · 2.36 KB
/
test-single.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: 'Test Single Formula'
on:
workflow_dispatch:
inputs:
macos:
description: macOS version
required: true
extension:
description: Extension name
required: true
jobs:
get-matrix:
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get matrix
id: set-matrix
run: |
json_array=()
extension="${{ github.event.inputs.extension }}"
for formula in "./Formula/$extension"@*.rb; do
php_version=$(echo "$formula" | grep -Eo '[0-9]+\.[0-9]+')
json_array+=("{\"php\": \"$php_version\", \"extension\": \"$extension\"}")
done
json_string=$(IFS=,; echo "${json_array[*]}")
json_string="${json_string//} {/}, {"
echo "matrix={\"include\":[$json_string]}" >> "$GITHUB_OUTPUT"
tests:
needs: get-matrix
runs-on: ${{ github.event.inputs.macos }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.get-matrix.outputs.matrix )}}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup cache environment
uses: shivammathur/cache-extensions@develop
env:
skip_dependency_extensions: true
with:
php-version: ${{ matrix.php }}
extensions: ${{ github.event.inputs.extension }}
key: homebrew-extensions-single-v2
- name: Setup PHP
uses: shivammathur/setup-php@develop
with:
php-version: ${{ matrix.php }}
extensions: ${{ github.event.inputs.extension }}
- name: Testing PHP version
run: |
php -v
php -m
- name: Testing Extensions
if: github.event.inputs.extension != 'xdebug2'
run: |
extension=${extension/pecl_/}
php -r "if(! extension_loaded('$extension')) {throw new Exception('$extension not found');}"
php -r "echo '$extension version: ' . phpversion('$extension');"
env:
extension: ${{ github.event.inputs.extension }}
- name: Testing Xdebug2
if: github.event.inputs.extension == 'xdebug2'
run: |
php -r "if(phpversion('xdebug')!='2.9.8') {throw new Exception('xdebug2 not found');}"
php -r "echo 'xdebug version: ' . phpversion('xdebug');"