From 88a7922e0e0048d4165bf24c755fdb4e9de836a6 Mon Sep 17 00:00:00 2001 From: GErP83 Date: Fri, 5 Dec 2025 13:30:57 +0100 Subject: [PATCH 01/30] Create build-docs.sh --- scripts/build-docs.sh | 115 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 scripts/build-docs.sh diff --git a/scripts/build-docs.sh b/scripts/build-docs.sh new file mode 100644 index 0000000..e185925 --- /dev/null +++ b/scripts/build-docs.sh @@ -0,0 +1,115 @@ +#!/bin/bash +set -e + +OUTPUT_DIR="./docs" +CONFIG_FILE=".doccTargetList" +TARGET_FLAGS="" +COMBINED_FLAG="" + +# -------------------------------------------- +# Detect repo name (for hosting-base-path) +# -------------------------------------------- +if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then + REPO_NAME=$(basename "$(git rev-parse --show-toplevel)") +else + REPO_NAME="" +fi + +# -------------------------------------------- +# Function: Read targets from .doccTargetList +# -------------------------------------------- +read_targets_from_config() { + echo "๐Ÿ“„ Using targets from $CONFIG_FILE" + + TARGETS=$(grep -v '^\s*$' "$CONFIG_FILE") + if [ -z "$TARGETS" ]; then + echo "โŒ Error: $CONFIG_FILE exists but contains no valid targets." + exit 1 + fi + + for TARGET in $TARGETS; do + TARGET_FLAGS="$TARGET_FLAGS --target $TARGET" + done + + TARGET_COUNT=$(echo "$TARGETS" | wc -l | tr -d ' ') +} + +# -------------------------------------------- +# Function: Auto-detect documentable targets +# -------------------------------------------- +auto_detect_targets() { + echo "๐Ÿ” Auto-detecting Swift targets..." + + if ! command -v jq >/dev/null 2>&1; then + echo "โŒ jq is required. Install with: brew install jq" + exit 1 + fi + + TARGETS=$(swift package dump-package \ + | jq -r '.targets[] + | select(.type == "regular" or .type == "executable") + | .name') + + if [ -z "$TARGETS" ]; then + echo "โŒ Error: no valid targets found." + exit 1 + fi + + for TARGET in $TARGETS; do + TARGET_FLAGS="$TARGET_FLAGS --target $TARGET" + done + + TARGET_COUNT=$(echo "$TARGETS" | wc -l | tr -d ' ') +} + +# -------------------------------------------- +# Decide: config file OR auto detection +# -------------------------------------------- +if [ -f "$CONFIG_FILE" ]; then + read_targets_from_config +else + auto_detect_targets +fi + +echo "๐Ÿ“ฆ Targets selected:" +echo "$TARGETS" +echo "โžก๏ธ Count: $TARGET_COUNT" +echo + +# -------------------------------------------- +# Add combined docs flag if multiple targets +# -------------------------------------------- +if [ "$TARGET_COUNT" -gt 1 ]; then + COMBINED_FLAG="--enable-experimental-combined-documentation" + echo "๐Ÿ”— Multi-target detected โ†’ enabling combined documentation" +else + COMBINED_FLAG="" + echo "๐Ÿ”น Single target โ†’ combined documentation disabled" +fi + +echo + +# -------------------------------------------- +# Build documentation +# -------------------------------------------- +echo "๐Ÿงน Cleaning old docs..." +rm -rf "$OUTPUT_DIR" + +echo "๐Ÿ“š Generating DocC documentation..." +swift package \ + generate-documentation \ + --allow-writing-to-directory "$OUTPUT_DIR" \ + --output-path "$OUTPUT_DIR" \ + --transform-for-static-hosting \ + ${REPO_NAME:+--hosting-base-path "$REPO_NAME"} \ + $COMBINED_FLAG \ + $TARGET_FLAGS + +echo +echo "๐ŸŽ‰ Documentation generated successfully!" +echo "๐Ÿ“ Location: $OUTPUT_DIR" +echo +echo "๐Ÿ‘‰ Preview locally:" +echo " python3 -m http.server --directory docs 8080" +echo +exit 0 \ No newline at end of file From ec9210fcdad005012b668bb0b0f3f7cc53e16bc7 Mon Sep 17 00:00:00 2001 From: GErP83 Date: Fri, 5 Dec 2025 13:53:04 +0100 Subject: [PATCH 02/30] update docc generate --- scripts/build-docs.sh | 115 --------------------------------------- scripts/generate-docs.sh | 84 ++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 115 deletions(-) delete mode 100644 scripts/build-docs.sh create mode 100644 scripts/generate-docs.sh diff --git a/scripts/build-docs.sh b/scripts/build-docs.sh deleted file mode 100644 index e185925..0000000 --- a/scripts/build-docs.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/bash -set -e - -OUTPUT_DIR="./docs" -CONFIG_FILE=".doccTargetList" -TARGET_FLAGS="" -COMBINED_FLAG="" - -# -------------------------------------------- -# Detect repo name (for hosting-base-path) -# -------------------------------------------- -if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then - REPO_NAME=$(basename "$(git rev-parse --show-toplevel)") -else - REPO_NAME="" -fi - -# -------------------------------------------- -# Function: Read targets from .doccTargetList -# -------------------------------------------- -read_targets_from_config() { - echo "๐Ÿ“„ Using targets from $CONFIG_FILE" - - TARGETS=$(grep -v '^\s*$' "$CONFIG_FILE") - if [ -z "$TARGETS" ]; then - echo "โŒ Error: $CONFIG_FILE exists but contains no valid targets." - exit 1 - fi - - for TARGET in $TARGETS; do - TARGET_FLAGS="$TARGET_FLAGS --target $TARGET" - done - - TARGET_COUNT=$(echo "$TARGETS" | wc -l | tr -d ' ') -} - -# -------------------------------------------- -# Function: Auto-detect documentable targets -# -------------------------------------------- -auto_detect_targets() { - echo "๐Ÿ” Auto-detecting Swift targets..." - - if ! command -v jq >/dev/null 2>&1; then - echo "โŒ jq is required. Install with: brew install jq" - exit 1 - fi - - TARGETS=$(swift package dump-package \ - | jq -r '.targets[] - | select(.type == "regular" or .type == "executable") - | .name') - - if [ -z "$TARGETS" ]; then - echo "โŒ Error: no valid targets found." - exit 1 - fi - - for TARGET in $TARGETS; do - TARGET_FLAGS="$TARGET_FLAGS --target $TARGET" - done - - TARGET_COUNT=$(echo "$TARGETS" | wc -l | tr -d ' ') -} - -# -------------------------------------------- -# Decide: config file OR auto detection -# -------------------------------------------- -if [ -f "$CONFIG_FILE" ]; then - read_targets_from_config -else - auto_detect_targets -fi - -echo "๐Ÿ“ฆ Targets selected:" -echo "$TARGETS" -echo "โžก๏ธ Count: $TARGET_COUNT" -echo - -# -------------------------------------------- -# Add combined docs flag if multiple targets -# -------------------------------------------- -if [ "$TARGET_COUNT" -gt 1 ]; then - COMBINED_FLAG="--enable-experimental-combined-documentation" - echo "๐Ÿ”— Multi-target detected โ†’ enabling combined documentation" -else - COMBINED_FLAG="" - echo "๐Ÿ”น Single target โ†’ combined documentation disabled" -fi - -echo - -# -------------------------------------------- -# Build documentation -# -------------------------------------------- -echo "๐Ÿงน Cleaning old docs..." -rm -rf "$OUTPUT_DIR" - -echo "๐Ÿ“š Generating DocC documentation..." -swift package \ - generate-documentation \ - --allow-writing-to-directory "$OUTPUT_DIR" \ - --output-path "$OUTPUT_DIR" \ - --transform-for-static-hosting \ - ${REPO_NAME:+--hosting-base-path "$REPO_NAME"} \ - $COMBINED_FLAG \ - $TARGET_FLAGS - -echo -echo "๐ŸŽ‰ Documentation generated successfully!" -echo "๐Ÿ“ Location: $OUTPUT_DIR" -echo -echo "๐Ÿ‘‰ Preview locally:" -echo " python3 -m http.server --directory docs 8080" -echo -exit 0 \ No newline at end of file diff --git a/scripts/generate-docs.sh b/scripts/generate-docs.sh new file mode 100644 index 0000000..ddbf7ab --- /dev/null +++ b/scripts/generate-docs.sh @@ -0,0 +1,84 @@ +#!/bin/bash +set -e + +OUTPUT_DIR="./docs" +CONFIG_FILE=".doccTargetList" +TARGET_FLAGS="" +COMBINED_FLAG="" +TARGETS="" + +# Detect repo name (for hosting-base-path) +if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then + REPO_NAME=$(basename "$(git rev-parse --show-toplevel)") +else + REPO_NAME="" +fi + +# Read targets from .doccTargetList +read_targets_from_config() { + TARGETS=$(grep -v '^\s*$' "$CONFIG_FILE") + if [ -z "$TARGETS" ]; then + echo "Error: $CONFIG_FILE exists but contains no valid targets." + exit 1 + fi + + for TARGET in $TARGETS; do + TARGET_FLAGS="$TARGET_FLAGS --target $TARGET" + done +} + +# Auto-detect documentable Swift targets +auto_detect_targets() { + if ! command -v jq >/dev/null 2>&1; then + echo "Error: jq is required. Install with: brew install jq" + exit 1 + fi + + TARGETS=$(swift package dump-package \ + | jq -r '.targets[] + | select(.type == "regular" or .type == "executable") + | .name') + + if [ -z "$TARGETS" ]; then + echo "Error: No documentable targets found." + exit 1 + fi + + for TARGET in $TARGETS; do + TARGET_FLAGS="$TARGET_FLAGS --target $TARGET" + done +} + +# Select target list +if [ -f "$CONFIG_FILE" ]; then + read_targets_from_config +else + auto_detect_targets +fi + +# Count real targets +TARGET_COUNT=$(printf "%s\n" "$TARGETS" | grep -c .) + +# Enable combined documentation if needed +if [ "$TARGET_COUNT" -gt 1 ]; then + COMBINED_FLAG="--enable-experimental-combined-documentation" +fi + +# Clean docs directory +if [ -d "$OUTPUT_DIR" ]; then + rm -rf "$OUTPUT_DIR" +fi + +mkdir -p "$OUTPUT_DIR" + +# Build documentation +swift package \ + generate-documentation \ + --allow-writing-to-directory "$OUTPUT_DIR" \ + --output-path "$OUTPUT_DIR" \ + --transform-for-static-hosting \ + ${REPO_NAME:+--hosting-base-path "$REPO_NAME"} \ + $COMBINED_FLAG \ + $TARGET_FLAGS + +echo "Documentation generated in $OUTPUT_DIR" \ No newline at end of file From 27534aa997854a8f058cb8395f982aa82614c7ce Mon Sep 17 00:00:00 2001 From: GErP83 Date: Fri, 5 Dec 2025 13:57:40 +0100 Subject: [PATCH 03/30] Update generate-docs.sh --- scripts/generate-docs.sh | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/scripts/generate-docs.sh b/scripts/generate-docs.sh index ddbf7ab..7169b21 100644 --- a/scripts/generate-docs.sh +++ b/scripts/generate-docs.sh @@ -4,18 +4,18 @@ set -e OUTPUT_DIR="./docs" CONFIG_FILE=".doccTargetList" TARGET_FLAGS="" -COMBINED_FLAG="" TARGETS="" +COMBINED_FLAG="" -# Detect repo name (for hosting-base-path) +# Detect hosting base path (repo name) if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then REPO_NAME=$(basename "$(git rev-parse --show-toplevel)") else REPO_NAME="" fi -# Read targets from .doccTargetList -read_targets_from_config() { +# Load targets from .doccTargetList if exists +load_from_config() { TARGETS=$(grep -v '^\s*$' "$CONFIG_FILE") if [ -z "$TARGETS" ]; then echo "Error: $CONFIG_FILE exists but contains no valid targets." @@ -27,17 +27,17 @@ read_targets_from_config() { done } -# Auto-detect documentable Swift targets +# Auto-detect valid Swift targets auto_detect_targets() { if ! command -v jq >/dev/null 2>&1; then - echo "Error: jq is required. Install with: brew install jq" + echo "Error: jq required (install via: brew install jq)" exit 1 fi TARGETS=$(swift package dump-package \ | jq -r '.targets[] - | select(.type == "regular" or .type == "executable") - | .name') + | select(.type == "regular" or .type == "executable") + | .name') if [ -z "$TARGETS" ]; then echo "Error: No documentable targets found." @@ -49,9 +49,9 @@ auto_detect_targets() { done } -# Select target list +# Determine target list source if [ -f "$CONFIG_FILE" ]; then - read_targets_from_config + load_from_config else auto_detect_targets fi @@ -59,19 +59,26 @@ fi # Count real targets TARGET_COUNT=$(printf "%s\n" "$TARGETS" | grep -c .) -# Enable combined documentation if needed +# Log targets +echo "Detected documentation targets:" +printf "%s\n" "$TARGETS" + +# Determine if combined docs is needed if [ "$TARGET_COUNT" -gt 1 ]; then COMBINED_FLAG="--enable-experimental-combined-documentation" + echo "Combined documentation: ENABLED" +else + COMBINED_FLAG="" + echo "Combined documentation: disabled" fi -# Clean docs directory -if [ -d "$OUTPUT_DIR" ]; then - rm -rf "$OUTPUT_DIR" -fi +echo +# Prepare output directory +rm -rf "$OUTPUT_DIR" mkdir -p "$OUTPUT_DIR" -# Build documentation +# Generate DocC documentation swift package \ generate-documentation \ --allow-writing-to-directory "$OUTPUT_DIR" \ From bfa663acc2dacf38f6a5becec78287a3c766f106 Mon Sep 17 00:00:00 2001 From: GErP83 Date: Fri, 5 Dec 2025 14:00:17 +0100 Subject: [PATCH 04/30] Update generate-docs.sh --- scripts/generate-docs.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/generate-docs.sh b/scripts/generate-docs.sh index 7169b21..0db7f26 100644 --- a/scripts/generate-docs.sh +++ b/scripts/generate-docs.sh @@ -82,10 +82,10 @@ mkdir -p "$OUTPUT_DIR" swift package \ generate-documentation \ --allow-writing-to-directory "$OUTPUT_DIR" \ + $COMBINED_FLAG \ + $TARGET_FLAGS \ --output-path "$OUTPUT_DIR" \ --transform-for-static-hosting \ - ${REPO_NAME:+--hosting-base-path "$REPO_NAME"} \ - $COMBINED_FLAG \ - $TARGET_FLAGS + ${REPO_NAME:+--hosting-base-path "$REPO_NAME"} echo "Documentation generated in $OUTPUT_DIR" \ No newline at end of file From 962ddd84b43eea1eed04649485a8ee2841662927 Mon Sep 17 00:00:00 2001 From: GErP83 Date: Fri, 5 Dec 2025 14:01:46 +0100 Subject: [PATCH 05/30] Update generate-docs.sh --- scripts/generate-docs.sh | 42 ++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/scripts/generate-docs.sh b/scripts/generate-docs.sh index 0db7f26..bf35a4b 100644 --- a/scripts/generate-docs.sh +++ b/scripts/generate-docs.sh @@ -7,30 +7,29 @@ TARGET_FLAGS="" TARGETS="" COMBINED_FLAG="" -# Detect hosting base path (repo name) +# Detect hosting base path from repo name if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then REPO_NAME=$(basename "$(git rev-parse --show-toplevel)") else REPO_NAME="" fi -# Load targets from .doccTargetList if exists +# Load targets from .doccTargetList if present load_from_config() { TARGETS=$(grep -v '^\s*$' "$CONFIG_FILE") if [ -z "$TARGETS" ]; then - echo "Error: $CONFIG_FILE exists but contains no valid targets." + echo "Error: $CONFIG_FILE is empty." exit 1 fi - for TARGET in $TARGETS; do TARGET_FLAGS="$TARGET_FLAGS --target $TARGET" done } -# Auto-detect valid Swift targets +# Auto-detect documentable Swift targets auto_detect_targets() { if ! command -v jq >/dev/null 2>&1; then - echo "Error: jq required (install via: brew install jq)" + echo "Error: jq required (install with: brew install jq)" exit 1 fi @@ -40,7 +39,7 @@ auto_detect_targets() { | .name') if [ -z "$TARGETS" ]; then - echo "Error: No documentable targets found." + echo "Error: no documentable targets found." exit 1 fi @@ -49,7 +48,7 @@ auto_detect_targets() { done } -# Determine target list source +# Pick source of targets if [ -f "$CONFIG_FILE" ]; then load_from_config else @@ -59,14 +58,13 @@ fi # Count real targets TARGET_COUNT=$(printf "%s\n" "$TARGETS" | grep -c .) -# Log targets -echo "Detected documentation targets:" +echo "Detected targets:" printf "%s\n" "$TARGETS" -# Determine if combined docs is needed +# Enable combined docs if needed if [ "$TARGET_COUNT" -gt 1 ]; then COMBINED_FLAG="--enable-experimental-combined-documentation" - echo "Combined documentation: ENABLED" + echo "Combined documentation: enabled" else COMBINED_FLAG="" echo "Combined documentation: disabled" @@ -74,18 +72,20 @@ fi echo -# Prepare output directory +# Clean & create docs directory rm -rf "$OUTPUT_DIR" mkdir -p "$OUTPUT_DIR" -# Generate DocC documentation +# ============================================ +# ๐Ÿš€ Correct SwiftPM DocC invocation order +# ============================================ swift package \ - generate-documentation \ - --allow-writing-to-directory "$OUTPUT_DIR" \ - $COMBINED_FLAG \ - $TARGET_FLAGS \ - --output-path "$OUTPUT_DIR" \ - --transform-for-static-hosting \ - ${REPO_NAME:+--hosting-base-path "$REPO_NAME"} + --allow-writing-to-directory "$OUTPUT_DIR" \ + generate-documentation \ + $COMBINED_FLAG \ + $TARGET_FLAGS \ + --output-path "$OUTPUT_DIR" \ + --transform-for-static-hosting \ + ${REPO_NAME:+--hosting-base-path "$REPO_NAME"} echo "Documentation generated in $OUTPUT_DIR" \ No newline at end of file From 252d56293b716de7ba0f85f40b0690f88e1ddbb1 Mon Sep 17 00:00:00 2001 From: GErP83 Date: Fri, 5 Dec 2025 14:04:55 +0100 Subject: [PATCH 06/30] Update generate-docs.sh --- scripts/generate-docs.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/generate-docs.sh b/scripts/generate-docs.sh index bf35a4b..b8c1e90 100644 --- a/scripts/generate-docs.sh +++ b/scripts/generate-docs.sh @@ -79,8 +79,7 @@ mkdir -p "$OUTPUT_DIR" # ============================================ # ๐Ÿš€ Correct SwiftPM DocC invocation order # ============================================ -swift package \ - --allow-writing-to-directory "$OUTPUT_DIR" \ +swift package --allow-writing-to-directory "$OUTPUT_DIR" \ generate-documentation \ $COMBINED_FLAG \ $TARGET_FLAGS \ From dd0096ff862b9c89a61c7bada9e4378021aa20b0 Mon Sep 17 00:00:00 2001 From: GErP83 Date: Fri, 5 Dec 2025 14:07:45 +0100 Subject: [PATCH 07/30] Update generate-docs.sh --- scripts/generate-docs.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/generate-docs.sh b/scripts/generate-docs.sh index b8c1e90..55ce2ef 100644 --- a/scripts/generate-docs.sh +++ b/scripts/generate-docs.sh @@ -70,15 +70,11 @@ else echo "Combined documentation: disabled" fi -echo - # Clean & create docs directory rm -rf "$OUTPUT_DIR" mkdir -p "$OUTPUT_DIR" -# ============================================ -# ๐Ÿš€ Correct SwiftPM DocC invocation order -# ============================================ +# SwiftPM DocC invocation swift package --allow-writing-to-directory "$OUTPUT_DIR" \ generate-documentation \ $COMBINED_FLAG \ From 6da6c3965831d2991a059f6b6b750e7ef1b18fee Mon Sep 17 00:00:00 2001 From: GErP83 Date: Fri, 5 Dec 2025 14:15:24 +0100 Subject: [PATCH 08/30] add better logs --- Makefile | 3 +++ scripts/generate-docs.sh | 41 ++++++++++++++++++++++++---------------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 9e62eab..1660607 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,9 @@ breakage: symlinks: curl -s $(baseUrl)/check-broken-symlinks.sh | bash +docc-create: + curl -s $(baseUrl)/generate-docs.sh | bash + docc-warnings: curl -s $(baseUrl)/check-docc-warnings.sh | bash diff --git a/scripts/generate-docs.sh b/scripts/generate-docs.sh index 55ce2ef..daffb75 100644 --- a/scripts/generate-docs.sh +++ b/scripts/generate-docs.sh @@ -1,5 +1,9 @@ -#!/bin/bash -set -e +#!/usr/bin/env bash +set -euo pipefail + +log() { printf -- "** %s\n" "$*" >&2; } +error() { printf -- "** ERROR: %s\n" "$*" >&2; } +fatal() { error "$@"; exit 1; } OUTPUT_DIR="./docs" CONFIG_FILE=".doccTargetList" @@ -18,9 +22,9 @@ fi load_from_config() { TARGETS=$(grep -v '^\s*$' "$CONFIG_FILE") if [ -z "$TARGETS" ]; then - echo "Error: $CONFIG_FILE is empty." - exit 1 + fatal "$CONFIG_FILE exists but contains no valid targets." fi + for TARGET in $TARGETS; do TARGET_FLAGS="$TARGET_FLAGS --target $TARGET" done @@ -29,8 +33,7 @@ load_from_config() { # Auto-detect documentable Swift targets auto_detect_targets() { if ! command -v jq >/dev/null 2>&1; then - echo "Error: jq required (install with: brew install jq)" - exit 1 + fatal "jq is required (install with: brew install jq)" fi TARGETS=$(swift package dump-package \ @@ -39,8 +42,7 @@ auto_detect_targets() { | .name') if [ -z "$TARGETS" ]; then - echo "Error: no documentable targets found." - exit 1 + fatal "No documentable targets found." fi for TARGET in $TARGETS; do @@ -48,33 +50,40 @@ auto_detect_targets() { done } -# Pick source of targets +# Choose config file OR auto-detect if [ -f "$CONFIG_FILE" ]; then + log "Using targets from $CONFIG_FILE" load_from_config else + log "Auto-detecting Swift targets" auto_detect_targets fi # Count real targets TARGET_COUNT=$(printf "%s\n" "$TARGETS" | grep -c .) -echo "Detected targets:" +log "Targets detected:" printf "%s\n" "$TARGETS" +log "Target count: $TARGET_COUNT" -# Enable combined docs if needed +# Enable combined documentation for multi-target packages if [ "$TARGET_COUNT" -gt 1 ]; then COMBINED_FLAG="--enable-experimental-combined-documentation" - echo "Combined documentation: enabled" + log "Combined documentation: ENABLED" else COMBINED_FLAG="" - echo "Combined documentation: disabled" + log "Combined documentation: disabled" fi -# Clean & create docs directory +log "Preparing output directory: $OUTPUT_DIR" + +# Clean & recreate docs directory rm -rf "$OUTPUT_DIR" mkdir -p "$OUTPUT_DIR" -# SwiftPM DocC invocation +# SwiftPM DocC invocation (strict parameter ordering) +log "Running DocC documentation generationโ€ฆ" + swift package --allow-writing-to-directory "$OUTPUT_DIR" \ generate-documentation \ $COMBINED_FLAG \ @@ -83,4 +92,4 @@ swift package --allow-writing-to-directory "$OUTPUT_DIR" \ --transform-for-static-hosting \ ${REPO_NAME:+--hosting-base-path "$REPO_NAME"} -echo "Documentation generated in $OUTPUT_DIR" \ No newline at end of file +log "Documentation generated in $OUTPUT_DIR" \ No newline at end of file From b485f63b245fe73ca43d631f5ae1f08f42c8b64e Mon Sep 17 00:00:00 2001 From: GErP83 Date: Fri, 5 Dec 2025 14:17:50 +0100 Subject: [PATCH 09/30] Update generate-docs.sh --- scripts/generate-docs.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/scripts/generate-docs.sh b/scripts/generate-docs.sh index daffb75..037da6a 100644 --- a/scripts/generate-docs.sh +++ b/scripts/generate-docs.sh @@ -75,21 +75,15 @@ else log "Combined documentation: disabled" fi -log "Preparing output directory: $OUTPUT_DIR" - # Clean & recreate docs directory rm -rf "$OUTPUT_DIR" mkdir -p "$OUTPUT_DIR" # SwiftPM DocC invocation (strict parameter ordering) -log "Running DocC documentation generationโ€ฆ" - swift package --allow-writing-to-directory "$OUTPUT_DIR" \ generate-documentation \ $COMBINED_FLAG \ - $TARGET_FLAGS \ + "$TARGET_FLAGS" \ --output-path "$OUTPUT_DIR" \ --transform-for-static-hosting \ ${REPO_NAME:+--hosting-base-path "$REPO_NAME"} - -log "Documentation generated in $OUTPUT_DIR" \ No newline at end of file From a08f100bca73a788e764912d272be3c8decd6eeb Mon Sep 17 00:00:00 2001 From: GErP83 Date: Fri, 5 Dec 2025 20:34:09 +0100 Subject: [PATCH 10/30] change docc warning logic --- .doccTargetList | 1 + scripts/check-docc-warnings.sh | 65 +++++++++++++++---- .../{generate-docs.sh => generate-docc.sh} | 32 ++++----- 3 files changed, 67 insertions(+), 31 deletions(-) create mode 100644 .doccTargetList rename scripts/{generate-docs.sh => generate-docc.sh} (74%) mode change 100644 => 100755 diff --git a/.doccTargetList b/.doccTargetList new file mode 100644 index 0000000..4bc365c --- /dev/null +++ b/.doccTargetList @@ -0,0 +1 @@ +Add one target per line \ No newline at end of file diff --git a/scripts/check-docc-warnings.sh b/scripts/check-docc-warnings.sh index 2e610b1..cc0086e 100755 --- a/scripts/check-docc-warnings.sh +++ b/scripts/check-docc-warnings.sh @@ -1,25 +1,64 @@ #!/usr/bin/env bash set -euo pipefail -log() { printf -- "** %s\n" "$*" >&2; } +log() { printf -- "** %s\n" "$*" >&2; } error() { printf -- "** ERROR: %s\n" "$*" >&2; } fatal() { error "$@"; exit 1; } REPO_ROOT="$(git -C "$PWD" rev-parse --show-toplevel)" +TARGETS="" +TARGET_LIST=() -log "Checking required environment variables..." -test -n "${DOCC_TARGET:-}" || fatal "DOCC_TARGET unset" +# Auto-detect documentable Swift targets +log "Detecting Swift targets for DocC analysisโ€ฆ" -swift package --package-path "${REPO_ROOT}" plugin generate-documentation \ - --product "${DOCC_TARGET}" \ - --analyze \ - --level detailed \ - --warnings-as-errors \ - && DOCC_PLUGIN_RC=$? || DOCC_PLUGIN_RC=$? +if ! command -v jq >/dev/null 2>&1; then + fatal "jq is required. Install with: brew install jq" +fi + +TARGETS=$(swift package dump-package \ + | jq -r '.targets[] + | select(.type == "regular" or .type == "executable") + | .name') + +if [ -z "$TARGETS" ]; then + fatal "No documentable targets found in Package.swift" +fi + +# Convert to array +while IFS= read -r TARGET; do + TARGET_LIST+=("$TARGET") +done <<< "$TARGETS" + +TARGET_COUNT="${#TARGET_LIST[@]}" + +log "Found targets:" +printf "%s\n" "${TARGET_LIST[@]}" +log "Target count: $TARGET_COUNT" + +# Run DocC analysis (per target) +echo +TOTAL_RC=0 +for TARGET in "${TARGET_LIST[@]}"; do + set +e + swift package \ + --package-path "$REPO_ROOT" \ + plugin \ + generate-documentation \ + --target "$TARGET" \ + --analyze \ + --warnings-as-errors + RC=$? + set -e + if [ "$RC" -ne 0 ]; then + error "DocC analysis failed for target '$TARGET'" + TOTAL_RC=$RC + fi +done -if [ "${DOCC_PLUGIN_RC}" -ne 0 ]; then - fatal "โŒ Generating documentation produced warnings and/or errors." - exit "${DOCC_PLUGIN_RC}" +# Final result +if [ "$TOTAL_RC" -ne 0 ]; then + fatal "Documentation analysis failed." fi -log "โœ… Generated documentation with no warnings." \ No newline at end of file +log "All targets passed DocC analysis without warnings." \ No newline at end of file diff --git a/scripts/generate-docs.sh b/scripts/generate-docc.sh old mode 100644 new mode 100755 similarity index 74% rename from scripts/generate-docs.sh rename to scripts/generate-docc.sh index 037da6a..693b6f6 --- a/scripts/generate-docs.sh +++ b/scripts/generate-docc.sh @@ -7,11 +7,11 @@ fatal() { error "$@"; exit 1; } OUTPUT_DIR="./docs" CONFIG_FILE=".doccTargetList" -TARGET_FLAGS="" TARGETS="" +TARGET_FLAGS=() COMBINED_FLAG="" -# Detect hosting base path from repo name +# Detect repo name for hosting-base-path if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then REPO_NAME=$(basename "$(git rev-parse --show-toplevel)") else @@ -20,13 +20,12 @@ fi # Load targets from .doccTargetList if present load_from_config() { - TARGETS=$(grep -v '^\s*$' "$CONFIG_FILE") + TARGETS=$(grep -v '^\s*$' "$CONFIG_FILE" || true) if [ -z "$TARGETS" ]; then fatal "$CONFIG_FILE exists but contains no valid targets." fi - for TARGET in $TARGETS; do - TARGET_FLAGS="$TARGET_FLAGS --target $TARGET" + TARGET_FLAGS+=( --target "$TARGET" ) done } @@ -35,22 +34,19 @@ auto_detect_targets() { if ! command -v jq >/dev/null 2>&1; then fatal "jq is required (install with: brew install jq)" fi - TARGETS=$(swift package dump-package \ | jq -r '.targets[] | select(.type == "regular" or .type == "executable") | .name') - if [ -z "$TARGETS" ]; then - fatal "No documentable targets found." + fatal "No documentable targets found in Package.swift." fi - for TARGET in $TARGETS; do - TARGET_FLAGS="$TARGET_FLAGS --target $TARGET" + TARGET_FLAGS+=( --target "$TARGET" ) done } -# Choose config file OR auto-detect +# Select target source if [ -f "$CONFIG_FILE" ]; then log "Using targets from $CONFIG_FILE" load_from_config @@ -59,31 +55,31 @@ else auto_detect_targets fi -# Count real targets +# Count non-empty targets TARGET_COUNT=$(printf "%s\n" "$TARGETS" | grep -c .) log "Targets detected:" printf "%s\n" "$TARGETS" log "Target count: $TARGET_COUNT" -# Enable combined documentation for multi-target packages +# Enable experimental combined docs when >1 target if [ "$TARGET_COUNT" -gt 1 ]; then COMBINED_FLAG="--enable-experimental-combined-documentation" - log "Combined documentation: ENABLED" + log "Combined documentation: enabled" else COMBINED_FLAG="" log "Combined documentation: disabled" fi -# Clean & recreate docs directory rm -rf "$OUTPUT_DIR" mkdir -p "$OUTPUT_DIR" -# SwiftPM DocC invocation (strict parameter ordering) +# Generate documentation +echo swift package --allow-writing-to-directory "$OUTPUT_DIR" \ generate-documentation \ $COMBINED_FLAG \ - "$TARGET_FLAGS" \ + "${TARGET_FLAGS[@]}" \ --output-path "$OUTPUT_DIR" \ --transform-for-static-hosting \ - ${REPO_NAME:+--hosting-base-path "$REPO_NAME"} + ${REPO_NAME:+--hosting-base-path "$REPO_NAME"} \ No newline at end of file From 92cb6fe248bfdacaa311142780aece3e11495cce Mon Sep 17 00:00:00 2001 From: GErP83 Date: Sat, 6 Dec 2025 10:55:43 +0100 Subject: [PATCH 11/30] Update Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1660607..0b50120 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ symlinks: curl -s $(baseUrl)/check-broken-symlinks.sh | bash docc-create: - curl -s $(baseUrl)/generate-docs.sh | bash + curl -s $(baseUrl)/generate-docc.sh | bash docc-warnings: curl -s $(baseUrl)/check-docc-warnings.sh | bash From e8d1416f9f174f968f63747e9fa664f63e83c120 Mon Sep 17 00:00:00 2001 From: GErP83 Date: Sat, 6 Dec 2025 16:57:42 +0100 Subject: [PATCH 12/30] add run docc --- Makefile | 7 ++++++- scripts/generate-docc.sh | 42 +++++++++++++++++++++++++++----------- scripts/run-docc-docker.sh | 35 +++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 13 deletions(-) create mode 100755 scripts/run-docc-docker.sh diff --git a/Makefile b/Makefile index 0b50120..210b6ea 100644 --- a/Makefile +++ b/Makefile @@ -8,12 +8,17 @@ breakage: symlinks: curl -s $(baseUrl)/check-broken-symlinks.sh | bash -docc-create: +## params: --local: generate for local testing +docc-generate: curl -s $(baseUrl)/generate-docc.sh | bash docc-warnings: curl -s $(baseUrl)/check-docc-warnings.sh | bash +## params: -n: name, -p: port +run-docc: + curl -s $(baseUrl)/run-docc-docker.sh | bash + headers: curl -s $(baseUrl)/check-swift-headers.sh | bash diff --git a/scripts/generate-docc.sh b/scripts/generate-docc.sh index 693b6f6..1151b02 100755 --- a/scripts/generate-docc.sh +++ b/scripts/generate-docc.sh @@ -6,10 +6,19 @@ error() { printf -- "** ERROR: %s\n" "$*" >&2; } fatal() { error "$@"; exit 1; } OUTPUT_DIR="./docs" -CONFIG_FILE=".doccTargetList" +TARGETS_FILE=".doccTargetList" TARGETS="" TARGET_FLAGS=() COMBINED_FLAG="" +LOCAL_MODE=false + +# Parse optional parameter: --local +if [[ "${1:-}" == "--local" ]]; then + LOCAL_MODE=true + log "DocC generation mode: local testing (no static hosting)" +else + log "DocC generation mode: GitHub Pages" +fi # Detect repo name for hosting-base-path if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then @@ -20,9 +29,9 @@ fi # Load targets from .doccTargetList if present load_from_config() { - TARGETS=$(grep -v '^\s*$' "$CONFIG_FILE" || true) + TARGETS=$(grep -v '^\s*$' "$TARGETS_FILE" || true) if [ -z "$TARGETS" ]; then - fatal "$CONFIG_FILE exists but contains no valid targets." + fatal "$TARGETS_FILE exists but contains no valid targets." fi for TARGET in $TARGETS; do TARGET_FLAGS+=( --target "$TARGET" ) @@ -47,8 +56,8 @@ auto_detect_targets() { } # Select target source -if [ -f "$CONFIG_FILE" ]; then - log "Using targets from $CONFIG_FILE" +if [ -f "$TARGETS_FILE" ]; then + log "Using targets from $TARGETS_FILE" load_from_config else log "Auto-detecting Swift targets" @@ -76,10 +85,19 @@ mkdir -p "$OUTPUT_DIR" # Generate documentation echo -swift package --allow-writing-to-directory "$OUTPUT_DIR" \ - generate-documentation \ - $COMBINED_FLAG \ - "${TARGET_FLAGS[@]}" \ - --output-path "$OUTPUT_DIR" \ - --transform-for-static-hosting \ - ${REPO_NAME:+--hosting-base-path "$REPO_NAME"} \ No newline at end of file +if $LOCAL_MODE; then + swift package --allow-writing-to-directory "$OUTPUT_DIR" \ + generate-documentation \ + $COMBINED_FLAG \ + "${TARGET_FLAGS[@]}" \ + --output-path "$OUTPUT_DIR" + +else + swift package --allow-writing-to-directory "$OUTPUT_DIR" \ + generate-documentation \ + $COMBINED_FLAG \ + "${TARGET_FLAGS[@]}" \ + --output-path "$OUTPUT_DIR" \ + --transform-for-static-hosting \ + ${REPO_NAME:+--hosting-base-path "$REPO_NAME"} +fi \ No newline at end of file diff --git a/scripts/run-docc-docker.sh b/scripts/run-docc-docker.sh new file mode 100755 index 0000000..b1d9ff7 --- /dev/null +++ b/scripts/run-docc-docker.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +set -euo pipefail + +log() { printf -- "** %s\n" "$*" >&2; } +error() { printf -- "** ERROR: %s\n" "$*" >&2; } +fatal() { error "$@"; exit 1; } + +REPO_ROOT="$(git -C "$PWD" rev-parse --show-toplevel)" +DOCC_DIR="${REPO_ROOT}/docs" +NAME="docc-server" +PORT="8080:80" + +# Validate docs directory +if ! [ -d "${DOCC_DIR}" ]; then + fatal "DocC output directory not found: ${DOCC_DIR}" +fi + +# Parse optional CLI flags +while getopts ":n:p:" flag; do + case "${flag}" in + n) NAME="${OPTARG}" ;; + p) PORT="${OPTARG}" ;; + *) ;; + esac +done + +LOCAL_PORT="${PORT%%:*}" +log "Open in browser: http://localhost:${LOCAL_PORT}/documentation/" +echo + +# Serve using Docker nginx +docker run --rm --name "${NAME}" \ + -v "${DOCC_DIR}:/usr/share/nginx/html" \ + -p "${PORT}" \ + nginx \ No newline at end of file From 8b736eab09c777e4330f420fea096e8542cf401c Mon Sep 17 00:00:00 2001 From: GErP83 Date: Sat, 6 Dec 2025 18:45:51 +0100 Subject: [PATCH 13/30] Create docc_deploy.yml --- .github/workflows/docc_deploy.yml | 67 +++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/docc_deploy.yml diff --git a/.github/workflows/docc_deploy.yml b/.github/workflows/docc_deploy.yml new file mode 100644 index 0000000..0071bb3 --- /dev/null +++ b/.github/workflows/docc_deploy.yml @@ -0,0 +1,67 @@ +name: DocC Deploy + +on: + workflow_call: + inputs: + docc_swift_version: + type: string + description: "Swift version used to generate DocC documentation." + default: "6.2" + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-docc + cancel-in-progress: true + + +jobs: + + generate-docc: + name: Generate DocC documentation + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Swift ${{ inputs.docc_swift_version }} + uses: swift-actions/setup-swift@v1 + with: + swift-version: ${{ inputs.docc_swift_version }} + + - name: Install jq + run: | + sudo apt-get update -y + sudo apt-get install -y jq + + - name: Generate DocC documentation + run: | + curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/main/scripts/generate-docc.sh | bash + + - name: Upload DocC artifact + uses: actions/upload-pages-artifact@v3 + with: + path: docs + + + deploy: + name: Deploy DocC to GitHub Pages + needs: generate-docc + runs-on: ubuntu-latest + + permissions: + pages: write + id-token: write + + environment: + name: github-pages + url: ${{ steps.deploy.outputs.page_url }} + + steps: + - name: Deploy to GitHub Pages + id: deploy + uses: actions/deploy-pages@v4 \ No newline at end of file From 1055ac9291573dc93014b375e9b702007341bed5 Mon Sep 17 00:00:00 2001 From: GErP83 Date: Sun, 7 Dec 2025 19:46:34 +0100 Subject: [PATCH 14/30] Update docc_deploy.yml --- .github/workflows/docc_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docc_deploy.yml b/.github/workflows/docc_deploy.yml index 0071bb3..f6dc0d0 100644 --- a/.github/workflows/docc_deploy.yml +++ b/.github/workflows/docc_deploy.yml @@ -22,7 +22,7 @@ jobs: generate-docc: name: Generate DocC documentation - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout repository From a8932f9682a1e5216b146d167a0ef1871cff34fd Mon Sep 17 00:00:00 2001 From: GErP83 Date: Sun, 7 Dec 2025 19:50:28 +0100 Subject: [PATCH 15/30] Update docc_deploy.yml --- .github/workflows/docc_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docc_deploy.yml b/.github/workflows/docc_deploy.yml index f6dc0d0..857b6d4 100644 --- a/.github/workflows/docc_deploy.yml +++ b/.github/workflows/docc_deploy.yml @@ -29,7 +29,7 @@ jobs: uses: actions/checkout@v4 - name: Install Swift ${{ inputs.docc_swift_version }} - uses: swift-actions/setup-swift@v1 + uses: swift-actions/setup-swift@v3 with: swift-version: ${{ inputs.docc_swift_version }} From 9665da81b16754feac56b13c383954c706b6e489 Mon Sep 17 00:00:00 2001 From: GErP83 Date: Sun, 7 Dec 2025 20:00:22 +0100 Subject: [PATCH 16/30] Update docc_deploy.yml --- .github/workflows/docc_deploy.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docc_deploy.yml b/.github/workflows/docc_deploy.yml index 857b6d4..5a029c4 100644 --- a/.github/workflows/docc_deploy.yml +++ b/.github/workflows/docc_deploy.yml @@ -22,17 +22,15 @@ jobs: generate-docc: name: Generate DocC documentation - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest + + container: + image: swift:${{ inputs.docc_swift_version }} steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Install Swift ${{ inputs.docc_swift_version }} - uses: swift-actions/setup-swift@v3 - with: - swift-version: ${{ inputs.docc_swift_version }} - - name: Install jq run: | sudo apt-get update -y @@ -40,7 +38,7 @@ jobs: - name: Generate DocC documentation run: | - curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/main/scripts/generate-docc.sh | bash + curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/feature/docc/scripts/generate-docc.sh | bash - name: Upload DocC artifact uses: actions/upload-pages-artifact@v3 From 7781500fffea9a4f254fcd112f420aec93067ec6 Mon Sep 17 00:00:00 2001 From: GErP83 Date: Sun, 7 Dec 2025 20:02:48 +0100 Subject: [PATCH 17/30] Update docc_deploy.yml --- .github/workflows/docc_deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docc_deploy.yml b/.github/workflows/docc_deploy.yml index 5a029c4..66259e8 100644 --- a/.github/workflows/docc_deploy.yml +++ b/.github/workflows/docc_deploy.yml @@ -33,8 +33,8 @@ jobs: - name: Install jq run: | - sudo apt-get update -y - sudo apt-get install -y jq + apt-get update -y + apt-get install -y jq - name: Generate DocC documentation run: | From 31619228f37b006e024a037cdfdb2bfd8090c607 Mon Sep 17 00:00:00 2001 From: GErP83 Date: Sun, 7 Dec 2025 20:05:03 +0100 Subject: [PATCH 18/30] Update docc_deploy.yml --- .github/workflows/docc_deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docc_deploy.yml b/.github/workflows/docc_deploy.yml index 66259e8..f8ba30b 100644 --- a/.github/workflows/docc_deploy.yml +++ b/.github/workflows/docc_deploy.yml @@ -31,10 +31,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Install jq + - name: Install curl + jq run: | apt-get update -y - apt-get install -y jq + apt-get install -y curl jq - name: Generate DocC documentation run: | From 666dcd49b1e7423e430b24e44012f35efca9d851 Mon Sep 17 00:00:00 2001 From: GErP83 Date: Sun, 7 Dec 2025 20:12:51 +0100 Subject: [PATCH 19/30] Update generate-docc.sh --- scripts/generate-docc.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/generate-docc.sh b/scripts/generate-docc.sh index 1151b02..c5b7284 100755 --- a/scripts/generate-docc.sh +++ b/scripts/generate-docc.sh @@ -83,6 +83,8 @@ fi rm -rf "$OUTPUT_DIR" mkdir -p "$OUTPUT_DIR" +log "repo name: $REPO_NAME" + # Generate documentation echo if $LOCAL_MODE; then From 5473c3b934fd8803b0ba37f1773ab4ec6457bff8 Mon Sep 17 00:00:00 2001 From: GErP83 Date: Sun, 7 Dec 2025 20:26:13 +0100 Subject: [PATCH 20/30] fix repo name --- .github/workflows/docc_deploy.yml | 2 +- scripts/generate-docc.sh | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docc_deploy.yml b/.github/workflows/docc_deploy.yml index f8ba30b..e93aa8f 100644 --- a/.github/workflows/docc_deploy.yml +++ b/.github/workflows/docc_deploy.yml @@ -38,7 +38,7 @@ jobs: - name: Generate DocC documentation run: | - curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/feature/docc/scripts/generate-docc.sh | bash + curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/feature/docc/scripts/generate-docc.sh | bash -s ${{ github.event.repository.name }} - name: Upload DocC artifact uses: actions/upload-pages-artifact@v3 diff --git a/scripts/generate-docc.sh b/scripts/generate-docc.sh index c5b7284..0e92c7c 100755 --- a/scripts/generate-docc.sh +++ b/scripts/generate-docc.sh @@ -20,12 +20,15 @@ else log "DocC generation mode: GitHub Pages" fi -# Detect repo name for hosting-base-path -if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then - REPO_NAME=$(basename "$(git rev-parse --show-toplevel)") +# If repo name argument is passed use it, otherwise detect via git +if [ -n "${1:-}" ]; then + REPO_NAME="$1" else - REPO_NAME="" + # fallback to git detection + REPO_ROOT="$(git rev-parse --show-toplevel)" + REPO_NAME="$(basename "$REPO_ROOT")" fi +log "Using repo name: $REPO_NAME" # Load targets from .doccTargetList if present load_from_config() { @@ -83,8 +86,6 @@ fi rm -rf "$OUTPUT_DIR" mkdir -p "$OUTPUT_DIR" -log "repo name: $REPO_NAME" - # Generate documentation echo if $LOCAL_MODE; then From 5b710e3b360115372a9feda58c15a901c0d8df0b Mon Sep 17 00:00:00 2001 From: GErP83 Date: Sun, 7 Dec 2025 20:40:29 +0100 Subject: [PATCH 21/30] add new name param --- .github/workflows/docc_deploy.yml | 2 +- scripts/generate-docc.sh | 45 ++++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/.github/workflows/docc_deploy.yml b/.github/workflows/docc_deploy.yml index e93aa8f..282bb7f 100644 --- a/.github/workflows/docc_deploy.yml +++ b/.github/workflows/docc_deploy.yml @@ -38,7 +38,7 @@ jobs: - name: Generate DocC documentation run: | - curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/feature/docc/scripts/generate-docc.sh | bash -s ${{ github.event.repository.name }} + curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/feature/docc/scripts/generate-docc.sh | bash -s --name ${{ github.event.repository.name }} - name: Upload DocC artifact uses: actions/upload-pages-artifact@v3 diff --git a/scripts/generate-docc.sh b/scripts/generate-docc.sh index 0e92c7c..8b4e989 100755 --- a/scripts/generate-docc.sh +++ b/scripts/generate-docc.sh @@ -12,23 +12,44 @@ TARGET_FLAGS=() COMBINED_FLAG="" LOCAL_MODE=false -# Parse optional parameter: --local -if [[ "${1:-}" == "--local" ]]; then - LOCAL_MODE=true +# Argument parsing +while [[ $# -gt 0 ]]; do + case "$1" in + --local) + LOCAL_MODE=true + shift + ;; + --name) + if [[ -n "${2:-}" ]]; then + REPO_NAME="$2" + shift 2 + else + error "--name flag requires a value but none was provided" + exit 1 + fi + ;; + *) + error "Unknown argument: $1" + exit 1 + ;; + esac +done + +# Determine repo name +if [[ -z "$REPO_NAME" ]]; then + if git rev-parse --show-toplevel >/dev/null 2>&1; then + REPO_ROOT="$(git rev-parse --show-toplevel)" + REPO_NAME="$(basename "$REPO_ROOT")" + fi +fi + +if $LOCAL_MODE; then log "DocC generation mode: local testing (no static hosting)" else log "DocC generation mode: GitHub Pages" fi -# If repo name argument is passed use it, otherwise detect via git -if [ -n "${1:-}" ]; then - REPO_NAME="$1" -else - # fallback to git detection - REPO_ROOT="$(git rev-parse --show-toplevel)" - REPO_NAME="$(basename "$REPO_ROOT")" -fi -log "Using repo name: $REPO_NAME" +log "Repo name value: '${REPO_NAME}' (empty means no hosting-base-path)" # Load targets from .doccTargetList if present load_from_config() { From b3d9af26e32da85cf3e19e0a5a4e81b86964a78d Mon Sep 17 00:00:00 2001 From: GErP83 Date: Sun, 7 Dec 2025 20:45:50 +0100 Subject: [PATCH 22/30] Update docc_deploy.yml --- .github/workflows/docc_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docc_deploy.yml b/.github/workflows/docc_deploy.yml index 282bb7f..e17d706 100644 --- a/.github/workflows/docc_deploy.yml +++ b/.github/workflows/docc_deploy.yml @@ -38,7 +38,7 @@ jobs: - name: Generate DocC documentation run: | - curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/feature/docc/scripts/generate-docc.sh | bash -s --name ${{ github.event.repository.name }} + curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/feature/docc/scripts/generate-docc.sh | bash -s -- name ${{ github.event.repository.name }} - name: Upload DocC artifact uses: actions/upload-pages-artifact@v3 From bded5155b28f2fc6a556e904159072a5995e7c3c Mon Sep 17 00:00:00 2001 From: GErP83 Date: Sun, 7 Dec 2025 20:48:48 +0100 Subject: [PATCH 23/30] Update docc_deploy.yml --- .github/workflows/docc_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docc_deploy.yml b/.github/workflows/docc_deploy.yml index e17d706..b5eec08 100644 --- a/.github/workflows/docc_deploy.yml +++ b/.github/workflows/docc_deploy.yml @@ -38,7 +38,7 @@ jobs: - name: Generate DocC documentation run: | - curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/feature/docc/scripts/generate-docc.sh | bash -s -- name ${{ github.event.repository.name }} + curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/feature/docc/scripts/generate-docc.sh | bash -s -- --name ${{ github.event.repository.name }} - name: Upload DocC artifact uses: actions/upload-pages-artifact@v3 From 5b09004cf7f1cebfb8b03f13826f2093ea5998c1 Mon Sep 17 00:00:00 2001 From: GErP83 Date: Sun, 7 Dec 2025 20:58:43 +0100 Subject: [PATCH 24/30] Update generate-docc.sh --- scripts/generate-docc.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/generate-docc.sh b/scripts/generate-docc.sh index 8b4e989..c1565ee 100755 --- a/scripts/generate-docc.sh +++ b/scripts/generate-docc.sh @@ -11,6 +11,7 @@ TARGETS="" TARGET_FLAGS=() COMBINED_FLAG="" LOCAL_MODE=false +REPO_NAME="" # Argument parsing while [[ $# -gt 0 ]]; do From dafe7137e6a6c7745c9293abca8fa8cd0b84376f Mon Sep 17 00:00:00 2001 From: GErP83 Date: Wed, 10 Dec 2025 15:45:38 +0100 Subject: [PATCH 25/30] Update README.md --- README.md | 422 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 361 insertions(+), 61 deletions(-) diff --git a/README.md b/README.md index 2e18047..95ae0a6 100644 --- a/README.md +++ b/README.md @@ -1,111 +1,411 @@ # GitHub Actions Workflows + This repository contains a reusable workflow and various bash scripts designed to streamline tasks in a Swift project. The workflow utilizes the official [swiftlang/github-workflows](https://github.com/swiftlang/github-workflows) to perform checks and run Swift tests on the repository. ## Install + No installation required. -## How to use the workflow? -To use the workflow in a repository, simply copy the **sample_actions.yml** file into the **.github/workflows** directory within the repository. For more configuration options, refer to the official [swiftlang/github-workflows](https://github.com/swiftlang/github-workflows) repository. +## Workflows + +This section details the reusable workflows provided by the repository. + +### 1. Extra Soundness Workflow (`extra_soundness.yml`) + +This workflow provides configurable, robust checks and testing: + +* **Optional Local Swift Dependency Checks**: Checks for accidental `.package(path:)` usage. +* **Optional Swift Test Execution**: Runs tests using **`.build` caching** for efficiency. +* **Multi-Version Support**: Tests across multiple Swift versions, configurable via input (defaulting to `["6.0", "6.1"]`). +* **SSH Support**: Includes steps to set up **SSH credentials** (via the `SSH_PRIVATE_KEY` secret) for projects relying on private Git dependencies. + +**Example Usage (Caller Repository):** + +```yaml +jobs: + soundness: + uses: BinaryBirds/github-workflows/.github/workflows/extra_soundness.yml@main + with: + local_swift_dependencies_check_enabled: true + run_tests_with_cache_enabled: true + run_tests_swift_versions: '["6.0","6.1"]' +``` + +### 2\. DocC Deploy Workflow (`docc_deploy.yml`) + +This workflow handles the generation and deployment of DocC documentation: + +* **Builds DocC Documentation**: Uses a Swift Docker image (default version "6.2") to build the documentation. +* **Deploys to GitHub Pages**: Uses `actions/deploy-pages@v4` to publish the results. +* **Note on Stability**: This workflow is currently configured to fetch its core script (`generate-docc.sh`) from the **`feature/docc`** branch. + +**Example Usage (Caller Repository):** + +```yaml +jobs: + create-docc-and-deploy: + uses: BinaryBirds/github-workflows/.github/workflows/docc_deploy.yml@main + permissions: + contents: read + pages: write + id-token: write + with: + docc_swift_version: "6.1" +``` + +----- + +## Makefile Usage + +A **Makefile** is included to simplify the execution of all automation tasks by converting long `curl | bash` commands into short, memorable `make` targets. -## How to use the script(s)? -A **Makefile** is included in this repository to simplify script execution. Copy it to the repositoryโ€™s root directory where the scripts will be used. +### Combined Makefile Commands -## Available scripts +The `check` target is a composite command that executes several core quality checks sequentially. + +* `check`: Executes `make symlinks` -\> `make language` -\> `make deps` -\> `make lint`. + +### Benefits + +* **Standardizes script usage** and ensures consistent options. +* **Shortens long commands** into memorable tasks. +* Supports composite commands and reduces human error. + +----- + +## Available Scripts Documentation + +The `Makefile` uses the variable `baseUrl` which points to the source of all scripts: +`https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/main/scripts` ### check-api-breakage.sh -This script runs a check for any breaking changes in the API. It uses the swift package diagnose-api-breaking-changes command to analyze the current API against the last tagged version and reports any breaking changes found. -Usage: `make breakage` +**Purpose**: Detects API-breaking changes compared to the latest Git tag using the `swift package diagnose-api-breaking-changes` command. + +**Makefile Command**: + +```sh +make breakage +``` + +**Raw curl Command**: + +```sh +curl -s $(baseUrl)/check-api-breakage.sh | bash +``` + +----- ### check-broken-symlinks.sh -This script runs a search to find and report broken symbolic links within the repository. It iterates over all files tracked by Git and checks if their symlink targets exist. -Usage: `make symlinks` +**Purpose**: Runs a search to find and report **broken symbolic links** within the repository. + +**Makefile Command**: + +```sh +make symlinks +``` + +**Raw curl Command**: + +```sh +curl -s $(baseUrl)/check-broken-symlinks.sh | bash +``` + +----- ### check-docc-warnings.sh -This script executes Swift Package Managerโ€™s documentation generation with the **--warnings-as-errors** flag to ensure that any documentation warnings are treated as errors, maintaining high-quality documentation standards. -Usage: `make docc-warnings` +**Purpose**: Executes DocC documentation analysis with the **`--warnings-as-errors`** flag to enforce strict quality standards. -### check-swift-headers.sh -This script checks and optionally fixes Swift source file headers to ensure they follow a consistent format. -Optional parameters can used, these extra parameters needs to be added in the **Makefile**: -- `--fix`: Automatically fix all headers -- `--author`: Set a custom author name (default is `"Binary Birds"`) - -Fix all headers: -`fix-headers: - curl -s $(baseUrl)/check-swift-headers.sh | bash -s -- --fix -` -Fix all headers with custom author: -`fix-headers: - curl -s $(baseUrl)/run-openapi-docker.sh | bash -s -- --fix --author John -` -Usage: `make headers` +**Makefile Command**: + +```sh +make docc-warnings +``` + +**Raw curl Command**: + +```sh +curl -s $(baseUrl)/check-docc-warnings.sh | bash +``` + +----- ### check-local-swift-dependencies.sh -This script checks for local Swift package dependencies in the repository. It scans **Package.swift** files for local dependencies defined using **.package(path:)** and reports any occurrences. -Usage: `make deps` - +**Purpose**: Checks for accidental local Swift package dependencies by scanning for **`.package(path:)`** usage in `Package.swift` files. + +**Makefile Command**: + +```sh +make deps +``` + +**Raw curl Command**: + +```sh +curl -s $(baseUrl)/check-local-swift-dependencies.sh | bash +``` + +----- + ### check-openapi-security.sh -This script runs a security analysis on the OpenAPI specification using OWASP ZAP. It runs the zap-api-scan.py script inside a Docker container to check for security vulnerabilities in the OpenAPI definition. -Usage: `make openapi-security` +**Purpose**: Runs a **security analysis** on the OpenAPI specification using **OWASP ZAP** inside a Docker container. + +**Makefile Command**: + +```sh +make openapi-security +``` + +**Raw curl Command**: + +```sh +curl -s $(baseUrl)/check-openapi-security.sh | bash +``` + +----- ### check-openapi-validation.sh -This script validates the OpenAPI specification for compliance with the OpenAPI standard. It uses the openapi-spec-validator tool inside a Docker container to perform the validation. -Usage: `make openapi-validation` +**Purpose**: Validates the `openapi.yaml` file for compliance with the OpenAPI standard using the `openapi-spec-validator` tool in a Docker container. + +**Makefile Command**: + +```sh +make openapi-validation +``` + +**Raw curl Command**: + +```sh +curl -s $(baseUrl)/check-openapi-validation.sh | bash +``` + +----- + +### check-swift-headers.sh + +**Purpose**: Checks and optionally fixes Swift source file headers to ensure they follow a consistent 5-line format. +**Configuration**: Respects the **`.swiftheaderignore`** file, which lists file paths, directories, or glob patterns to exclude from header validation. + +**Parameters**: + +* `--fix`: Automatically inserts or updates headers in-place. +* `--author `: Overrides the default author name (`"Binary Birds"`). + +**Makefile Command (Check)**: + +```sh +make headers +``` + +**Raw curl Command (Check)**: + +```sh +curl -s $(baseUrl)/check-swift-headers.sh | bash +``` + +**Makefile Command (Fix)**: + +```sh +make fix-headers +``` + +**Raw curl Command (Fix with Author Example)**: + +```sh +curl -s $(baseUrl)/check-swift-headers.sh | bash -s -- --fix --author "John Doe" +``` + +----- ### check-unacceptable-language.sh -This script searches the codebase for unacceptable language patterns. It uses a predefined list of terms and searches the codebase for any matches, reporting them if found. An optional **.unacceptablelanguageignore** file can be added to the repositoryโ€™s root, allowing certain files to be ignored during the search. -Usage: `make language` +**Purpose**: Searches the codebase for unacceptable language patterns (e.g., `master`, `blacklist`). +**Configuration**: Respects the **`.unacceptablelanguageignore`** file, which allows you to ignore specific files or directories when scanning for unacceptable language. + +**Makefile Command**: + +```sh +make language +``` + +**Raw curl Command**: + +```sh +curl -s $(baseUrl)/check-unacceptable-language.sh | bash +``` + +----- ### generate-contributors-list.sh -This script generates a list of contributors for the repository. It uses the git shortlog command to gather commit information and formats it into a CONTRIBUTORS.txt file. -Usage: `make contributors` +**Purpose**: Generates a list of contributors for the repository into a **`CONTRIBUTORS.txt`** file from Git commit history. + +**Makefile Command**: + +```sh +make contributors +``` + +**Raw curl Command**: + +```sh +curl -s $(baseUrl)/generate-contributors-list.sh | bash +``` + +----- + +### generate-docc.sh + +**Purpose**: Generates DocC documentation to the `docs/` directory. +**Configuration**: Looks for the **`.doccTargetList`** file, which, if present, explicitly defines the Swift targets for documentation generation. + +**Parameters**: + +* `--local`: Enables local mode (no hosting transforms). +* `--name `: Sets the hosting base path for GitHub Pages. + +**Makefile Command**: + +```sh +make docc-generate +``` + +**Raw curl Command (GitHub Pages Example)**: + +```sh +curl -s $(baseUrl)/generate-docc.sh | bash -s -- --name MyRepoName +``` + +----- + +### install-swift-format.sh + +**Purpose**: Installs the **Swift Format** tool binary. + +**Makefile Command**: + +```sh +make install-format +``` + +**Raw curl Command**: + +```sh +curl -s $(baseUrl)/install-swift-format.sh | bash +``` + +----- ### install-swift-openapi-generator.sh -This script installs the Swift OpenAPI generator tool, the version can be optionally defined using the `-v` parameter. If no version is specified as a parameter, the latest version will be installed. -Example to add the extra parameter in the **Makefile**: -`install-openapi: - curl -s $(baseUrl)/install-swift-openapi-generator.sh | bash -s -- -v 1.2.2 -` +**Purpose**: Installs the **Swift OpenAPI Generator** tool. + +**Parameters**: + +* `-v `: Specifies the version to install. + +**Makefile Command**: + +```sh +make install-openapi +``` + +**Raw curl Command (Version Example)**: + +```sh +curl -s $(baseUrl)/install-swift-openapi-generator.sh | bash -s -- -v 1.2.2 +``` + +----- -Usage: `make install-openapi` - ### run-clean.sh -This script cleans up build artifacts and other temporary files from the repository. -Usage: `make run-clean` +**Purpose**: Cleans up build artifacts and other temporary files (e.g., `.build`, `.swiftpm`). + +**Makefile Command**: + +```sh +make run-clean +``` + +**Raw curl Command**: + +```sh +curl -s $(baseUrl)/run-clean.sh | bash +``` + +----- + +### run-docc-docker.sh + +**Purpose**: Serves the generated DocC documentation using a Docker container running Nginx. + +**Parameters**: + +* `-n `: Adds a custom identifier for the container. +* `-p `: Adds a custom port mapping (default: `8000:80`). + +**Makefile Command**: + +```sh +make run-docc +``` + +**Raw curl Command (Custom Port Example)**: + +```sh +curl -s $(baseUrl)/run-docc-docker.sh | bash -s -- -p 8800:80 +``` + +----- ### run-openapi-docker.sh -This script serves the OpenAPI documentation using an Nginx server. This try to run inside a Docker container. Optional parameters can used, these extra parameters needs to be added in the **Makefile**: -- `-n` : add a custom identifier for the container, the default is `openapi-server` -- `-p` : add a custom port to bind it to the container, the default is `8888:80` +**Purpose**: Serves the OpenAPI documentation using a Docker container running Nginx. + +**Parameters**: + +* `-n `: Adds a custom identifier for the container. +* `-p `: Adds a custom port mapping (default: `8888:80`). +**Makefile Command**: -Example to add a different name: -`run-openapi: - curl -s $(baseUrl)/run-openapi-docker.sh | bash -s -- -n new-name -` +```sh +make run-openapi +``` -Example to add a different port: -`run-openapi: - curl -s $(baseUrl)/run-openapi-docker.sh | bash -s -- -p 8800:80 -` +**Raw curl Command (Custom Name Example)**: -Usage: `make run-openapi` +```sh +curl -s $(baseUrl)/run-openapi-docker.sh | bash -s -- -n new-name +``` + +----- ### run-swift-format.sh -This script checks/formats Swift code using the swift-format tool. It runs the tool on all Swift files in the repository, optionally fixing issues if the --fix argument is provided. -The script attempts to read the **.swift-format** configuration file for format rules and ignores files listed in **.swiftformatignore**, if present. If any file is missing, it will download it to the repository, which can then be customized. -Usage: `make lint` for run lint or `make format` for run format +**Purpose**: Checks/formats Swift code using the `swift-format` tool. If configuration is missing, it downloads defaults. +**Configuration**: Uses the **`.swift-format`** file for format rules and the **`.swiftformatignore`** file to exclude files/directories from the process. + +**Parameters**: + +* `--fix`: Automatically applies formatting instead of checking. + +**Makefile Command (Check)**: + +```sh +make lint +``` + +**Raw curl Command (Fix)**: + +```sh +curl -s $(baseUrl)/run-swift-format.sh | bash -s -- --fix +``` From 4f81923da93e6df4960946f29d6a88a204c5c1a0 Mon Sep 17 00:00:00 2001 From: GErP83 Date: Thu, 11 Dec 2025 12:25:13 +0100 Subject: [PATCH 26/30] add new workflow options --- .github/workflows/extra_soundness.yml | 19 +++++++++++++++++++ LICENSE | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/extra_soundness.yml b/.github/workflows/extra_soundness.yml index 0485bfb..d74b014 100644 --- a/.github/workflows/extra_soundness.yml +++ b/.github/workflows/extra_soundness.yml @@ -7,6 +7,10 @@ on: type: boolean description: "Boolean to enable the local swift dependencies check job. Defaults to false." default: false + headers_check_enabled: + type: boolean + description: "Checks Swift source file headers to ensure they follow the correct format. Defaults to false." + default: false run_tests_with_cache_enabled: type: boolean description: "Boolean to enable run tests with .build cache." @@ -37,6 +41,21 @@ jobs: - name: Run local swift dependencies check run: curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/main/scripts/check-local-swift-dependencies.sh | bash + + swift_headers_check: + name: Checks Swift source file headers + if: ${{ inputs.headers_check_enabled }} + runs-on: ubuntu-latest + timeout-minutes: 1 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Run swift headers check + run: curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/main/scripts/check-swift-headers.sh | bash + + cache-and-test: name: Run tests with cache env: diff --git a/LICENSE b/LICENSE index 45f679e..2bf8293 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ -MIT License +# MIT License -Copyright (c) 2024 Binary Birds Ltd. +Copyright (c) 2025 Binary Birds Ltd. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation From 6c16b91812e594e23e2d5daf719a830bedb702c1 Mon Sep 17 00:00:00 2001 From: GErP83 Date: Thu, 11 Dec 2025 13:09:25 +0100 Subject: [PATCH 27/30] Update check-swift-headers.sh --- scripts/check-swift-headers.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/check-swift-headers.sh b/scripts/check-swift-headers.sh index eee5448..1151822 100755 --- a/scripts/check-swift-headers.sh +++ b/scripts/check-swift-headers.sh @@ -170,6 +170,9 @@ else log "No exclusion file found, using default exclusions" EXCLUDE_PATTERNS+=(":(exclude).*") EXCLUDE_PATTERNS+=(":(exclude)*.txt") + EXCLUDE_PATTERNS+=(":(exclude)*.png") + EXCLUDE_PATTERNS+=(":(exclude)*.jpeg") + EXCLUDE_PATTERNS+=(":(exclude)*.jpg") EXCLUDE_PATTERNS+=(":(exclude)*.sh") EXCLUDE_PATTERNS+=(":(exclude)*.html") EXCLUDE_PATTERNS+=(":(exclude)*.yaml") From 56b2484b9a226d21bb333aee7a5131f9f6711119 Mon Sep 17 00:00:00 2001 From: GErP83 Date: Thu, 11 Dec 2025 13:11:58 +0100 Subject: [PATCH 28/30] Update extra_soundness.yml --- .github/workflows/extra_soundness.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/extra_soundness.yml b/.github/workflows/extra_soundness.yml index d74b014..1f9865e 100644 --- a/.github/workflows/extra_soundness.yml +++ b/.github/workflows/extra_soundness.yml @@ -39,7 +39,7 @@ jobs: with: persist-credentials: false - name: Run local swift dependencies check - run: curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/main/scripts/check-local-swift-dependencies.sh | bash + run: curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/feature/docc/scripts/check-local-swift-dependencies.sh | bash swift_headers_check: @@ -53,7 +53,7 @@ jobs: with: persist-credentials: false - name: Run swift headers check - run: curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/main/scripts/check-swift-headers.sh | bash + run: curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/feature/docc/scripts/check-swift-headers.sh | bash cache-and-test: From 2388db998a09b4b3d6a6a94bbc8f613251b18843 Mon Sep 17 00:00:00 2001 From: GErP83 Date: Thu, 11 Dec 2025 21:27:16 +0100 Subject: [PATCH 29/30] add sample tag action --- .github/workflows/extra_soundness.yml | 2 +- README.md | 2 +- sample_actions.yml | 6 ++++-- sample_tag_action.yml | 18 ++++++++++++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 sample_tag_action.yml diff --git a/.github/workflows/extra_soundness.yml b/.github/workflows/extra_soundness.yml index 1f9865e..598fcd4 100644 --- a/.github/workflows/extra_soundness.yml +++ b/.github/workflows/extra_soundness.yml @@ -18,7 +18,7 @@ on: run_tests_swift_versions: type: string description: "List of Swift versions to test with." - default: '["6.0", "6.1"]' + default: '["6.1", "6.2"]' secrets: SSH_PRIVATE_KEY: required: false diff --git a/README.md b/README.md index 95ae0a6..6283eee 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ jobs: run_tests_swift_versions: '["6.0","6.1"]' ``` -### 2\. DocC Deploy Workflow (`docc_deploy.yml`) +### 2. DocC Deploy Workflow (`docc_deploy.yml`) This workflow handles the generation and deployment of DocC documentation: diff --git a/sample_actions.yml b/sample_actions.yml index 778390b..df114bc 100644 --- a/sample_actions.yml +++ b/sample_actions.yml @@ -15,8 +15,8 @@ jobs: format_check_enabled : true broken_symlink_check_enabled : true unacceptable_language_check_enabled : true + docs_check_enabled : true api_breakage_check_enabled : false - docs_check_enabled : false license_header_check_enabled : false shell_check_enabled : false yamllint_check_enabled : false @@ -27,4 +27,6 @@ jobs: uses: BinaryBirds/github-workflows/.github/workflows/extra_soundness.yml@main with: local_swift_dependencies_check_enabled : true - run_tests_with_cache_enabled : true \ No newline at end of file + run_tests_with_cache_enabled : true + headers_check_enabled : true + run_tests_swift_versions: '["6.1","6.2"]' diff --git a/sample_tag_action.yml b/sample_tag_action.yml new file mode 100644 index 0000000..9dbdd18 --- /dev/null +++ b/sample_tag_action.yml @@ -0,0 +1,18 @@ +name: Create DocC and Deploy it + +on: + push: + tags: + - 'v*' + - '[0-9]*' + +jobs: + + create-docc-and-deploy: + uses: BinaryBirds/github-workflows/.github/workflows/docc_deploy.yml@main + permissions: + contents: read + pages: write + id-token: write + with: + docc_swift_version: "6.1" \ No newline at end of file From e285776dd306404d07445f815d728bb89090d897 Mon Sep 17 00:00:00 2001 From: GErP83 Date: Tue, 16 Dec 2025 15:15:43 +0100 Subject: [PATCH 30/30] add docc local command --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 210b6ea..ca40c17 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,9 @@ symlinks: docc-generate: curl -s $(baseUrl)/generate-docc.sh | bash +docc-local: + curl -s $(baseUrl)/generate-docc.sh | bash -s -- --local + docc-warnings: curl -s $(baseUrl)/check-docc-warnings.sh | bash @@ -60,4 +63,4 @@ lint: format: curl -s $(baseUrl)/run-swift-format.sh | bash -s -- --fix -check: symlinks language deps lint \ No newline at end of file +check: symlinks language deps lint docc-warnings headers