-
Notifications
You must be signed in to change notification settings - Fork 5
88 lines (79 loc) · 3.58 KB
/
magento-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Magento CI
env:
GITHUB_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
MAGENTO_PUBLIC_ACCESS_KEY: ${{ secrets.MAGENTO_PUBLIC_ACCESS_KEY }}
MAGENTO_PRIVATE_ACCESS_KEY: ${{ secrets.MAGENTO_PRIVATE_ACCESS_KEY }}
DB_DATABASE: magento
DB_USER: root
DB_PASSWORD: root
ES_VERSION: 7.10.0
PHP_VERSION: 8.1
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
environment:
name: build
steps:
# Set up PHP
- name: Setup - PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ env.PHP_VERSION }}
tools: composer:2.2.17
extensions: mbstring, gd, bcmath, soap, dom, xml, json, tokenizer, mysql, zip, xdebug
# Use composer cache
- name: Setup - Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
# Configure composer global credentials
- name: Setup - Configure Composer
run: |
composer config -g github-oauth.github.com ${GITHUB_TOKEN}
composer config -g http-basic.repo.magento.com ${MAGENTO_PUBLIC_ACCESS_KEY} ${MAGENTO_PRIVATE_ACCESS_KEY}
# Setup required software for Magento Installation
# Set up MySQL
- name: Setup - MySQL
run: |
sudo /etc/init.d/mysql start
mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }}
# Set Up ElasticSearch
- name: Setup - Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Setup - ElasticSearch
uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: ${{ env.ES_VERSION }}
# Install the latest Magento Open Source via composer
- name: Setup - Install Magento Codebase
run: composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition ./
# Install the Bloomreach module via composer
- name: Setup - Install Module Codebase
run: |
composer config repositories.github vcs https://github.com/${GITHUB_REPOSITORY}.git
composer require bloomreach/bloomreach-engagement-connector-magento:dev-${GITHUB_HEAD_REF}
composer install --dev
# Copy config file for integrations tests
- name: Setup - Copy `install-config-mysql` file
run: cp ./vendor/bloomreach/bloomreach-engagement-connector-magento/.github/config/mysql-config.php ./dev/tests/integration/etc/install-config-mysql.php
# Run tests
- name: Test - Magento Coding Standart
if: always()
run: ./vendor/bin/phpcs --standard=Magento2 vendor/bloomreach/bloomreach-engagement-connector-magento
- name: Test - Magento 2 PHP Mess Detector
if: always()
run: ./vendor/bin/phpmd vendor/bloomreach/bloomreach-engagement-connector-magento text dev/tests/static/testsuite/Magento/Test/Php/_files/phpmd/ruleset.xml
- name: Test - Magento Integrations
if: always()
run: cd dev/tests/integration && ../../../vendor/bin/phpunit ../../../vendor/bloomreach/bloomreach-engagement-connector-magento/Test/Integration