1name: Test
2inputs:
3  testArtifacts:
4    default: null
5    required: false
6  runTestsParameters:
7    default: ''
8    required: false
9  jitType:
10    default: 'disable'
11    required: false
12  idleCpu:
13    default: 'false'
14    required: false
15runs:
16  using: composite
17  steps:
18    - shell: bash
19      run: |
20        set -x
21        export MYSQL_TEST_USER=root
22        export MYSQL_TEST_PASSWD=root
23        if [[ -z "$PDO_MYSQL_TEST_DSN" ]]; then
24          export PDO_MYSQL_TEST_DSN="mysql:host=localhost;dbname=test"
25        fi
26        export PDO_MYSQL_TEST_USER=root
27        export PDO_MYSQL_TEST_PASS=root
28        export PDO_DBLIB_TEST_DSN="dblib:host=127.0.0.1;dbname=master;version=7.0"
29        export PDO_DBLIB_TEST_USER="pdo_test"
30        export PDO_DBLIB_TEST_PASS="password"
31        export PGSQL_TEST_CONNSTR="host=localhost dbname=test port=5432 user=postgres password=postgres"
32        if [[ -z "$PDO_PGSQL_TEST_DSN" ]]; then
33          export PDO_PGSQL_TEST_DSN="pgsql:host=localhost port=5432 dbname=test user=postgres password=postgres"
34        fi
35        export PDO_FIREBIRD_TEST_DATABASE=test.fdb
36        export PDO_FIREBIRD_TEST_DSN=firebird:dbname=localhost:test.fdb
37        export PDO_FIREBIRD_TEST_PASS=test
38        export PDO_FIREBIRD_TEST_USER=test
39        export ODBC_TEST_USER="odbc_test"
40        export ODBC_TEST_PASS="password"
41        export ODBC_TEST_DSN="Driver={ODBC Driver 17 for SQL Server};Server=127.0.0.1;Database=odbc;uid=$ODBC_TEST_USER;pwd=$ODBC_TEST_PASS"
42        export PDO_ODBC_TEST_DSN="odbc:Driver={ODBC Driver 17 for SQL Server};Server=127.0.0.1;Database=pdo_odbc;uid=$ODBC_TEST_USER;pwd=$ODBC_TEST_PASS"
43        export SKIP_IO_CAPTURE_TESTS=1
44        export TEST_PHP_JUNIT=junit.out.xml
45        export STACK_LIMIT_DEFAULTS_CHECK=1
46        sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \
47          -d opcache.jit=${{ inputs.jitType }} \
48          -d opcache.protect_memory=1 \
49          -d opcache.jit_buffer_size=64M \
50          ${{ inputs.idleCpu == 'true' && '-j$(($(/usr/bin/nproc) - 1))' || '-j$(/usr/bin/nproc)' }} \
51          -g FAIL,BORK,LEAK,XLEAK \
52          --no-progress \
53          --offline \
54          --show-diff \
55          --show-slow 1000 \
56          --set-timeout 120
57    - uses: actions/upload-artifact@v4
58      if: always() && inputs.testArtifacts != null
59      with:
60        name: ${{ github.job }}_${{ inputs.testArtifacts }}
61        path: ${{ github.workspace }}/junit.out.xml
62        retention-days: 5
63