Netacea Fastly/Magento module - Additional logging #112
Workflow file for this run
This file contains 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: "Code quality" | |
on: | |
pull_request: | |
branches: [master] | |
env: | |
MAGENTO_CODING_STANDARD: "v30" | |
jobs: | |
static_code_check: | |
name: "Static code check" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
tools: phpcs, cs2pr | |
- name: Install and setup Magento 2 coding standard | |
run: | | |
vendor_path=$(composer global config vendor-dir --absolute) && \ | |
composer global require magento/magento-coding-standard:${{ env.MAGENTO_CODING_STANDARD }} && \ | |
phpcs --config-set installed_paths "$vendor_path/magento/magento-coding-standard/,$vendor_path/phpcompatibility/php-compatibility/" | |
- name: Run phpcs | |
run: phpcs -n -q --report=checkstyle --standard=Magento2 . | cs2pr | |
tests: | |
name: "Tests" | |
runs-on: ubuntu-latest | |
services: | |
db: | |
image: mariadb:10.4 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: magento | |
MYSQL_USER: magento | |
MYSQL_PASSWORD: magento | |
ports: | |
- 33060:3306 | |
options: >- | |
--health-cmd="mysqladmin -proot ping" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
os: | |
image: opensearchproject/opensearch:${{ matrix.opensearch }} | |
env: | |
OPENSEARCH_JAVA_OPTS: "-Xms512m -Xmx512m" | |
ports: | |
- 9200:9200 | |
options: >- | |
-e "discovery.type=single-node" | |
-e "plugins.security.disabled=true" | |
--name "opensearch-node" | |
--health-cmd="curl --silent --fail localhost:9200/_cluster/health || exit 1" | |
--health-interval=30s | |
--health-timeout=30s | |
--health-retries=8 | |
strategy: | |
matrix: | |
# https://experienceleague.adobe.com/docs/commerce-operations/installation-guide/system-requirements.html | |
include: | |
# Higher matching version 4.6.1 of magento/magento2-functional-testing-framework was found in public repository packagist.org | |
# than 4.4.2 in private https://mirror.mage-os.org. Public package might've been taken over by a malicious entity, | |
# please investigate and update package requirement to match the version from the private repository | |
#- magento: "2.4.3-p3" | |
# php: "7.4" | |
# composer: "v1" | |
# elasticsearch: "7.10.2" | |
- magento: "2.4.4" | |
php: "8.1" | |
composer: "v2" | |
opensearch: "1.2.0" | |
- magento: "2.4.5" | |
php: "8.1" | |
composer: "v2" | |
opensearch: "1.2.0" | |
- magento: "2.4.6" | |
php: "8.2" | |
composer: "v2" | |
opensearch: "2.5.0" | |
steps: | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: composer:${{ matrix.composer }} | |
- name: Create Magento 2 project | |
run: | | |
composer create-project --repository-url="https://mirror.mage-os.org/" \ | |
"magento/project-community-edition=${{ matrix.magento }}" . --no-install | |
- run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
id: composer-cache | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install Magento 2 | |
run: composer install && mkdir -p app/code/Fastly/Cdn/ | |
- name: Setup Fastly CDN module | |
uses: actions/checkout@v3 | |
with: | |
path: "app/code/Fastly/Cdn/" | |
- name: Setup Magento 2 | |
run: | | |
echo "127.0.0.1 magento2.test" | sudo tee -a /etc/hosts && \ | |
bin/magento setup:install \ | |
--base-url=http://magento2.test/ \ | |
--db-host=127.0.0.1:33060 \ | |
--db-name=magento \ | |
--db-user=magento \ | |
--db-password=magento \ | |
--admin-firstname=admin \ | |
--admin-lastname=admin \ | |
[email protected] \ | |
--admin-user=admin \ | |
--admin-password=admin123 \ | |
--language=en_US \ | |
--currency=USD \ | |
--timezone=America/Los_Angeles \ | |
--use-rewrites=1 \ | |
--search-engine=elasticsearch7 \ | |
--elasticsearch-host=localhost \ | |
--elasticsearch-port=9200 \ | |
--elasticsearch-index-prefix=magento2 \ | |
--elasticsearch-timeout=15 | |
- name: Verify Fastly is installed in Magento | |
run: bin/magento module:status --enabled | grep -q Fastly_Cdn | |
- name: Compile DI | |
run: bin/magento setup:di:compile | |
- name: Setup Problem Matcher for PHPUnit | |
run: echo "::add-matcher::${{ github.workspace }}/app/code/Fastly/Cdn/.github/tests/phpunit_matcher.json" | |
- name: Run tests | |
run: ../../../vendor/bin/phpunit -c ../unit/phpunit.xml.dist --teamcity ../../../app/code/Fastly/Cdn/ | |
working-directory: dev/tests/integration |