mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-08 19:46:41 +00:00
140 lines
4.2 KiB
YAML
140 lines
4.2 KiB
YAML
name: Setup Magento Test
|
|
|
|
on:
|
|
workflow_dispatch: {}
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "setup-magento/**"
|
|
- ".github/workflows/_internal-setup-magento.yaml"
|
|
- "supported-version/**"
|
|
- "!(**/*.md)"
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "setup-magento/**"
|
|
- ".github/workflows/_internal-setup-magento.yaml"
|
|
- "supported-version/**"
|
|
- "!(**/*.md)"
|
|
|
|
env:
|
|
PSEUDO_REPO_FOLDER: ../magento_repo
|
|
magento_folder: ../magento2
|
|
MAGENTO_COMPOSER_REPO: "https://mirror.mage-os.org/"
|
|
|
|
jobs:
|
|
compute_matrix:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
matrix: ${{ steps.supported-version.outputs.matrix }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: ./supported-version
|
|
with:
|
|
kind: currently-supported
|
|
id: supported-version
|
|
- run: echo ${{ steps.supported-version.outputs.matrix }}
|
|
|
|
setup-magento-store:
|
|
needs: compute_matrix
|
|
strategy:
|
|
matrix: ${{ fromJSON(needs.compute_matrix.outputs.matrix) }}
|
|
fail-fast: false
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- run: |
|
|
PSEUDO_STORE_FULL_PATH=$(realpath "${{ env.PSEUDO_REPO_FOLDER }}")
|
|
echo "PSEUDO_STORE_FULL_PATH=$PSEUDO_STORE_FULL_PATH" >> $GITHUB_ENV
|
|
name: Generate Full Pseudo Store Path
|
|
shell: bash
|
|
|
|
- name: Set PHP Version
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php }}
|
|
tools: composer:v${{ matrix.composer }}
|
|
|
|
- uses: actions/cache@v5
|
|
id: setup-magento-store-cache
|
|
with:
|
|
key: setup-magento-ci | ${{ runner.os }} | ${{ matrix.magento }}
|
|
path: ${{ env.PSEUDO_STORE_FULL_PATH }}
|
|
|
|
- run: composer create-project --repository-url="${{ env.MAGENTO_COMPOSER_REPO }}" "${{ matrix.magento }}" "${{ env.PSEUDO_REPO_FOLDER }}" --no-install
|
|
name: Create Store to simulate a real Magento store in a real repo.
|
|
if: steps.setup-magento-store-cache.outputs.cache-hit != 'true'
|
|
env:
|
|
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
|
|
|
|
- uses: ./fix-magento-install
|
|
name: Fix Magento Out of Box Install Issues
|
|
with:
|
|
magento_directory: ${{ env.PSEUDO_REPO_FOLDER }}
|
|
if: steps.setup-magento-store-cache.outputs.cache-hit != 'true'
|
|
env:
|
|
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
|
|
|
|
- run: composer install
|
|
shell: bash
|
|
working-directory: "${{ env.PSEUDO_REPO_FOLDER }}"
|
|
if: steps.setup-magento-store-cache.outputs.cache-hit != 'true'
|
|
env:
|
|
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
|
|
|
|
- run: git init && git config user.email "you@example.com" && git config user.name "Your Name" && git add . && git commit -m "init" && git clean -fdx
|
|
working-directory: "${{ env.PSEUDO_REPO_FOLDER }}"
|
|
if: steps.setup-magento-store-cache.outputs.cache-hit != 'true'
|
|
|
|
- run: cp -R ${{ env.PSEUDO_REPO_FOLDER }} ${{ env.magento_folder }}
|
|
shell: bash
|
|
|
|
- uses: ./setup-magento
|
|
id: setup-magento
|
|
with:
|
|
php-version: ${{ matrix.php }}
|
|
tools: composer:v${{ matrix.composer }}
|
|
mode: store
|
|
working-directory: ${{ env.magento_folder }}
|
|
composer_auth: ${{ secrets.COMPOSER_AUTH }}
|
|
|
|
- uses: ./cache-magento
|
|
with:
|
|
composer_cache_key: '${{ matrix.magento }}'
|
|
|
|
- run: composer install
|
|
name: Composer install
|
|
shell: bash
|
|
working-directory: ${{ steps.setup-magento.outputs.path }}
|
|
env:
|
|
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
|
|
|
|
setup-magento-extension:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- uses: ./setup-magento
|
|
id: setup-magento
|
|
with:
|
|
php-version: 8.4
|
|
tools: composer:v2.8
|
|
mode: extension
|
|
magento_repository: ${{ env.MAGENTO_COMPOSER_REPO }}
|
|
composer_auth: ${{ secrets.COMPOSER_AUTH }}
|
|
magento_version: magento/project-community-edition:2.4.8-p3
|
|
|
|
- uses: ./cache-magento
|
|
with:
|
|
composer_cache_key: 'magento/project-community-edition:2.4.8-p3'
|
|
|
|
- run: composer install
|
|
name: Composer install
|
|
shell: bash
|
|
working-directory: ${{ steps.setup-magento.outputs.path }}
|
|
env:
|
|
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
|