Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: run setup:di:compile on push #116

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions setup-di-compile/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Magento 2 setup:di:compile action
A Github Action that runs `php bin/magento setup:di:compile` and checks for compilation errors.

## Inputs

See the [action.yml](./action.yml)

## Usage

```yml
name: Magento setup:di:compile check

on:
push:
branches:
damienwebdev marked this conversation as resolved.
Show resolved Hide resolved

jobs:
coding-standard:
runs-on: ubuntu-latest
steps:
- uses: mage-os/github-actions/setup-di-compile@main
with:
php_version: "8.2"
composer_version: "2"
```
58 changes: 58 additions & 0 deletions setup-di-compile/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "Magento compilation (setup:di:compile)"
fballiano marked this conversation as resolved.
Show resolved Hide resolved
author: "MageOS"
description: "A Github Action that runs bin/magento setup:di:compile."

inputs:
php_version:
required: true
default: "8.1"
description: "PHP version used to run setup:di:compile."

composer_version:
required: true
default: "2"
description: "The version of composer to use."

runs:
using: composite
steps:
- name: Checkout Project
uses: actions/checkout@v3

- name: Get changed files that could break compilation
uses: tj-actions/changed-files@v39
id: changed-files
with:
files_yaml: |
damienwebdev marked this conversation as resolved.
Show resolved Hide resolved
magento:
- 'composer.lock'
- 'composer.json'
- '**/*.php'
- '**/*.xml'

- name: Set PHP Version
if: steps.changed-files.outputs.magento_any_changed == 'true'
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php_version }}
tools: composer:v${{ inputs.composer_version }}
coverage: none

- uses: mage-os/github-actions/cache-magento@main
with:
mode: 'store'

- name: Install composer dependencies
if: steps.changed-files.outputs.magento_any_changed == 'true'
damienwebdev marked this conversation as resolved.
Show resolved Hide resolved
shell: bash
run: composer install

- name: Enable all modules
if: steps.changed-files.outputs.magento_any_changed == 'true'
shell: bash
run: php bin/magento module:enable --all

- name: Compile
if: steps.changed-files.outputs.magento_any_changed == 'true'
shell: bash
run: php bin/magento setup:di:compile