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: magento_folder: _ghamagento MAGENTO_COMPOSER_REPO: "https://mirror.mage-os.org/" jobs: compute_matrix: if: "!startsWith(github.head_ref, 'release-please')" 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 }} compute_matrix_latest: if: "!startsWith(github.head_ref, 'release-please')" runs-on: ubuntu-latest outputs: matrix: ${{ steps.supported-version.outputs.matrix }} steps: - uses: actions/checkout@v6 - uses: ./supported-version with: kind: latest id: supported-version 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 - name: Set PHP Version uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} tools: composer:v${{ matrix.composer }} - run: composer create-project --repository-url="${{ env.MAGENTO_COMPOSER_REPO }}" "${{ matrix.magento }}" "${{ env.magento_folder }}" --no-install name: Create Store to simulate a real Magento store in a real repo. env: COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} - uses: ./fix-magento-install name: Fix Magento Out of Box Install Issues with: magento_directory: ${{ env.magento_folder }} env: COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} - run: composer update --no-install working-directory: ${{ env.magento_folder }} env: COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} - uses: ./cache-magento with: composer_cache_key: ${{ matrix.magento }} working-directory: ${{ env.magento_folder }} stamp: true - run: composer install shell: bash working-directory: "${{ env.magento_folder }}" env: COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} - name: Write Magento .gitignore so git clean strips vendor/generated/var from the cached tree working-directory: "${{ env.magento_folder }}" shell: bash run: | cat > .gitignore <<'EOF' /.buildpath /.cache /.metadata /.project /.settings /.vscode atlassian* /nbproject /robots.txt /pub/robots.txt /sitemap /sitemap.xml /pub/sitemap /pub/sitemap.xml /.idea /.gitattributes /app/config_sandbox /app/etc/config.php /app/etc/env.php /app/code/Magento/TestModule* /lib/internal/flex/uploader/.actionScriptProperties /lib/internal/flex/uploader/.flexProperties /lib/internal/flex/uploader/.project /lib/internal/flex/uploader/.settings /lib/internal/flex/varien/.actionScriptProperties /lib/internal/flex/varien/.flexLibProperties /lib/internal/flex/varien/.project /lib/internal/flex/varien/.settings /node_modules /.grunt /Gruntfile.js /package.json /.php_cs /.php_cs.cache /.php-cs-fixer.php /.php-cs-fixer.cache /grunt-config.json /pub/media/*.* !/pub/media/.htaccess /pub/media/attribute/* !/pub/media/attribute/.htaccess /pub/media/analytics/* /pub/media/catalog/* !/pub/media/catalog/.htaccess /pub/media/customer/* !/pub/media/customer/.htaccess /pub/media/downloadable/* !/pub/media/downloadable/.htaccess /pub/media/favicon/* /pub/media/import/* !/pub/media/import/.htaccess /pub/media/logo/* /pub/media/custom_options/* !/pub/media/custom_options/.htaccess /pub/media/theme/* /pub/media/theme_customization/* !/pub/media/theme_customization/.htaccess /pub/media/wysiwyg/* !/pub/media/wysiwyg/.htaccess /pub/media/tmp/* !/pub/media/tmp/.htaccess /pub/media/captcha/* /pub/media/sitemap/* !/pub/media/sitemap/.htaccess /pub/static/* !/pub/static/.htaccess /var/* !/var/.htaccess /vendor/* !/vendor/.htaccess /generated/* !/generated/.htaccess .DS_Store EOF - 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.magento_folder }}" - 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 }} working-directory: ${{ env.magento_folder }} stamp: true - run: composer install name: Composer install shell: bash working-directory: ${{ steps.setup-magento.outputs.path }} env: COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} setup-magento-extension: needs: compute_matrix_latest strategy: matrix: ${{ fromJSON(needs.compute_matrix_latest.outputs.matrix) }} fail-fast: false runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: ./setup-magento id: setup-magento with: php-version: ${{ matrix.php }} tools: composer:v${{ matrix.composer }} mode: extension magento_repository: ${{ env.MAGENTO_COMPOSER_REPO }} composer_auth: ${{ secrets.COMPOSER_AUTH }} magento_version: ${{ matrix.magento }} - run: composer update --no-install working-directory: ${{ steps.setup-magento.outputs.path }} env: COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} - uses: ./cache-magento with: composer_cache_key: ${{ matrix.magento }} working-directory: ${{ steps.setup-magento.outputs.path }} stamp: true - run: composer install name: Composer install shell: bash working-directory: ${{ steps.setup-magento.outputs.path }} env: COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}