Some checks failed
CICD Start / Sanity and Base Decision (pull_request) Failing after 1m20s
Signed-off-by: copilotcoder <copilotcoder@darkhelm.org>
155 lines
4.9 KiB
YAML
155 lines
4.9 KiB
YAML
name: CICD Checks
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
head_sha:
|
|
description: Commit SHA to process
|
|
required: false
|
|
source_workflow:
|
|
description: Upstream workflow name
|
|
required: false
|
|
|
|
env:
|
|
GITEA_REGISTRY: kankali.darkhelm.lan:3001
|
|
GITEA_REGISTRY_IP: 10.18.75.2
|
|
GITEA_REGISTRY_HOST: kankali.darkhelm.lan
|
|
|
|
concurrency:
|
|
group: checks-${{ github.event.inputs.head_sha || github.sha }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
setup:
|
|
name: Setup Checks Context
|
|
runs-on: ubuntu-act
|
|
outputs:
|
|
head_sha: ${{ steps.meta.outputs.head_sha }}
|
|
steps:
|
|
- name: Audit trigger context
|
|
env:
|
|
EVENT_NAME: ${{ github.event_name }}
|
|
SOURCE_WORKFLOW: ${{ github.event.inputs.source_workflow || 'manual' }}
|
|
HEAD_SHA: ${{ github.event.inputs.head_sha || github.sha }}
|
|
REF: ${{ github.ref }}
|
|
REF_NAME: ${{ github.ref_name }}
|
|
HEAD_REF: ${{ github.head_ref }}
|
|
run: |
|
|
echo "=== Dispatch Audit: CICD Checks ==="
|
|
echo "event_name=${EVENT_NAME}"
|
|
echo "source_workflow=${SOURCE_WORKFLOW}"
|
|
echo "head_sha=${HEAD_SHA}"
|
|
echo "ref=${REF}"
|
|
echo "ref_name=${REF_NAME}"
|
|
echo "head_ref=${HEAD_REF}"
|
|
|
|
- name: Resolve head SHA
|
|
id: meta
|
|
env:
|
|
HEAD_SHA: ${{ github.event.inputs.head_sha || github.sha }}
|
|
run: |
|
|
echo "head_sha=${HEAD_SHA}" >> "$GITHUB_OUTPUT"
|
|
|
|
run-check:
|
|
name: ${{ matrix.name }}
|
|
runs-on: ubuntu-act
|
|
needs: setup
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: Trailing Whitespace Check
|
|
hook: trailing-whitespace
|
|
- name: YAML Syntax Check
|
|
hook: check-yaml
|
|
- name: End of File Check
|
|
hook: end-of-file-fixer
|
|
- name: TOML Syntax Check
|
|
hook: check-toml
|
|
- name: Mixed Line Ending Check
|
|
hook: mixed-line-ending
|
|
- name: TOML Formatting Check
|
|
hook: pretty-format-toml
|
|
- name: Ruff Linting
|
|
hook: ruff
|
|
- name: Ruff Format Check
|
|
hook: ruff-format
|
|
- name: Pyright Type Check
|
|
hook: pyright
|
|
- name: Darglint Docstring Check
|
|
hook: darglint
|
|
- name: No Docstring Types Check
|
|
hook: no-docstring-types
|
|
- name: ESLint Check
|
|
hook: eslint
|
|
- name: Prettier Format Check
|
|
hook: prettier
|
|
- name: TSDoc Lint Check
|
|
hook: tsdoc-lint
|
|
- name: TypeScript Type Check
|
|
hook: typescript-check
|
|
steps:
|
|
- name: Configure registry host resolution
|
|
run: |
|
|
if ! grep -q "${GITEA_REGISTRY_HOST}" /etc/hosts; then
|
|
echo "${GITEA_REGISTRY_IP} ${GITEA_REGISTRY_HOST}" >> /etc/hosts
|
|
fi
|
|
|
|
- name: Ensure CICD image is available
|
|
env:
|
|
HEAD_SHA: ${{ needs.setup.outputs.head_sha }}
|
|
run: |
|
|
IMAGE="${GITEA_REGISTRY}/darkhelm.org/plex-playlist-cicd:${HEAD_SHA}"
|
|
if docker image inspect "${IMAGE}" >/dev/null 2>&1; then
|
|
echo "Using cached CICD image: ${IMAGE}"
|
|
else
|
|
echo "${{ secrets.PACKAGE_ACCESS_TOKEN }}" | docker login "http://${GITEA_REGISTRY}" -u "${{ secrets.REGISTRY_USER || github.actor }}" --password-stdin
|
|
docker pull "${IMAGE}"
|
|
fi
|
|
|
|
- name: Run pre-commit hook
|
|
env:
|
|
HEAD_SHA: ${{ needs.setup.outputs.head_sha }}
|
|
HOOK: ${{ matrix.hook }}
|
|
run: |
|
|
docker run --rm "${GITEA_REGISTRY}/darkhelm.org/plex-playlist-cicd:${HEAD_SHA}" bash -c "
|
|
cd /workspace &&
|
|
pre-commit run ${HOOK} --all-files --show-diff-on-failure
|
|
"
|
|
|
|
dispatch-tests:
|
|
name: Dispatch CICD Tests
|
|
runs-on: ubuntu-act
|
|
needs: [setup, run-check]
|
|
steps:
|
|
- name: Dispatch tests workflow
|
|
env:
|
|
PACKAGE_ACCESS_TOKEN: ${{ secrets.PACKAGE_ACCESS_TOKEN }}
|
|
HEAD_SHA: ${{ needs.setup.outputs.head_sha }}
|
|
REPO_FULL: ${{ github.repository }}
|
|
HEAD_REF: ${{ github.head_ref }}
|
|
REF_NAME: ${{ github.ref_name }}
|
|
run: |
|
|
set -e
|
|
API_BASE="${GITHUB_SERVER_URL%/}/api/v1"
|
|
REPO_OWNER="${REPO_FULL%/*}"
|
|
REPO_NAME="${REPO_FULL#*/}"
|
|
TARGET_REF="${HEAD_REF:-${REF_NAME}}"
|
|
|
|
payload=$(cat <<EOF
|
|
{
|
|
"ref": "${TARGET_REF}",
|
|
"inputs": {
|
|
"head_sha": "${HEAD_SHA}",
|
|
"source_workflow": "CICD Checks"
|
|
}
|
|
}
|
|
EOF
|
|
)
|
|
|
|
curl -fsS -X POST \
|
|
-H "Authorization: token ${PACKAGE_ACCESS_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
"${API_BASE}/repos/${REPO_OWNER}/${REPO_NAME}/actions/workflows/cicd-tests.yaml/dispatches" \
|
|
-d "${payload}"
|