Skip to content

Commit 22aca78

Browse files
Tjitse-Efballianorhoerr
authored
feat: run setup:di:compile on push (#116)
* feat: run setup:di:compile on push * feat: use mage-os/github-actions/cache-magento * Removed fetch-depth * Update example usage * Switch to PHP 8.3 as default * Update docs --------- Co-authored-by: Fabrizio Balliano <[email protected]> Co-authored-by: Ryan Hoerr <[email protected]>
1 parent ca7cd55 commit 22aca78

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

setup-di-compile/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Magento 2 setup:di:compile action
2+
A Github Action that runs `php bin/magento setup:di:compile` and checks for compilation errors.
3+
4+
## Inputs
5+
6+
See the [action.yml](./action.yml)
7+
8+
## Usage
9+
10+
```yml
11+
name: Magento setup:di:compile check
12+
13+
on:
14+
push:
15+
branches:
16+
- main
17+
pull_request:
18+
branches:
19+
- main
20+
21+
jobs:
22+
setup-di-compile:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: mage-os/github-actions/setup-di-compile@main
26+
with:
27+
php_version: "8.3"
28+
composer_version: "2"
29+
```

setup-di-compile/action.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: "Magento compilation (setup:di:compile)"
2+
author: "MageOS"
3+
description: "A Github Action that runs bin/magento setup:di:compile."
4+
5+
inputs:
6+
php_version:
7+
required: true
8+
default: "8.3"
9+
description: "PHP version used to run setup:di:compile."
10+
11+
composer_version:
12+
required: true
13+
default: "2"
14+
description: "The version of composer to use."
15+
16+
runs:
17+
using: composite
18+
steps:
19+
- name: Checkout Project
20+
uses: actions/checkout@v3
21+
22+
- name: Get changed files that could break compilation
23+
uses: tj-actions/changed-files@v39
24+
id: changed-files
25+
with:
26+
files_yaml: |
27+
magento:
28+
- 'composer.lock'
29+
- 'composer.json'
30+
- '**/*.php'
31+
- '**/*.xml'
32+
33+
- name: Set PHP Version
34+
if: steps.changed-files.outputs.magento_any_changed == 'true'
35+
uses: shivammathur/setup-php@v2
36+
with:
37+
php-version: ${{ inputs.php_version }}
38+
tools: composer:v${{ inputs.composer_version }}
39+
coverage: none
40+
41+
- uses: mage-os/github-actions/cache-magento@main
42+
with:
43+
mode: 'store'
44+
45+
- name: Install composer dependencies
46+
if: steps.changed-files.outputs.magento_any_changed == 'true'
47+
shell: bash
48+
run: composer install
49+
50+
- name: Enable all modules
51+
if: steps.changed-files.outputs.magento_any_changed == 'true'
52+
shell: bash
53+
run: php bin/magento module:enable --all
54+
55+
- name: Compile
56+
if: steps.changed-files.outputs.magento_any_changed == 'true'
57+
shell: bash
58+
run: php bin/magento setup:di:compile

0 commit comments

Comments
 (0)