File tree Expand file tree Collapse file tree 4 files changed +99
-0
lines changed
Expand file tree Collapse file tree 4 files changed +99
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Mago (Code Quality Checks, Non Blocking)
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+
9+ permissions :
10+ contents : read
11+
12+ jobs :
13+ mago :
14+ name : Mago Quality Checks
15+ runs-on : ubuntu-latest
16+ # Surfaces quality issues as annotations without blocking merges
17+ continue-on-error : true
18+
19+ steps :
20+ - name : Checkout
21+ uses : actions/checkout@v4
22+
23+ - name : Cache Mago
24+ uses : actions/cache@v4
25+ with :
26+ path : .mago
27+ key : ${{ runner.os }}-mago-${{ hashFiles('mago.toml') }}
28+ restore-keys : |
29+ ${{ runner.os }}-mago-
30+
31+ - name : Setup Mago
32+ uses : nhedger/setup-mago@v1
33+ with :
34+ version : " latest"
35+ token : ${{ github.token }}
36+
37+ - name : Formatting
38+ id : format
39+ continue-on-error : true
40+ run : mago format --check
41+
42+ - name : Linting
43+ id : lint
44+ continue-on-error : true
45+ run : mago lint --reporting-format=github
46+
47+ - name : Static Analysis
48+ id : analyze
49+ continue-on-error : true
50+ run : mago analyze --reporting-format=github
51+
52+ - name : Final status
53+ if : ${{ always() }}
54+ run : |
55+ echo "format=${{ steps.format.outcome }} lint=${{ steps.lint.outcome }} analyze=${{ steps.analyze.outcome }}"
Original file line number Diff line number Diff line change @@ -36,3 +36,7 @@ docs/build
3636
3737# cache from phpdoc
3838.phpdoc
39+
40+ # mago
41+ .mago /
42+ mago.lock
Original file line number Diff line number Diff line change 1+ # mago.toml
2+ [source ]
3+ paths = [" src" ]
4+
5+ [formatter ]
6+ print-width = 120
7+ tab-width = 4
8+ use-tabs = false
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -uo pipefail
3+
4+ if ! command -v docker > /dev/null 2>&1 ; then
5+ echo " Error: 'docker' is not installed or not in PATH."
6+ exit 1
7+ fi
8+
9+ SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
10+ ROOT_DIR=" ${SCRIPT_DIR} /.."
11+ MAGO_IMAGE=" ghcr.io/carthage-software/mago"
12+ MAGO_DOCKER=(docker run --rm -v " ${ROOT_DIR} :/app" -w /app " ${MAGO_IMAGE} " )
13+
14+ echo " Running Mago formatting check..."
15+ " ${MAGO_DOCKER[@]} " format --check
16+ format_exit=$?
17+
18+ echo " Running Mago linting..."
19+ " ${MAGO_DOCKER[@]} " lint --reporting-format=github
20+ lint_exit=$?
21+
22+ echo " Running Mago static analysis..."
23+ " ${MAGO_DOCKER[@]} " analyze --reporting-format=github
24+ analyze_exit=$?
25+
26+ echo " All Mago checks completed."
27+
28+ if [[ $format_exit -ne 0 || $lint_exit -ne 0 || $analyze_exit -ne 0 ]]; then
29+ echo " One or more Mago checks failed."
30+ echo " format=${format_exit} lint=${lint_exit} analyze=${analyze_exit} "
31+ exit 1
32+ fi
You can’t perform that action at this time.
0 commit comments