Beautify GitHub Action static test #25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Magento 2 Integration Tests | |
| on: ['push', 'pull_request'] | |
| jobs: | |
| integration-tests: | |
| name: Magento 2 Integration Tests | |
| #runs-on: self-hosted | |
| runs-on: ubuntu-latest | |
| container: | |
| image: yireo/magento2installed:2.4.7-p4 | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ROOT_PASSWORD: root | |
| MYSQL_USER: magento2 | |
| MYSQL_PASSWORD: magento2 | |
| MYSQL_DATABASE: magento2 | |
| options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping" | |
| opensearch: | |
| image: yireo/opensearch | |
| env: | |
| 'discovery.type': single-node | |
| #'xpack.security.enabled': false | |
| ES_JAVA_OPTS: "-Xms256m -Xmx256m" | |
| options: --health-cmd="curl localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" --health-interval=10s --health-timeout=5s --health-retries=3 | |
| redis: | |
| image: redis | |
| options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Configure GitLab | |
| run: | | |
| test -n "${{ secrets.GITLAB_TOKEN }}" || exit 0 | |
| cd /tmp/magento | |
| composer config --auth gitlab-token.gitlab.yireo.com ${{ secrets.GITLAB_TOKEN }} | |
| composer config repositories.loki-checkout composer https://gitlab.yireo.com/api/v4/group/loki-checkout/-/packages/composer/packages.json | |
| - name: Add module source | |
| run: | | |
| export COMPOSER_NAME=`cat .module.ini | grep COMPOSER_NAME | cut -f2 -d= | tr -d '"'` | |
| cp -R ${GITHUB_WORKSPACE} /tmp/magento/package-source | |
| cd /tmp/magento | |
| composer config repositories.local-source path package-source/ | |
| composer require --prefer-source -- ${COMPOSER_NAME}:@dev yireo/magento2-integration-test-helper | |
| - name: Run Magento 2 Integration Tests | |
| run: | | |
| test -d $GITHUB_WORKSPACE/Test/Integration || exit 0 | |
| export EXTENSION_VENDOR=`cat .module.ini | grep EXTENSION_VENDOR | cut -f2 -d= | tr -d '"'` | |
| export EXTENSION_NAME=`cat .module.ini | grep EXTENSION_NAME | cut -f2 -d= | tr -d '"'` | |
| export COMPOSER_NAME=`cat .module.ini | grep COMPOSER_NAME | cut -f2 -d= | tr -d '"'` | |
| export MAGENTO_MODULE=${EXTENSION_VENDOR}_${EXTENSION_NAME} | |
| cd /tmp/magento/dev/tests/integration/ | |
| cp -R ${GITHUB_WORKSPACE}/.github/workflows/integration-tests/* . | |
| php -d memory_limit=4G ../../../vendor/bin/phpunit -c phpunit.xml ../../../vendor/$COMPOSER_NAME/Test/Integration | |