Update ci.yml
This commit is contained in:
91
.github/workflows/ci.yml
vendored
91
.github/workflows/ci.yml
vendored
@@ -20,50 +20,93 @@
|
|||||||
#
|
#
|
||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
# DEFGROUP: MokoStandards
|
# DEFGROUP: MokoStandards
|
||||||
# INGROUP: GitHub.Actions.CI
|
# INGROUP: GitHub.Actions.ContinuousIntegration
|
||||||
# REPO: https://github.com/mokoconsulting-tech/MokoStandards
|
# REPO: https://github.com/mokoconsulting-tech/MokoStandards
|
||||||
# PATH: /.github/workflows/ci.yml
|
# PATH: /.github/workflows/ci.yml
|
||||||
# VERSION: 01.00.00
|
# VERSION: 01.00.00
|
||||||
# BRIEF: Continuous integration governance workflow for standards enforcement.
|
# BRIEF: Continuous integration governance workflow for standards enforcement.
|
||||||
# NOTE: Avoids wildcard branch filters on pull_request to prevent Actions parser errors.
|
# NOTE: Runs on every push. Auto-normalizes YAML tabs to two spaces before validation.
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
name: Continuous integration
|
name: Continuous integration
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- dev
|
|
||||||
- "dev/*"
|
|
||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
auto_fix_tabs:
|
||||||
|
description: "Run scripts/fix_tabs.sh before validation (does not commit changes)"
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ci-${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
issues: write
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
name: Standards CI Validation
|
name: Standards Continuous integration Validation
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 15
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Validate file paths
|
- name: Auto-fix YAML tabs when YAML changes detected
|
||||||
shell: bash
|
if: ${{ github.event_name != 'workflow_dispatch' || inputs.auto_fix_tabs }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
if [ -x "./scripts/validate_paths.sh" ]; then
|
|
||||||
./scripts/validate_paths.sh
|
if ! command -v git >/dev/null 2>&1; then
|
||||||
else
|
echo "git not available, skipping tab normalization"
|
||||||
echo "validate_paths.sh not present, skipping"
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Validate tabs usage
|
# Determine change window
|
||||||
shell: bash
|
# - pull_request: compare base SHA to head SHA
|
||||||
|
# - push: compare event.before to event.after (current SHA)
|
||||||
|
if [ "${GITHUB_EVENT_NAME}" = "pull_request" ]; then
|
||||||
|
BASE_SHA="${{ github.event.pull_request.base.sha }}"
|
||||||
|
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
|
||||||
|
RANGE="$BASE_SHA...$HEAD_SHA"
|
||||||
|
elif [ "${GITHUB_EVENT_NAME}" = "push" ]; then
|
||||||
|
BEFORE_SHA="${{ github.event.before }}"
|
||||||
|
AFTER_SHA="${{ github.sha }}"
|
||||||
|
RANGE="$BEFORE_SHA...$AFTER_SHA"
|
||||||
|
else
|
||||||
|
RANGE=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$RANGE" ]; then
|
||||||
|
CHANGED_YAML=$(git diff --name-only "$RANGE" -- '*.yml' '*.yaml' || true)
|
||||||
|
else
|
||||||
|
CHANGED_YAML=$(git ls-files '*.yml' '*.yaml' 2>/dev/null || true)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$CHANGED_YAML" ]; then
|
||||||
|
echo "YAML changes detected. Running fix_tabs.sh"
|
||||||
|
if [ -x "./scripts/fix_tabs.sh" ]; then
|
||||||
|
./scripts/fix_tabs.sh
|
||||||
|
else
|
||||||
|
echo "fix_tabs.sh not present, skipping"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "No YAML changes detected. Skipping fix_tabs.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Validate YAML tabs usage
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
if [ -x "./scripts/validate_tabs.sh" ]; then
|
if [ -x "./scripts/validate_tabs.sh" ]; then
|
||||||
@@ -72,8 +115,16 @@ jobs:
|
|||||||
echo "validate_tabs.sh not present, skipping"
|
echo "validate_tabs.sh not present, skipping"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Validate file paths
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
if [ -x "./scripts/validate_paths.sh" ]; then
|
||||||
|
./scripts/validate_paths.sh
|
||||||
|
else
|
||||||
|
echo "validate_paths.sh not present, skipping"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Validate CHANGELOG governance
|
- name: Validate CHANGELOG governance
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
if [ -x "./scripts/validate_changelog.sh" ]; then
|
if [ -x "./scripts/validate_changelog.sh" ]; then
|
||||||
@@ -83,7 +134,6 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Validate Joomla manifests
|
- name: Validate Joomla manifests
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
if [ -x "./scripts/validate_manifest.sh" ]; then
|
if [ -x "./scripts/validate_manifest.sh" ]; then
|
||||||
@@ -92,8 +142,7 @@ jobs:
|
|||||||
echo "validate_manifest.sh not present, skipping"
|
echo "validate_manifest.sh not present, skipping"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: CI completion
|
- name: Continuous integration completion
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
echo "CI checks completed successfully""on":
|
echo "Continuous integration checks completed successfully"
|
||||||
|
|||||||
Reference in New Issue
Block a user