|
| 1 | +name: PHP YAML tests |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + test: |
| 7 | + name: Test |
| 8 | + runs-on: ${{ matrix.os }} |
| 9 | + |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + php-version: [8.1, 8.2, 8.3, 8.4] |
| 13 | + os: [ubuntu-latest] |
| 14 | + es-version: [9.0.0-SNAPSHOT] |
| 15 | + test-suite: [stack] |
| 16 | + branch-client-tests: ["9.0"] |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Use PHP ${{ matrix.php-version }} |
| 23 | + uses: shivammathur/setup-php@v2 |
| 24 | + with: |
| 25 | + php-version: ${{ matrix.php-version }} |
| 26 | + extensions: yaml, zip, curl |
| 27 | + coverage: none |
| 28 | + env: |
| 29 | + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 30 | + |
| 31 | + - name: Get composer cache directory |
| 32 | + id: composercache |
| 33 | + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
| 34 | + - name: Cache dependencies |
| 35 | + uses: actions/cache@v4 |
| 36 | + with: |
| 37 | + path: ${{ steps.composercache.outputs.dir }} |
| 38 | + key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.json') }} |
| 39 | + restore-keys: ${{ runner.os }}-php-${{ matrix.php-version }}- |
| 40 | + |
| 41 | + - name: Install dependencies |
| 42 | + run: | |
| 43 | + composer install --prefer-dist |
| 44 | +
|
| 45 | + - name: Run Elasticsearch using start-local |
| 46 | + run: | |
| 47 | + curl -fsSL https://elastic.co/start-local | sh -s -- -v ${{ matrix.es-version }} -esonly |
| 48 | +
|
| 49 | + - name: Build PHPUnit tests |
| 50 | + run: | |
| 51 | + git clone -b ${{ matrix.branch-client-tests }} https://github.com/elastic/elasticsearch-clients-tests.git tests/elasticsearch-clients-tests |
| 52 | + php tests/build_es_tests.php tests/elasticsearch-clients-tests/tests ${{ matrix.test-suite }} tests/Yaml |
| 53 | +
|
| 54 | + - name: YAML tests |
| 55 | + run: | |
| 56 | + source elastic-start-local/.env |
| 57 | + ELASTICSEARCH_URL="http://elastic:${ES_LOCAL_PASSWORD}@localhost:9200" TEST_SUITE="free" vendor/bin/phpunit -c "phpunit-yaml-${{ matrix.test-suite }}-tests.xml" |
0 commit comments