|
| 1 | +name: "Codeception Tests with Open Search" |
| 2 | + |
| 3 | +on: |
| 4 | + # Enable Later. |
| 5 | + #schedule: |
| 6 | + # - cron: '0 3 * * 1,3,5' |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - "[0-9]+.[0-9]+" |
| 10 | + - "[0-9]+.x" |
| 11 | + - "feature-*" |
| 12 | + push: |
| 13 | + branches: |
| 14 | + - "[0-9]+.[0-9]+" |
| 15 | + - "[0-9]+.x" |
| 16 | + |
| 17 | +env: |
| 18 | + PIMCORE_PROJECT_ROOT: ${{ github.workspace }} |
| 19 | + APP_ENV: test |
| 20 | + PIMCORE_TEST: 1 |
| 21 | + PIMCORE_TEST_DB_DSN: "mysql://[email protected]:33006/pimcore_test" |
| 22 | + PIMCORE_OPEN_SEARCH_HOST: "localhost:39200" |
| 23 | + CODECEPTION_BUNDLE_PATH: "bundles/pimcore/generic-data-index-bundle/" |
| 24 | + |
| 25 | +jobs: |
| 26 | + codeception-tests: |
| 27 | + name: "Codeception tests" |
| 28 | + runs-on: "ubuntu-20.04" |
| 29 | + continue-on-error: ${{ matrix.experimental }} |
| 30 | + strategy: |
| 31 | + matrix: |
| 32 | + include: |
| 33 | + - { php-version: "8.2", dependencies: "lowest", pimcore_version: "", experimental: false, search_engine: "openSearch" } |
| 34 | + - { php-version: "8.3", dependencies: "highest", pimcore_version: "", experimental: false, search_engine: "openSearch"} |
| 35 | + - { php-version: "8.3", dependencies: "highest", pimcore_version: "11.x-dev as 11.99.9", experimental: true, search_engine: "openSearch"} |
| 36 | + |
| 37 | + services: |
| 38 | + mariadb: |
| 39 | + image: "mariadb:10.11" |
| 40 | + ports: |
| 41 | + - 33006:3306 |
| 42 | + env: |
| 43 | + MYSQL_ALLOW_EMPTY_PASSWORD: yes |
| 44 | + |
| 45 | + opensearch: |
| 46 | + image: opensearchproject/opensearch:latest |
| 47 | + ports: |
| 48 | + - 39200:9200 |
| 49 | + env: |
| 50 | + cluster.name: "opensearch-cluster" |
| 51 | + node.name: "opensearch-node" |
| 52 | + discovery.seed_hosts: "opensearch-node" |
| 53 | + bootstrap.memory_lock: true |
| 54 | + OPENSEARCH_JAVA_OPTS: "-Xms512m -Xmx512m" |
| 55 | + discovery.type: "single-node" |
| 56 | + DISABLE_SECURITY_PLUGIN: true |
| 57 | + |
| 58 | + steps: |
| 59 | + - name: "Checkout code" |
| 60 | + uses: "actions/checkout@v2" |
| 61 | + with: |
| 62 | + path: "bundles/pimcore/generic-data-index-bundle" |
| 63 | + |
| 64 | + - name: "Copy .github directory" |
| 65 | + env: |
| 66 | + REQUIRE_ADMIN_BUNDLE: "${{ matrix.require_admin_bundle }}" |
| 67 | + run: | |
| 68 | + cp -R bundles/pimcore/generic-data-index-bundle/.github .github |
| 69 | +
|
| 70 | + - name: "Install PHP" |
| 71 | + uses: "shivammathur/setup-php@v2" |
| 72 | + with: |
| 73 | + coverage: xdebug |
| 74 | + ini-values: display_errors=On, display_startup_errors=On, error_reporting=32767 |
| 75 | + php-version: "${{ matrix.php-version }}" |
| 76 | + |
| 77 | + - name: Verify MariaDB connection |
| 78 | + run: | |
| 79 | + cp .github/ci/files/.my.cnf ~/.my.cnf |
| 80 | + while ! mysqladmin ping --silent; do |
| 81 | + sleep 1 |
| 82 | + done |
| 83 | +
|
| 84 | + - name: "Setup Pimcore environment" |
| 85 | + env: |
| 86 | + REQUIRE_ADMIN_BUNDLE: "${{ matrix.require_admin_bundle }}" |
| 87 | + run: | |
| 88 | + mysql -e "CREATE DATABASE pimcore_test CHARSET=utf8mb4;" |
| 89 | + cp -R bundles/pimcore/generic-data-index-bundle/tests tests |
| 90 | + mkdir src |
| 91 | + chmod 755 .github/ci/scripts/setup-pimcore-environment-functional-tests.sh |
| 92 | + .github/ci/scripts/setup-pimcore-environment-functional-tests.sh "${{ matrix.search_engine }}" |
| 93 | +
|
| 94 | + - name: "Update Pimcore version" |
| 95 | + env: |
| 96 | + PIMCORE_VERSION: "${{ matrix.pimcore_version }}" |
| 97 | + run: | |
| 98 | + if [ ! -z "$PIMCORE_VERSION" ]; then |
| 99 | + composer require --no-update pimcore/pimcore:"${PIMCORE_VERSION}" |
| 100 | + fi |
| 101 | +
|
| 102 | + - name: "Install dependencies with Composer" |
| 103 | + uses: "ramsey/composer-install@v2" |
| 104 | + with: |
| 105 | + dependency-versions: "${{ matrix.dependencies }}" |
| 106 | + |
| 107 | + - name: "Run Codeception" |
| 108 | + run: | |
| 109 | + vendor/bin/codecept run -c . -vvv --xml --coverage-xml |
0 commit comments