Skip to content

Merge pull request #30 from henkvalk/patch-1 #120

Merge pull request #30 from henkvalk/patch-1

Merge pull request #30 from henkvalk/patch-1 #120

name: Magento installation
on: [push]
defaults:
run:
shell: bash
jobs:
magento-installation:
name: Magento 2 Test Install
runs-on: ubuntu-latest
container: yireo/magento2base:7.4
services:
es:
image: docker.elastic.co/elasticsearch/elasticsearch:7.8.0
ports:
- 9200:9200
options: -e="discovery.type=single-node" --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: magento2
ports:
- 3306:3306
options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v2
- name: Composer preparation
env:
MAGENTO_MARKETPLACE_USERNAME: ${{ secrets.MAGENTO_MARKETPLACE_USERNAME }}
MAGENTO_MARKETPLACE_PASSWORD: ${{ secrets.MAGENTO_MARKETPLACE_PASSWORD }}
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir -p /tmp/m2 && cd /tmp/m2
composer global config github-oauth.github.com $COMPOSER_TOKEN
composer global config http-basic.repo.magento.com $MAGENTO_MARKETPLACE_USERNAME $MAGENTO_MARKETPLACE_PASSWORD
- name: Creating Magento composer project
run: |
MAGENTO_VERSION=`cat ${GITHUB_WORKSPACE}/.github/workflows/magento_version.txt`
test -z "$MAGENTO_VERSION" && exit 1
composer create-project --repository=https://repo.magento.com/ magento/project-community-edition:${MAGENTO_VERSION} /tmp/m2 --no-install --no-interaction --no-progress
- name: Setup local composer package
env:
COMPOSER_NAME: ${{ secrets.COMPOSER_NAME }}
run: |
MAGENTO_VERSION=`cat ${GITHUB_WORKSPACE}/.github/workflows/magento_version.txt`
BRANCH=magento-`echo $MAGENTO_VERSION | cut -f'1-2' -d\.`
test -z "$MAGENTO_VERSION" && exit 1
cd /tmp/m2
ln -s ${GITHUB_WORKSPACE} local-source
composer config preferred-install source
composer config minimum-stability dev
composer config repositories.remote-source vcs git@github.com:${COMPOSER_NAME}.git
composer config repositories.local-source path local-source/
echo "Installing ${COMPOSER_NAME}:dev-${BRANCH}"
composer require ${COMPOSER_NAME}:dev-${BRANCH} --no-update --no-interaction
- name: Composer installation
run: |
cd /tmp/m2
COMPOSER_MEMORY_LIMIT=-1 composer install --prefer-source --no-interaction --no-progress --no-suggest --no-dev
- name: Magento installation
run: |
cd /tmp/m2
php -d memory_limit=2G bin/magento setup:install --base-url=http://magento2.test/ \
--db-host=mysql --db-name=magento2 \
--db-user=root --db-password=root \
--admin-firstname=John --admin-lastname=Doe \
--admin-email=johndoe@example.com \
--admin-user=johndoe --admin-password=johndoe!1234 \
--backend-frontname=admin --language=en_US \
--currency=USD --timezone=Europe/Amsterdam --cleanup-database \
--sales-order-increment-prefix="ORD$" --session-save=db \
--use-rewrites=1 --elasticsearch-host=es
- name: Magento compilation
run: |
cd /tmp/m2
php -d memory_limit=2G bin/magento setup:di:compile
- name: Additional checks
run: |
cd /tmp/m2
bin/magento module:status | sort