mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-08 19:46:41 +00:00
feat: add Installation Test Action (#1)
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
name: Installation Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- "docs/**"
|
||||
- README.md
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- "docs/**"
|
||||
- README.md
|
||||
|
||||
jobs:
|
||||
install-test:
|
||||
strategy:
|
||||
matrix:
|
||||
magento:
|
||||
- magento/project-community-edition:>=2.3 <2.4
|
||||
- magento/project-community-edition:>=2.4.0 <2.4.1
|
||||
- magento/project-community-edition:>=2.4.1 <2.4.2
|
||||
- magento/project-community-edition:>=2.4.2 <2.4.3
|
||||
- magento/project-community-edition:>=2.4.3 <2.4.4
|
||||
- magento/project-community-edition:>=2.4.4 <2.4.5
|
||||
- magento/project-community-edition
|
||||
include:
|
||||
|
||||
- magento: magento/project-community-edition:>=2.3 <2.4
|
||||
php_version: 7.4
|
||||
composer_version: 1
|
||||
|
||||
- magento: magento/project-community-edition:>=2.4.0 <2.4.1
|
||||
php_version: 7.4
|
||||
composer_version: 1
|
||||
|
||||
- magento: magento/project-community-edition:>=2.4.1 <2.4.2
|
||||
php_version: 7.4
|
||||
composer_version: 1
|
||||
|
||||
- magento: magento/project-community-edition:>=2.4.2 <2.4.3
|
||||
php_version: 7.4
|
||||
composer_version: 2
|
||||
|
||||
- magento: magento/project-community-edition:>=2.4.3 <2.4.4
|
||||
php_version: 7.4
|
||||
composer_version: 2
|
||||
|
||||
- magento: magento/project-community-edition:>=2.4.4 <2.4.5
|
||||
php_version: 8.1
|
||||
composer_version: 2
|
||||
|
||||
- magento: magento/project-community-edition
|
||||
composer_version: 2
|
||||
php_version: 8.1
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ./installation-test
|
||||
with:
|
||||
composer_version: ${{ matrix.composer_version }}
|
||||
php_version: ${{ matrix.php_version }}
|
||||
magento_version: ${{ matrix.magento }}
|
||||
composer_auth: ${{ secrets.COMPOSER_AUTH }}
|
||||
package_name: graycore/magento2-demo-package
|
||||
source_folder: $GITHUB_WORKSPACE/_test/demo-package
|
||||
@@ -0,0 +1 @@
|
||||
vendor/
|
||||
@@ -0,0 +1,3 @@
|
||||
# Magento 2 Demo Package
|
||||
|
||||
It does nothing, intentionally...
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Graycore\DemoPackage\Test\Integration;
|
||||
|
||||
class TestItWorks extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
|
||||
public function testItWorks()
|
||||
{
|
||||
$this->assertEquals(true, true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Graycore\DemoPackage\Test\Unit;
|
||||
|
||||
class TestItWorks extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
|
||||
public function testItWorks()
|
||||
{
|
||||
$this->assertEquals(true, true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "graycore/magento2-demo-package",
|
||||
"description": "A Magento 2 Demostration Package",
|
||||
"type": "magento2-module",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Damien Retzinger",
|
||||
"email": "damienwebdev@gmail.com"
|
||||
}
|
||||
],
|
||||
"archive": {
|
||||
"exclude": [
|
||||
"/docs",
|
||||
"/Test",
|
||||
"README.md"
|
||||
]
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Graycore\\DemoPackage\\": ""
|
||||
},
|
||||
"files": [
|
||||
"registration.php"
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"magento/framework": "^102.0 || ^103.0"
|
||||
},
|
||||
"repositories": {
|
||||
"0": {
|
||||
"type": "composer",
|
||||
"url": "https://repo.magento.com/"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Graycore_DemoPackage" setup_version="1.0.0">
|
||||
<sequence>
|
||||
<module name="Magento_Framework" />
|
||||
</sequence>
|
||||
</module>
|
||||
</config>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use \Magento\Framework\Component\ComponentRegistrar;
|
||||
|
||||
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Graycore_DemoPackage', __DIR__);
|
||||
@@ -0,0 +1,95 @@
|
||||
name: "Installation Test"
|
||||
author: "Graycore"
|
||||
description: " A Github Action that tests the installability of a Magento Package"
|
||||
|
||||
inputs:
|
||||
php_version:
|
||||
required: true
|
||||
default: "8.1"
|
||||
description: "PHP Version to use"
|
||||
|
||||
cache_key:
|
||||
required: true
|
||||
default: "2"
|
||||
description: "The cache key used to hold Composer Packages"
|
||||
|
||||
composer_version:
|
||||
required: true
|
||||
default: "2"
|
||||
description: "The version of composer to use"
|
||||
|
||||
source_folder:
|
||||
required: true
|
||||
default: $GITHUB_WORKSPACE
|
||||
description: "The source folder of the package"
|
||||
|
||||
package_name:
|
||||
required: true
|
||||
description: "The name of the package"
|
||||
|
||||
magento_directory:
|
||||
required: true
|
||||
default: "../magento2"
|
||||
description: "The folder where Magento will be installed"
|
||||
|
||||
magento_version:
|
||||
required: true
|
||||
default: "magento/project-community-edition"
|
||||
description: "The version of Magento to test against"
|
||||
|
||||
magento_repository:
|
||||
required: true
|
||||
default: "https://repo.magento.com/"
|
||||
description: "Where to install Magento from"
|
||||
|
||||
composer_auth:
|
||||
required: true
|
||||
description: "Composer Authentication Credentials"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Set PHP Version
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ inputs.php_version }}
|
||||
|
||||
- run: composer self-update --${{ inputs.composer_version }}
|
||||
name: Pin to Composer Version ${{ inputs.composer_version }}
|
||||
shell: bash
|
||||
|
||||
- run: composer create-project --repository-url="${{ inputs.magento_repository }}" "${{ inputs.magento_version }}" ${{ inputs.magento_directory }} --no-install
|
||||
shell: bash
|
||||
env:
|
||||
COMPOSER_AUTH: ${{ inputs.composer_auth }}
|
||||
name: Create Magento ${{ inputs.magento_version }} Project
|
||||
|
||||
- name: Get Composer Cache Directory
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.magento_directory }}
|
||||
id: composer-cache
|
||||
run: |
|
||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: "Cache Composer Packages"
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
key: 'composer | v3 | "$(Agent.OS)" | composer.lock | ${{ inputs.composer_version }} | ${{ inputs.php_version }} | ${{ inputs.magento_version }}'
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
|
||||
- run: composer config repositories.local path ${{ inputs.source_folder }}
|
||||
name: Add Github Repo for Testing
|
||||
working-directory: ${{ inputs.magento_directory }}
|
||||
shell: bash
|
||||
|
||||
- run: composer require ${{ inputs.package_name }} "@dev" --no-update && composer install
|
||||
name: Require and attempt install
|
||||
working-directory: ${{ inputs.magento_directory }}
|
||||
shell: bash
|
||||
env:
|
||||
COMPOSER_CACHE_DIR: ${{ steps.composer-cache.outputs.dir }}
|
||||
COMPOSER_AUTH: ${{ inputs.composer_auth }}
|
||||
|
||||
branding:
|
||||
icon: "code"
|
||||
color: "green"
|
||||
Reference in New Issue
Block a user