Skip to content
Merged
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
9 changes: 6 additions & 3 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: PHPCS

on: [pull_request]
on:
pull_request:
push:
branches: [main]

permissions:
contents: read
Expand All @@ -14,7 +17,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Set up PHP
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2
Expand All @@ -23,7 +26,7 @@ jobs:
tools: composer:v2

- name: Cache Composer packages
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.composer/cache/files
key: ${{ runner.os }}-composer-phpcs-${{ hashFiles('composer.json') }}
Expand Down
98 changes: 97 additions & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: PHPUnit

on: [pull_request]
on:
pull_request:
push:
branches: [main]

permissions:
contents: read
Expand Down Expand Up @@ -128,3 +131,96 @@ jobs:
name: mutation-report
path: reports/infection
if-no-files-found: ignore

# Publishes shields.io endpoint JSON (coverage %, mutation score) to the
# "badges" branch; the README badges read from there via raw.githubusercontent.
badges:
name: Publish badge data
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
needs: [phpunit, mutation]
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Download coverage report
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: coverage-report
path: reports

Comment thread
Morgy93 marked this conversation as resolved.
- name: Download mutation report
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: mutation-report
path: reports/infection

Comment thread
Morgy93 marked this conversation as resolved.
- name: Generate badge JSON
run: |
mkdir -p badge-data
python3 - <<'EOF'
import json
import re
import xml.etree.ElementTree as ET

def color(value, bands):
for limit, name in bands:
if value < limit:
return name
return "brightgreen"

metrics = ET.parse("reports/clover.xml").getroot().find("./project/metrics")
statements = int(metrics.get("statements"))
covered = int(metrics.get("coveredstatements"))
coverage = covered / statements * 100 if statements else 0.0

summary = open("reports/infection/summary.log").read()

def count(label):
return int(re.search(rf"^{label}: (\d+)$", summary, re.M).group(1))

total = count("Total")
detected = (
count("Killed by Test Framework")
+ count("Killed by Static Analysis")
+ count("Errored")
+ count("Timed Out")
)
covered_mutants = total - count("Not Covered")
msi = detected / covered_mutants * 100 if covered_mutants else 0.0

badges = {
"coverage.json": ("coverage", coverage, [(20, "red"), (50, "orange"), (75, "yellow")]),
"msi.json": ("mutation score", msi, [(50, "red"), (70, "orange"), (85, "yellow")]),
}
for filename, (label, value, bands) in badges.items():
with open(f"badge-data/{filename}", "w") as handle:
json.dump(
{
"schemaVersion": 1,
"label": label,
"message": f"{value:.1f}%",
"color": color(value, bands),
},
handle,
)
EOF

- name: Push badge data to badges branch
env:
GH_TOKEN: ${{ github.token }}
run: |
remote="https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
if ! git clone --depth 1 --branch badges "${remote}" badges-branch; then
mkdir badges-branch
git -C badges-branch init -b badges
git -C badges-branch remote add origin "${remote}"
fi
cp badge-data/*.json badges-branch/
cd badges-branch
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git diff --cached --quiet || git commit -m "chore: update badge data"
git push origin badges
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,20 @@

![Mageforge Hero](./.github/assets/MageForge-Header.png)

[![Release](https://img.shields.io/github/v/release/OpenForgeProject/mageforge)](https://github.com/OpenForgeProject/mageforge/releases) [![License](https://img.shields.io/badge/license-GPL--3.0-blue)](LICENSE)
[![Release](https://img.shields.io/github/v/release/OpenForgeProject/mageforge)](https://github.com/OpenForgeProject/mageforge/releases)
[![License](https://img.shields.io/badge/license-GPL--3.0-blue)](LICENSE)
[![Downloads](https://img.shields.io/packagist/dt/openforgeproject/mageforge)](https://packagist.org/packages/openforgeproject/mageforge)
[![PHP](https://img.shields.io/packagist/dependency-v/openforgeproject/mageforge/php?logo=php&logoColor=white)](composer.json)

[![PHPUnit](https://github.com/OpenForgeProject/mageforge/actions/workflows/phpunit.yml/badge.svg?branch=main)](https://github.com/OpenForgeProject/mageforge/actions/workflows/phpunit.yml)
[![Coverage](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2FOpenForgeProject%2Fmageforge%2Fbadges%2Fcoverage.json)](https://github.com/OpenForgeProject/mageforge/actions/workflows/phpunit.yml)
[![Mutation Score](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2FOpenForgeProject%2Fmageforge%2Fbadges%2Fmsi.json)](https://github.com/OpenForgeProject/mageforge/actions/workflows/phpunit.yml)
[![Functional Tests](https://github.com/OpenForgeProject/mageforge/actions/workflows/functional-tests.yml/badge.svg?branch=main)](https://github.com/OpenForgeProject/mageforge/actions/workflows/functional-tests.yml)
[![Magento Compatibility](https://github.com/OpenForgeProject/mageforge/actions/workflows/magento-compatibility.yml/badge.svg?branch=main)](https://github.com/OpenForgeProject/mageforge/actions/workflows/magento-compatibility.yml)

[![PHPCS](https://github.com/OpenForgeProject/mageforge/actions/workflows/phpcs.yml/badge.svg?branch=main)](https://github.com/OpenForgeProject/mageforge/actions/workflows/phpcs.yml)
[![Static Analysis](https://github.com/OpenForgeProject/mageforge/actions/workflows/static-analysis.yml/badge.svg?branch=main)](https://github.com/OpenForgeProject/mageforge/actions/workflows/static-analysis.yml)
[![Lint](https://github.com/OpenForgeProject/mageforge/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/OpenForgeProject/mageforge/actions/workflows/lint.yml)

MageForge is a powerful CLI toolkit for Magento 2 front-end development. It simplifies theme building workflows, supports multiple theme types (Magento Standard, Hyvä, TailwindCSS, custom), and includes developer tools like the Frontend Inspector.

Expand Down Expand Up @@ -91,7 +104,8 @@ The MageForge Inspector lets you inspect Magento blocks, templates, and performa
```bash
bin/magento mageforge:theme:inspector enable
```
The Inspector can also be enabled in Admin: `Stores > Configuration > MageForge > Frontend Inspector`)

The Inspector can also be enabled in Admin: `Stores > Configuration > MageForge > Frontend Inspector`

**Use in Browser:**

Expand Down
Loading