mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-29 22:37:29 +00:00
Add tests/lint/repository/test_name_emoji_and_length.py: every Ansible task name and GitHub Actions workflow/job/step name must start with an emoji (first char not 0-9/A-Za-z) and be <= 80 chars. - emit emoji names at the source: cli/build/include generator now writes "🔧 setup <app>" / "🚿 flush handlers after <app>" so generated tasks/groups/*-roles.yml satisfy the convention too - convert existing task/step/job/workflow names to emoji-prefixed, choosing a task-fitting icon per action (📦 install, ✅ ensure, 🔍 probe, 🥾 bootstrap, 🚀 deploy, 🧩 service-module load, ⬇️ checkout, 📂 include-routines, ...) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
162 lines
4.7 KiB
YAML
162 lines
4.7 KiB
YAML
name: "⚡ CI: Push"
|
|
|
|
concurrency:
|
|
group: global-ci-${{ github.repository }}-${{ github.ref_name }}
|
|
cancel-in-progress: ${{ vars.CI_CANCEL_IN_PROGRESS != 'false' }}
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- "feature/**"
|
|
- "hotfix/**"
|
|
- "fix/**"
|
|
- "update/**"
|
|
- "chore/**"
|
|
- "alert-autofix-*"
|
|
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
actions: write
|
|
security-events: write
|
|
|
|
jobs:
|
|
sync-main:
|
|
name: 🔄 Sync main
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: ⬇️ Checkout repository
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: 🔄 Sync main from source repository
|
|
shell: bash
|
|
env:
|
|
CI_SYNC_MAIN_SOURCE_REPOSITORY_DEFAULT: infinito-nexus/core
|
|
CI_SYNC_MAIN_SOURCE_REPOSITORY: ${{ vars.CI_SYNC_MAIN_SOURCE_REPOSITORY }}
|
|
CI_SYNC_MAIN_SOURCE_REPOSITORY_IS_SET: ${{ contains(toJSON(vars), '"CI_SYNC_MAIN_SOURCE_REPOSITORY"') }}
|
|
run: ./scripts/github/sync/main_from_repository.sh
|
|
|
|
# Skip CI when the push is to main and CI_RUN_ON_MAIN is not 'true', or
|
|
# when the push is a branch creation whose commit is already in origin/main.
|
|
# All other pushes run CI.
|
|
run-policy:
|
|
name: 🧭 Decide CI policy
|
|
needs: sync-main
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
should_run: ${{ steps.decide.outputs.should_run }}
|
|
skip_reason: ${{ steps.decide.outputs.skip_reason }}
|
|
commit_in_main: ${{ steps.decide.outputs.commit_in_main }}
|
|
steps:
|
|
- name: ⬇️ Checkout repository
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: ⬇️ Fetch main
|
|
if: github.event.created == true
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
git fetch origin main:refs/remotes/origin/main --force
|
|
|
|
- name: 🤔 Decide whether CI should run for this push
|
|
id: decide
|
|
env:
|
|
GITHUB_EVENT_CREATED: ${{ github.event.created }}
|
|
CI_RUN_ON_MAIN: ${{ vars.CI_RUN_ON_MAIN }}
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
shell: bash
|
|
run: bash scripts/meta/resolve/push_ci_policy.sh
|
|
|
|
skip-ci:
|
|
name: ⏭️ Skip CI
|
|
needs: run-policy
|
|
if: needs.run-policy.outputs.should_run != 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: ⏭️ Explain skip
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
echo "Skipping CI for commit ${GITHUB_SHA}."
|
|
echo "Reason: ${{ needs.run-policy.outputs.skip_reason }}"
|
|
|
|
pick-distro:
|
|
if: needs.run-policy.outputs.should_run == 'true'
|
|
needs: run-policy
|
|
name: 🎲 Pick distro(s)
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
distros: ${{ steps.pick.outputs.distros }}
|
|
is_version: ${{ steps.pick.outputs.is_version }}
|
|
version_tag: ${{ steps.pick.outputs.version_tag }}
|
|
steps:
|
|
- name: ⬇️ Checkout (with tags)
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
fetch-tags: true
|
|
|
|
- id: pick
|
|
shell: bash
|
|
run: bash scripts/github/resolve/pick_distro.sh
|
|
|
|
ci-orchestrator:
|
|
if: needs.run-policy.outputs.should_run == 'true'
|
|
name: 🎶 Orchestrate CI
|
|
needs:
|
|
- run-policy
|
|
- pick-distro
|
|
uses: ./.github/workflows/ci-orchestrator.yml
|
|
with:
|
|
# ci-orchestrator expects a space-separated list → here it's either one or many
|
|
distros: ${{ needs.pick-distro.outputs.distros }}
|
|
secrets: inherit
|
|
|
|
# Guard job: only allow version releases if the tag commit is contained in origin/main
|
|
release-guard:
|
|
name: "🛡️ Guard release"
|
|
if: needs.run-policy.outputs.should_run == 'true' && needs.pick-distro.outputs.is_version == 'true'
|
|
needs:
|
|
- run-policy
|
|
- pick-distro
|
|
- ci-orchestrator
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
allowed: ${{ steps.guard.outputs.allowed }}
|
|
steps:
|
|
- name: ⬇️ Checkout (with full history)
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
fetch-tags: true
|
|
|
|
- name: ⬇️ Fetch main
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
git fetch origin main:refs/remotes/origin/main --force
|
|
|
|
- name: "🛡️ Guard: tag commit must be contained in origin/main"
|
|
id: guard
|
|
shell: bash
|
|
env:
|
|
VERSION_TAG: ${{ needs.pick-distro.outputs.version_tag }}
|
|
run: bash scripts/github/release/guard.sh
|
|
|
|
release-version:
|
|
name: 🚀 Release version
|
|
needs:
|
|
- run-policy
|
|
- pick-distro
|
|
- release-guard
|
|
if: needs.run-policy.outputs.should_run == 'true' && needs.release-guard.outputs.allowed == 'true'
|
|
uses: ./.github/workflows/release-version.yml
|
|
with:
|
|
tag: ${{ needs.pick-distro.outputs.version_tag }}
|
|
secrets: inherit
|