Skip to content

Commit ccab4b5

Browse files
authored
sync(ci): update mage-x to v1.17.4 and tooling versions (#57)
1 parent b5a67df commit ccab4b5

File tree

3 files changed

+134
-4
lines changed

3 files changed

+134
-4
lines changed

.github/.env.base

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ REDIS_CACHE_FORCE_PULL=false # Force pull Redis images even when cache
235235
# 🪄 MAGE-X CONFIGURATION
236236
# ================================================================================================
237237

238-
MAGE_X_VERSION=v1.15.5 # https://github.com/mrz1836/mage-x/releases
238+
MAGE_X_VERSION=v1.17.4 # https://github.com/mrz1836/mage-x/releases
239239
MAGE_X_USE_LOCAL=false # Use local version for development
240240
MAGE_X_CI_SKIP_STEP_SUMMARY=true # Skip duplicate test results in step summary (already in test validation summary)
241241
MAGE_X_AUTO_DISCOVER_BUILD_TAGS=true # Enable auto-discovery of build tags
@@ -244,7 +244,7 @@ MAGE_X_FORMAT_EXCLUDE_PATHS=vendor,node_modules,.git,.idea # Format exclusion
244244
MAGE_X_GITLEAKS_VERSION=8.30.0 # https://github.com/gitleaks/gitleaks/releases
245245
MAGE_X_GOFUMPT_VERSION=v0.9.2 # https://github.com/mvdan/gofumpt/releases
246246
MAGE_X_GOLANGCI_LINT_VERSION=v2.8.0 # https://github.com/golangci/golangci-lint/releases
247-
MAGE_X_GORELEASER_VERSION=v2.13.2 # https://github.com/goreleaser/goreleaser/releases
247+
MAGE_X_GORELEASER_VERSION=v2.13.3 # https://github.com/goreleaser/goreleaser/releases
248248
MAGE_X_GOVULNCHECK_VERSION=v1.1.4 # https://go.googlesource.com/vuln/+refs
249249
MAGE_X_GO_SECONDARY_VERSION=1.24.x # Secondary Go version for MAGE-X (also our secondary)
250250
MAGE_X_GO_VERSION=1.24.x # Primary Go version for MAGE-X (also our primary)
@@ -253,7 +253,8 @@ MAGE_X_NANCY_VERSION=v1.0.52 # https://github.c
253253
MAGE_X_STATICCHECK_VERSION=2025.1.1 # https://github.com/dominikh/go-tools/releases
254254
MAGE_X_SWAG_VERSION=v1.16.6 # https://github.com/swaggo/swag/releases
255255
MAGE_X_YAMLFMT_VERSION=v0.21.0 # https://github.com/google/yamlfmt/releases
256-
MAGE_X_BENCHSTAT_VERSION=v0.0.0-20251208221838-04cf7a2dca90 # https://pkg.go.dev/golang.org/x/perf/cmd/benchstat
256+
MAGE_X_BENCHSTAT_VERSION=v0.0.0-20260112171951-5abaabe9f1bd # https://pkg.go.dev/golang.org/x/perf/cmd/benchstat
257+
MAGE_X_MAGE_VERSION=v1.15.0 # https://github.com/magefile/mage/releases
257258

258259
# Exclude magefiles from prebuild - they require 'mage' build tag and fail without it
259260
# MAGE_X_BUILD_EXCLUDE_PATTERN=magefiles
@@ -315,7 +316,7 @@ NANCY_VERSION=v1.0.52 # https://github.com/sonatype-nexus-commu
315316
# ================================================================================================
316317

317318
# Pre-Commit System
318-
GO_PRE_COMMIT_VERSION=v1.4.6 # https://github.com/mrz1836/go-pre-commit/releases
319+
GO_PRE_COMMIT_VERSION=v1.5.1 # https://github.com/mrz1836/go-pre-commit/releases
319320
GO_PRE_COMMIT_USE_LOCAL=false # Use local version for development
320321

321322
# System Settings
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# ------------------------------------------------------------------------------------
2+
# Setup Mage Composite Action (GoFortress)
3+
#
4+
# Purpose: Install and cache the mage binary for use in GitHub Actions workflows.
5+
# Provides efficient caching by OS and version, with automatic binary installation
6+
# on cache miss and PATH management for seamless integration.
7+
#
8+
# Features:
9+
# - Smart binary caching by OS and version
10+
# - Automatic go install only on cache miss
11+
# - PATH management for immediate availability
12+
#
13+
# Usage:
14+
# - uses: ./.github/actions/setup-mage
15+
# with:
16+
# mage-version: ${{ env.MAGE_X_MAGE_VERSION }}
17+
# runner-os: ${{ runner.os }}
18+
#
19+
# Maintainer: @mrz1836
20+
#
21+
# ------------------------------------------------------------------------------------
22+
23+
name: "Setup Mage"
24+
description: "Install and cache mage binary for magefile execution"
25+
26+
inputs:
27+
mage-version:
28+
description: "Mage version to install (e.g., v1.15.0)"
29+
required: true
30+
runner-os:
31+
description: "Runner OS for cache key (e.g., ubuntu-latest)"
32+
required: true
33+
34+
outputs:
35+
cache-hit:
36+
description: "Whether mage was restored from cache (true/false)"
37+
value: ${{ steps.mage-cache.outputs.cache-hit }}
38+
installation-method:
39+
description: "How mage was obtained: cached or fresh"
40+
value: ${{ steps.installation-summary.outputs.method }}
41+
42+
runs:
43+
using: "composite"
44+
steps:
45+
# --------------------------------------------------------------------
46+
# Restore mage binary cache
47+
# --------------------------------------------------------------------
48+
- name: 💾 Restore mage binary cache
49+
id: mage-cache
50+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
51+
with:
52+
path: ~/.cache/mage-bin
53+
key: ${{ inputs.runner-os }}-mage-${{ inputs.mage-version }}
54+
55+
# --------------------------------------------------------------------
56+
# Install cached binary to PATH when cache hits
57+
# --------------------------------------------------------------------
58+
- name: 📦 Install cached mage to PATH
59+
if: steps.mage-cache.outputs.cache-hit == 'true'
60+
shell: bash
61+
run: |
62+
echo "📦 Installing cached mage binary to PATH..."
63+
64+
# Copy cached binary to GOPATH and add to PATH
65+
mkdir -p "$(go env GOPATH)/bin"
66+
cp ~/.cache/mage-bin/mage "$(go env GOPATH)/bin/mage"
67+
chmod +x "$(go env GOPATH)/bin/mage"
68+
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
69+
70+
echo "✅ Cached mage binary installed to PATH"
71+
72+
# --------------------------------------------------------------------
73+
# Install mage via go install when cache misses
74+
# --------------------------------------------------------------------
75+
- name: ⬇️ Install mage (cache miss)
76+
if: steps.mage-cache.outputs.cache-hit != 'true'
77+
shell: bash
78+
run: |
79+
echo "⬇️ Cache miss – installing mage via go install..."
80+
echo "📋 Installing mage version: ${{ inputs.mage-version }}"
81+
82+
# Install mage
83+
go install "github.com/magefile/mage@${{ inputs.mage-version }}"
84+
85+
# Cache the binary for future runs
86+
mkdir -p ~/.cache/mage-bin
87+
cp "$(go env GOPATH)/bin/mage" ~/.cache/mage-bin/mage
88+
89+
# Ensure GOPATH/bin is in PATH
90+
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
91+
92+
echo "✅ Mage installed and cached"
93+
94+
# --------------------------------------------------------------------
95+
# Verify mage installation and set outputs
96+
# --------------------------------------------------------------------
97+
- name: 🔍 Verify mage installation
98+
id: installation-summary
99+
shell: bash
100+
run: |
101+
echo "🔍 Verifying mage installation..."
102+
103+
# Test that mage is available and working
104+
if ! command -v mage >/dev/null 2>&1; then
105+
echo "❌ ERROR: mage is not available in PATH" >&2
106+
exit 1
107+
fi
108+
109+
# Show version
110+
MAGE_VERSION=$(mage -version 2>&1 | head -1 || echo "unknown")
111+
echo "✅ mage $MAGE_VERSION is available"
112+
113+
# Determine installation method
114+
if [[ "${{ steps.mage-cache.outputs.cache-hit }}" == "true" ]]; then
115+
echo "method=cached" >> $GITHUB_OUTPUT
116+
echo "📋 Installation method: Cached"
117+
else
118+
echo "method=fresh" >> $GITHUB_OUTPUT
119+
echo "📋 Installation method: Fresh install"
120+
fi

.github/workflows/fortress-test-matrix.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,15 @@ jobs:
181181
runner-os: ${{ matrix.os }}
182182
go-version: ${{ matrix.go-version }}
183183

184+
# --------------------------------------------------------------------
185+
# Setup mage (required for delegation tests that use mage binary)
186+
# --------------------------------------------------------------------
187+
- name: 🧙 Setup mage
188+
uses: ./.github/actions/setup-mage
189+
with:
190+
mage-version: ${{ env.MAGE_X_MAGE_VERSION }}
191+
runner-os: ${{ matrix.os }}
192+
184193
# --------------------------------------------------------------------
185194
# Setup Redis service using composite action with caching
186195
# --------------------------------------------------------------------

0 commit comments

Comments
 (0)