From b4e96ac8cadef1a697d16bcdb43c1a3e1c8b8eff Mon Sep 17 00:00:00 2001 From: Ralf Lang Date: Tue, 3 Mar 2026 19:19:45 +0100 Subject: [PATCH 1/8] feat(ci): add GitHub Actions CI workflow with components v1.0.0-alpha27 Deploy horde-components CI system for automated testing. Features: - GitHub Actions workflow with multi-version PHP testing (8.2-8.5) - Tool caching (PHPUnit, PHPStan, PHP-CS-Fixer) - Test result artifact upload - Bootstrap script for CI setup - Organization variable support (COMPONENTS_PHAR_URL) - Manual workflow dispatch with PHP version selection Generated with: horde-components v1.0.0-alpha27 ci init Template version: 1.0.0 Related to Phase 3 deployment of horde-components CI infrastructure. --- .github/workflows/ci.yml | 102 ++++++++++++++++---------------- bin/ci-bootstrap.sh | 124 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+), 49 deletions(-) create mode 100755 bin/ci-bootstrap.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75013d9..a1a931c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,58 +1,62 @@ -# This is a basic workflow to help you get started with Actions - name: CI -# Controls when the action will run. +# Generated by: horde-components 1.0.0-alpha27 +# Template version: 1.0.0 +# Generated: 2026-03-03 18:18:42 UTC +# +# DO NOT EDIT - Regenerate with: horde-components ci init + on: - # Triggers the workflow on push or pull request events but only for the master branch push: - branches: - - master - - maintaina-composerfixed - - FRAMEWORK_6_0 + branches: [ FRAMEWORK_6_0 ] pull_request: - branches: - - master - - maintaina-composerfixed - - FRAMEWORK_6_0 - - - # Allows you to run this workflow manually from the Actions tab + branches: [ FRAMEWORK_6_0 ] workflow_dispatch: + inputs: + php_versions: + description: 'PHP versions to test (comma-separated, e.g., 8.2,8.4)' + required: false + default: 'all' -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - run: - runs-on: ${{ matrix.operating-system }} - strategy: - matrix: - operating-system: ['ubuntu-20.04'] - php-versions: ['7.4', '8.0', 'latest'] - phpunit-versions: ['latest', '9.5'] + test: + runs-on: ubuntu-24.04 + steps: - - name: Setup github ssh key - run: mkdir -p ~/.ssh/ && ssh-keyscan -t rsa github.com > ~/.ssh/known_hosts - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - extensions: bcmath, ctype, curl, dom, gd, gettext, iconv, imagick, json, ldap, mbstring, mysql, opcache, openssl, pcntl, pdo, posix, redis, soap, sockets, sqlite, tokenizer, xmlwriter - ini-values: post_max_size=512M, max_execution_time=360 - coverage: xdebug - tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }}, composer:v2 - - name: Setup Github Token as composer credential - run: composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} - - name: Install horde/test dependency and other dependencies - run: | - COMPOSER_ROOT_VERSION=dev-FRAMEWORK_6_0 composer config minimum-stability dev - COMPOSER_ROOT_VERSION=dev-FRAMEWORK_6_0 composer install - COMPOSER_ROOT_VERSION=dev-FRAMEWORK_6_0 composer require --dev horde/test dev-FRAMEWORK_6_0 - - name: Redo install due to many fails - run: | - COMPOSER_ROOT_VERSION=dev-FRAMEWORK_6_0 composer install - COMPOSER_ROOT_VERSION=dev-FRAMEWORK_6_0 composer require --dev horde/test dev-FRAMEWORK_6_0 - - name: run phpunit - run: phpunit --bootstrap test/bootstrap.php + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP 8.4 (for bootstrap) + uses: shivammathur/setup-php@v2 + with: + php-version: '8.4' + extensions: json, mbstring, curl + coverage: none + + - name: Cache QC tools (PHPUnit, PHPStan, PHP-CS-Fixer) + uses: actions/cache@v4 + with: + path: /tmp/horde-ci/tools + key: ci-tools-${{ hashFiles('.horde.yml') }} + restore-keys: | + ci-tools- + + - name: CI Setup + run: bash bin/ci-bootstrap.sh + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COMPONENTS_PHAR_URL: ${{ vars.COMPONENTS_PHAR_URL || 'https://github.com/horde/components/releases/latest/download/horde-components.phar' }} + + - name: CI Run + run: | + php /tmp/horde-ci/bin/horde-components.phar ci run \ + --work-dir=/tmp/horde-ci + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v4 + with: + name: ci-results-${{ github.run_number }} + path: | + /tmp/horde-ci/lanes/*/build/*.json + retention-days: 30 diff --git a/bin/ci-bootstrap.sh b/bin/ci-bootstrap.sh new file mode 100755 index 0000000..21b1e53 --- /dev/null +++ b/bin/ci-bootstrap.sh @@ -0,0 +1,124 @@ +#!/bin/bash +# Horde CI Bootstrap Script (GitHub Actions) +# Generated by: horde-components 1.0.0-alpha27 +# Template version: 1.0.0 +# Generated: 2026-03-03 18:18:42 UTC +# +# DO NOT EDIT - Regenerate with: horde-components ci init + +set -e +set -o pipefail + +# Configuration +BOOTSTRAP_PHP_VERSION="8.4" +COMPONENTS_PHAR_URL="https://github.com/horde/components/releases/latest/download/horde-components.phar" +COMPONENT_NAME="Http" +WORK_DIR="/tmp/horde-ci" + +# Colors for output (disabled in CI) +RED='' +GREEN='' +YELLOW='' +NC='' + +# Logging functions +log_info() { + if [ -n "$GITHUB_ACTIONS" ]; then + echo "::notice::$*" + else + echo "[INFO] $*" + fi +} + +log_warn() { + if [ -n "$GITHUB_ACTIONS" ]; then + echo "::warning::$*" + else + echo "[WARN] $*" + fi +} + +log_error() { + if [ -n "$GITHUB_ACTIONS" ]; then + echo "::error::$*" + else + echo "[ERROR] $*" + fi >&2 +} + +# Stage 1: Validate environment +log_info "Horde CI Bootstrap - Stage 1 (GitHub Actions mode)" +log_info "Component: $COMPONENT_NAME" +log_info "Bootstrap PHP: $BOOTSTRAP_PHP_VERSION" + +# Check we're in GitHub Actions +if [ -z "$GITHUB_ACTIONS" ]; then + log_error "This script is for GitHub Actions. Use bootstrap-local.sh for local development." + exit 1 +fi + +# Validate required environment variables +if [ -z "$GITHUB_REPOSITORY" ]; then + log_error "GITHUB_REPOSITORY not set" + exit 1 +fi + +if [ -z "$GITHUB_REF" ]; then + log_error "GITHUB_REF not set" + exit 1 +fi + +if [ -z "$GITHUB_TOKEN" ]; then + log_error "GITHUB_TOKEN not set" + exit 1 +fi + +# Stage 2: Verify PHP +if ! command -v php &> /dev/null; then + log_error "PHP not found. Ensure setup-php action runs before this script." + exit 1 +fi + +PHP_VERSION=$(php -r 'echo PHP_VERSION;') +log_info "PHP version: $PHP_VERSION" + +if [ "${PHP_VERSION:0:3}" != "$BOOTSTRAP_PHP_VERSION" ]; then + log_warn "Expected PHP $BOOTSTRAP_PHP_VERSION, got $PHP_VERSION (proceeding anyway)" +fi + +# Stage 3: Download horde-components.phar +log_info "Downloading horde-components from $COMPONENTS_PHAR_URL" + +mkdir -p "$WORK_DIR/bin" +COMPONENTS_PHAR="$WORK_DIR/bin/horde-components.phar" + +if ! curl -sS -L -o "$COMPONENTS_PHAR" "$COMPONENTS_PHAR_URL"; then + log_error "Failed to download horde-components.phar" + exit 1 +fi + +# Validate it's a valid phar +if ! php "$COMPONENTS_PHAR" --version &> /dev/null; then + log_error "Downloaded phar is not valid or not executable" + exit 1 +fi + +log_info "horde-components.phar downloaded successfully" +php "$COMPONENTS_PHAR" --version + +# Stage 4: Handoff to PHP (horde-components ci setup) +log_info "Bootstrap complete. Handing off to horde-components ci setup" + +php "$COMPONENTS_PHAR" ci setup \ + --mode=github \ + --work-dir="$WORK_DIR" \ + --component="$COMPONENT_NAME" + +EXIT_CODE=$? + +if [ $EXIT_CODE -eq 0 ]; then + log_info "CI setup complete. Workspace: $WORK_DIR" +else + log_error "CI setup failed with exit code $EXIT_CODE" + exit $EXIT_CODE +fi From 577737a91243c0e401a49f79bdfb407c656f3e74 Mon Sep 17 00:00:00 2001 From: Ralf Lang Date: Tue, 3 Mar 2026 19:23:25 +0100 Subject: [PATCH 2/8] fix(ci): regenerate bootstrap with environment variable support Regenerate ci-bootstrap.sh to use fixed template that respects COMPONENTS_PHAR_URL environment variable from workflow. The bootstrap script will now prefer the environment variable (set from org variable in workflow) over the hardcoded default. --- bin/ci-bootstrap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/ci-bootstrap.sh b/bin/ci-bootstrap.sh index 21b1e53..3a606c5 100755 --- a/bin/ci-bootstrap.sh +++ b/bin/ci-bootstrap.sh @@ -2,7 +2,7 @@ # Horde CI Bootstrap Script (GitHub Actions) # Generated by: horde-components 1.0.0-alpha27 # Template version: 1.0.0 -# Generated: 2026-03-03 18:18:42 UTC +# Generated: 2026-03-03 18:23:14 UTC # # DO NOT EDIT - Regenerate with: horde-components ci init @@ -11,7 +11,7 @@ set -o pipefail # Configuration BOOTSTRAP_PHP_VERSION="8.4" -COMPONENTS_PHAR_URL="https://github.com/horde/components/releases/latest/download/horde-components.phar" +COMPONENTS_PHAR_URL="${COMPONENTS_PHAR_URL:-https://github.com/horde/components/releases/latest/download/horde-components.phar}" COMPONENT_NAME="Http" WORK_DIR="/tmp/horde-ci" From 102025bafbdc1690c3acf12f764c2df4e9d6d2c8 Mon Sep 17 00:00:00 2001 From: Ralf Lang Date: Tue, 3 Mar 2026 19:25:00 +0100 Subject: [PATCH 3/8] fix(ci): use 'help' instead of '--version' for PHAR validation --- bin/ci-bootstrap.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/ci-bootstrap.sh b/bin/ci-bootstrap.sh index 3a606c5..5ce40cc 100755 --- a/bin/ci-bootstrap.sh +++ b/bin/ci-bootstrap.sh @@ -2,7 +2,7 @@ # Horde CI Bootstrap Script (GitHub Actions) # Generated by: horde-components 1.0.0-alpha27 # Template version: 1.0.0 -# Generated: 2026-03-03 18:23:14 UTC +# Generated: 2026-03-03 18:24:55 UTC # # DO NOT EDIT - Regenerate with: horde-components ci init @@ -98,13 +98,12 @@ if ! curl -sS -L -o "$COMPONENTS_PHAR" "$COMPONENTS_PHAR_URL"; then fi # Validate it's a valid phar -if ! php "$COMPONENTS_PHAR" --version &> /dev/null; then +if ! php "$COMPONENTS_PHAR" help &> /dev/null; then log_error "Downloaded phar is not valid or not executable" exit 1 fi log_info "horde-components.phar downloaded successfully" -php "$COMPONENTS_PHAR" --version # Stage 4: Handoff to PHP (horde-components ci setup) log_info "Bootstrap complete. Handing off to horde-components ci setup" From 762f41fc4f9e789787715a682325c4865cd4777f Mon Sep 17 00:00:00 2001 From: Ralf Lang Date: Tue, 3 Mar 2026 19:26:02 +0100 Subject: [PATCH 4/8] fix(ci): use --ci-mode option for ci setup command --- bin/ci-bootstrap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/ci-bootstrap.sh b/bin/ci-bootstrap.sh index 5ce40cc..ec55165 100755 --- a/bin/ci-bootstrap.sh +++ b/bin/ci-bootstrap.sh @@ -2,7 +2,7 @@ # Horde CI Bootstrap Script (GitHub Actions) # Generated by: horde-components 1.0.0-alpha27 # Template version: 1.0.0 -# Generated: 2026-03-03 18:24:55 UTC +# Generated: 2026-03-03 18:26:02 UTC # # DO NOT EDIT - Regenerate with: horde-components ci init @@ -109,7 +109,7 @@ log_info "horde-components.phar downloaded successfully" log_info "Bootstrap complete. Handing off to horde-components ci setup" php "$COMPONENTS_PHAR" ci setup \ - --mode=github \ + --ci-mode=github \ --work-dir="$WORK_DIR" \ --component="$COMPONENT_NAME" From a9835f8855c49ca8e7197fb5dc2fe5418c0e2bbf Mon Sep 17 00:00:00 2001 From: Ralf Lang Date: Tue, 3 Mar 2026 19:34:01 +0100 Subject: [PATCH 5/8] feat(ci): regenerate with components v1.0.0-alpha28 (all fixes) --- .github/workflows/ci.yml | 4 ++-- bin/ci-bootstrap.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1a931c..50d9f6f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,8 @@ name: CI -# Generated by: horde-components 1.0.0-alpha27 +# Generated by: horde-components 1.0.0-alpha28 # Template version: 1.0.0 -# Generated: 2026-03-03 18:18:42 UTC +# Generated: 2026-03-03 18:33:34 UTC # # DO NOT EDIT - Regenerate with: horde-components ci init diff --git a/bin/ci-bootstrap.sh b/bin/ci-bootstrap.sh index ec55165..e12b46f 100755 --- a/bin/ci-bootstrap.sh +++ b/bin/ci-bootstrap.sh @@ -1,8 +1,8 @@ #!/bin/bash # Horde CI Bootstrap Script (GitHub Actions) -# Generated by: horde-components 1.0.0-alpha27 +# Generated by: horde-components 1.0.0-alpha28 # Template version: 1.0.0 -# Generated: 2026-03-03 18:26:02 UTC +# Generated: 2026-03-03 18:33:34 UTC # # DO NOT EDIT - Regenerate with: horde-components ci init From 9b913a7ed448c34cc6e0ab69f595c6323a472033 Mon Sep 17 00:00:00 2001 From: Ralf Lang Date: Tue, 3 Mar 2026 19:36:23 +0100 Subject: [PATCH 6/8] chore: trigger CI with fixed org variable From 32163e61c8b853dce889a36a068d974db40acb70 Mon Sep 17 00:00:00 2001 From: Ralf Lang Date: Tue, 3 Mar 2026 19:46:17 +0100 Subject: [PATCH 7/8] feat(ci): regenerate with components v1.0.0-alpha29 (root check fix) --- .github/workflows/ci.yml | 4 ++-- bin/ci-bootstrap.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50d9f6f..979780b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,8 @@ name: CI -# Generated by: horde-components 1.0.0-alpha28 +# Generated by: horde-components 1.0.0-alpha29 # Template version: 1.0.0 -# Generated: 2026-03-03 18:33:34 UTC +# Generated: 2026-03-03 18:45:58 UTC # # DO NOT EDIT - Regenerate with: horde-components ci init diff --git a/bin/ci-bootstrap.sh b/bin/ci-bootstrap.sh index e12b46f..dafdf5f 100755 --- a/bin/ci-bootstrap.sh +++ b/bin/ci-bootstrap.sh @@ -1,8 +1,8 @@ #!/bin/bash # Horde CI Bootstrap Script (GitHub Actions) -# Generated by: horde-components 1.0.0-alpha28 +# Generated by: horde-components 1.0.0-alpha29 # Template version: 1.0.0 -# Generated: 2026-03-03 18:33:34 UTC +# Generated: 2026-03-03 18:45:58 UTC # # DO NOT EDIT - Regenerate with: horde-components ci init From da9bd9e25ba4eba232b3dce6c6110632eaa0a63b Mon Sep 17 00:00:00 2001 From: Ralf Lang Date: Tue, 3 Mar 2026 19:48:53 +0100 Subject: [PATCH 8/8] feat(ci): regenerate with components v1.0.0-alpha30 (sudo helper bundled) --- .github/workflows/ci.yml | 4 ++-- bin/ci-bootstrap.sh | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 979780b..1550ddb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,8 @@ name: CI -# Generated by: horde-components 1.0.0-alpha29 +# Generated by: horde-components 1.0.0-alpha30 # Template version: 1.0.0 -# Generated: 2026-03-03 18:45:58 UTC +# Generated: 2026-03-03 18:48:30 UTC # # DO NOT EDIT - Regenerate with: horde-components ci init diff --git a/bin/ci-bootstrap.sh b/bin/ci-bootstrap.sh index dafdf5f..62d08c6 100755 --- a/bin/ci-bootstrap.sh +++ b/bin/ci-bootstrap.sh @@ -1,8 +1,8 @@ #!/bin/bash # Horde CI Bootstrap Script (GitHub Actions) -# Generated by: horde-components 1.0.0-alpha29 +# Generated by: horde-components 1.0.0-alpha30 # Template version: 1.0.0 -# Generated: 2026-03-03 18:45:58 UTC +# Generated: 2026-03-03 18:48:30 UTC # # DO NOT EDIT - Regenerate with: horde-components ci init @@ -105,7 +105,21 @@ fi log_info "horde-components.phar downloaded successfully" -# Stage 4: Handoff to PHP (horde-components ci setup) +# Stage 4: Install sudo helper script +log_info "Installing sudo helper script" + +# Extract and install the helper script from PHAR +php "$COMPONENTS_PHAR" -r "copy('phar://' . '$COMPONENTS_PHAR' . '/data/ci/sudo-helper.sh', '$WORK_DIR/sudo-helper.sh');" 2>/dev/null || \ + log_warn "Could not extract sudo helper from PHAR (older version?)" + +if [ -f "$WORK_DIR/sudo-helper.sh" ]; then + sudo install -m 755 "$WORK_DIR/sudo-helper.sh" /usr/local/bin/horde-ci-sudo-helper + log_info "Sudo helper installed successfully" +else + log_warn "Sudo helper not found, will try to proceed without it" +fi + +# Stage 5: Handoff to PHP (horde-components ci setup) log_info "Bootstrap complete. Handing off to horde-components ci setup" php "$COMPONENTS_PHAR" ci setup \