From 683a3e86511d153f8f0b2e8ea2f23aaf05c61ad3 Mon Sep 17 00:00:00 2001 From: Luis Amorim Date: Thu, 24 Sep 2026 00:28:17 +0000 Subject: [PATCH 01/15] ci(behat): shard integration features across matrix jobs Split each Behat DB workflow into four feature-path shards so every job gets a fresh PHP built-in server with a shorter suite lifetime, reducing cURL 52 / server-death cascade risk under load. Signed-off-by: Luis Amorim Co-authored-by: Luis Amorim --- .github/workflows/behat-mariadb.yml | 17 ++++++++++++++--- .github/workflows/behat-mysql.yml | 17 ++++++++++++++--- .github/workflows/behat-pgsql.yml | 17 ++++++++++++++--- .github/workflows/behat-sqlite.yml | 17 ++++++++++++++--- 4 files changed, 56 insertions(+), 12 deletions(-) diff --git a/.github/workflows/behat-mariadb.yml b/.github/workflows/behat-mariadb.yml index 970ced3a0a..365a144842 100644 --- a/.github/workflows/behat-mariadb.yml +++ b/.github/workflows/behat-mariadb.yml @@ -57,12 +57,22 @@ jobs: if: needs.changes.outputs.src != 'false' strategy: + fail-fast: false matrix: php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} mariadb-versions: ['10.6', '10.11'] - - name: MariaDB ${{ matrix.mariadb-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} + shard: + - name: account-admin + paths: features/account features/admin features/bootstrap features/build + - name: file-notify + paths: features/file features/identify-account features/notification + - name: page-policies + paths: features/page features/policies features/settings + - name: sign + paths: features/sign + + name: MariaDB ${{ matrix.mariadb-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} (${{ matrix.shard.name }}) services: mariadb: @@ -169,7 +179,8 @@ jobs: run: | export BEHAT_RUN_AS=runner export BEHAT_VERBOSE="$RUNNER_DEBUG" - vendor/bin/behat -f junit -f pretty --colors + # shellcheck disable=SC2086 + vendor/bin/behat -f junit -f pretty --colors ${{ matrix.shard.paths }} - name: Print logs if: always() diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml index 4e22bb4ff5..94d902a9be 100644 --- a/.github/workflows/behat-mysql.yml +++ b/.github/workflows/behat-mysql.yml @@ -61,12 +61,22 @@ jobs: if: needs.changes.outputs.src != 'false' strategy: + fail-fast: false matrix: php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} mysql-versions: ['8.1'] - - name: MySQL ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} + shard: + - name: account-admin + paths: features/account features/admin features/bootstrap features/build + - name: file-notify + paths: features/file features/identify-account features/notification + - name: page-policies + paths: features/page features/policies features/settings + - name: sign + paths: features/sign + + name: MySQL ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} (${{ matrix.shard.name }}) services: mysql: @@ -181,7 +191,8 @@ jobs: run: | export BEHAT_RUN_AS=runner export BEHAT_VERBOSE="$RUNNER_DEBUG" - vendor/bin/behat -f junit -f pretty --colors + # shellcheck disable=SC2086 + vendor/bin/behat -f junit -f pretty --colors ${{ matrix.shard.paths }} - name: Print logs if: always() diff --git a/.github/workflows/behat-pgsql.yml b/.github/workflows/behat-pgsql.yml index abced51068..cc24ea9c2a 100644 --- a/.github/workflows/behat-pgsql.yml +++ b/.github/workflows/behat-pgsql.yml @@ -59,11 +59,21 @@ jobs: if: needs.changes.outputs.src != 'false' strategy: + fail-fast: false matrix: php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} - - name: PostgreSQL PHP ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} + shard: + - name: account-admin + paths: features/account features/admin features/bootstrap features/build + - name: file-notify + paths: features/file features/identify-account features/notification + - name: page-policies + paths: features/page features/policies features/settings + - name: sign + paths: features/sign + + name: PostgreSQL PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} (${{ matrix.shard.name }}) services: postgres: @@ -175,7 +185,8 @@ jobs: run: | export BEHAT_RUN_AS=runner export BEHAT_VERBOSE="$RUNNER_DEBUG" - vendor/bin/behat -f junit -f pretty --colors + # shellcheck disable=SC2086 + vendor/bin/behat -f junit -f pretty --colors ${{ matrix.shard.paths }} - name: Print logs if: always() diff --git a/.github/workflows/behat-sqlite.yml b/.github/workflows/behat-sqlite.yml index 3bf7c3aaff..ec2da70356 100644 --- a/.github/workflows/behat-sqlite.yml +++ b/.github/workflows/behat-sqlite.yml @@ -59,11 +59,21 @@ jobs: if: needs.changes.outputs.src != 'false' strategy: + fail-fast: false matrix: php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} - - name: SQLite PHP ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} + shard: + - name: account-admin + paths: features/account features/admin features/bootstrap features/build + - name: file-notify + paths: features/file features/identify-account features/notification + - name: page-policies + paths: features/page features/policies features/settings + - name: sign + paths: features/sign + + name: SQLite PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} (${{ matrix.shard.name }}) services: mailpit: @@ -166,7 +176,8 @@ jobs: run: | export BEHAT_RUN_AS=runner export BEHAT_VERBOSE="$RUNNER_DEBUG" - vendor/bin/behat -f junit -f pretty --colors + # shellcheck disable=SC2086 + vendor/bin/behat -f junit -f pretty --colors ${{ matrix.shard.paths }} - name: Print logs if: always() From b3c0b639c7dd07801150e1262d9abd949c39640a Mon Sep 17 00:00:00 2001 From: Luis Amorim Date: Thu, 24 Sep 2026 00:35:39 +0000 Subject: [PATCH 02/15] ci(behat): install poppler noninteractively for act apt without -y hangs under act waiting for [Y/n] confirmation. Signed-off-by: Luis Amorim Co-authored-by: Luis Amorim --- .github/workflows/behat-mariadb.yml | 2 +- .github/workflows/behat-mysql.yml | 2 +- .github/workflows/behat-pgsql.yml | 2 +- .github/workflows/behat-sqlite.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/behat-mariadb.yml b/.github/workflows/behat-mariadb.yml index 365a144842..1a5266e6fd 100644 --- a/.github/workflows/behat-mariadb.yml +++ b/.github/workflows/behat-mariadb.yml @@ -95,7 +95,7 @@ jobs: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - name: Install system dependencies - run: sudo apt update && sudo apt install poppler-utils + run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils - name: Checkout server uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml index 94d902a9be..715bc58047 100644 --- a/.github/workflows/behat-mysql.yml +++ b/.github/workflows/behat-mysql.yml @@ -99,7 +99,7 @@ jobs: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - name: Install system dependencies - run: sudo apt update && sudo apt install poppler-utils + run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils - name: Checkout server uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 diff --git a/.github/workflows/behat-pgsql.yml b/.github/workflows/behat-pgsql.yml index cc24ea9c2a..03acde8b97 100644 --- a/.github/workflows/behat-pgsql.yml +++ b/.github/workflows/behat-pgsql.yml @@ -98,7 +98,7 @@ jobs: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - name: Install system dependencies - run: sudo apt update && sudo apt install poppler-utils + run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils - name: Checkout server uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 diff --git a/.github/workflows/behat-sqlite.yml b/.github/workflows/behat-sqlite.yml index ec2da70356..1693b626b4 100644 --- a/.github/workflows/behat-sqlite.yml +++ b/.github/workflows/behat-sqlite.yml @@ -89,7 +89,7 @@ jobs: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - name: Install system dependencies - run: sudo apt update && sudo apt install poppler-utils + run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils - name: Checkout server uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 From c7fcf770b444da5a35dcbd02bd5a97d894968b33 Mon Sep 17 00:00:00 2001 From: Luis Amorim Date: Thu, 24 Sep 2026 00:36:51 +0000 Subject: [PATCH 03/15] ci(behat): pass root password to MariaDB/MySQL healthchecks mysqladmin ping without credentials logs Access denied for root (using password: NO) and can leave the service unhealthy under act. Signed-off-by: Luis Amorim Co-authored-by: Luis Amorim --- .github/workflows/behat-mariadb.yml | 2 +- .github/workflows/behat-mysql.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/behat-mariadb.yml b/.github/workflows/behat-mariadb.yml index 1a5266e6fd..7dc5731a4a 100644 --- a/.github/workflows/behat-mariadb.yml +++ b/.github/workflows/behat-mariadb.yml @@ -81,7 +81,7 @@ jobs: - 4444:3306/tcp env: MYSQL_ROOT_PASSWORD: rootpassword - options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5 + options: --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -prootpassword" --health-interval 5s --health-timeout 2s --health-retries 5 mailpit: image: axllent/mailpit ports: diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml index 715bc58047..afb109a85a 100644 --- a/.github/workflows/behat-mysql.yml +++ b/.github/workflows/behat-mysql.yml @@ -85,7 +85,7 @@ jobs: - 4444:3306/tcp env: MYSQL_ROOT_PASSWORD: rootpassword - options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 10 + options: --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -prootpassword" --health-interval 5s --health-timeout 2s --health-retries 10 mailpit: image: axllent/mailpit ports: From b1e7b151a3807600d366dd157fee11a9f113847f Mon Sep 17 00:00:00 2001 From: Luis Amorim Date: Thu, 24 Sep 2026 00:51:00 +0000 Subject: [PATCH 04/15] ci(behat): use ephemeral service ports for act matrix Fixed 4444/1025 host binds collide when act expands the shard matrix on one Docker host. Publish container ports only, resolve them via job.services on GHA, and use service DNS under ACT=true. Flatten shard so --matrix shard:sign selects a single cell. Signed-off-by: Cursor Agent Co-authored-by: Luis Amorim --- .github/workflows/behat-mariadb.yml | 54 ++++++++++++++++++++--------- .github/workflows/behat-mysql.yml | 54 ++++++++++++++++++++--------- .github/workflows/behat-pgsql.yml | 42 ++++++++++++++-------- .github/workflows/behat-sqlite.yml | 34 +++++++++++------- 4 files changed, 122 insertions(+), 62 deletions(-) diff --git a/.github/workflows/behat-mariadb.yml b/.github/workflows/behat-mariadb.yml index 7dc5731a4a..0ffee14400 100644 --- a/.github/workflows/behat-mariadb.yml +++ b/.github/workflows/behat-mariadb.yml @@ -62,31 +62,35 @@ jobs: php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} mariadb-versions: ['10.6', '10.11'] - shard: - - name: account-admin + # Flat shard key so `act --matrix shard:sign` can select a single cell. + shard: [account-admin, file-notify, page-policies, sign] + include: + - shard: account-admin paths: features/account features/admin features/bootstrap features/build - - name: file-notify + - shard: file-notify paths: features/file features/identify-account features/notification - - name: page-policies + - shard: page-policies paths: features/page features/policies features/settings - - name: sign + - shard: sign paths: features/sign - name: MariaDB ${{ matrix.mariadb-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} (${{ matrix.shard.name }}) + name: MariaDB ${{ matrix.mariadb-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} (${{ matrix.shard }}) services: mariadb: image: ghcr.io/nextcloud/continuous-integration-mariadb-${{ matrix.mariadb-versions }}:latest + # Publish only the container port so Docker picks a free host port. + # Fixed binds like 4444:3306 collide under act (shared Docker host + matrix). ports: - - 4444:3306/tcp + - 3306/tcp env: MYSQL_ROOT_PASSWORD: rootpassword options: --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -prootpassword" --health-interval 5s --health-timeout 2s --health-retries 5 mailpit: image: axllent/mailpit ports: - - 8025:8025/tcp - - 1025:1025/tcp + - 8025/tcp + - 1025/tcp steps: - name: Set app env @@ -127,9 +131,17 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Enable ONLY_FULL_GROUP_BY MariaDB option + env: + DB_PORT: ${{ job.services.mariadb.ports[3306] }} run: | - echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword - echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword + if [ "${ACT}" = "true" ]; then + DB_HOST=mariadb + DB_PORT=3306 + else + DB_HOST=127.0.0.1 + fi + echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h "$DB_HOST" -P "$DB_PORT" -u root -prootpassword + echo "SELECT @@sql_mode;" | mysql -h "$DB_HOST" -P "$DB_PORT" -u root -prootpassword - name: Set up dependencies working-directory: apps/${{ env.APP_NAME }} @@ -140,16 +152,24 @@ jobs: - name: Set up Nextcloud env: - DB_PORT: 4444 + DB_PORT: ${{ job.services.mariadb.ports[3306] }} + SMTP_PORT: ${{ job.services.mailpit.ports[1025] }} run: | - sudo echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts + if [ "${ACT}" = "true" ]; then + DB_HOST=mariadb + DB_PORT=3306 + SMTP_PORT=1025 + else + DB_HOST=127.0.0.1 + echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts + fi mkdir data ./occ maintenance:install \ --verbose \ --database=mysql \ --database-name=nextcloud \ - --database-host=127.0.0.1 \ - --database-port=$DB_PORT \ + --database-host="$DB_HOST" \ + --database-port="$DB_PORT" \ --database-user=root \ --database-pass=rootpassword \ --admin-user admin \ @@ -168,7 +188,7 @@ jobs: ./occ config:system:set allow_local_remote_servers --value true --type boolean ./occ config:system:set auth.bruteforce.protection.enabled --value false --type boolean ./occ config:system:set mail_smtphost --value mailpit - ./occ config:system:set mail_smtpport --value 1025 --type integer + ./occ config:system:set mail_smtpport --value "$SMTP_PORT" --type integer ./occ config:system:set ratelimit.protection.enabled --value false --type boolean ./occ config:app:set dav enableDefaultContact --value false --type boolean @@ -180,7 +200,7 @@ jobs: export BEHAT_RUN_AS=runner export BEHAT_VERBOSE="$RUNNER_DEBUG" # shellcheck disable=SC2086 - vendor/bin/behat -f junit -f pretty --colors ${{ matrix.shard.paths }} + vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} - name: Print logs if: always() diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml index afb109a85a..728f0a3f31 100644 --- a/.github/workflows/behat-mysql.yml +++ b/.github/workflows/behat-mysql.yml @@ -66,31 +66,35 @@ jobs: php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} mysql-versions: ['8.1'] - shard: - - name: account-admin + # Flat shard key so `act --matrix shard:sign` can select a single cell. + shard: [account-admin, file-notify, page-policies, sign] + include: + - shard: account-admin paths: features/account features/admin features/bootstrap features/build - - name: file-notify + - shard: file-notify paths: features/file features/identify-account features/notification - - name: page-policies + - shard: page-policies paths: features/page features/policies features/settings - - name: sign + - shard: sign paths: features/sign - name: MySQL ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} (${{ matrix.shard.name }}) + name: MySQL ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} (${{ matrix.shard }}) services: mysql: image: ghcr.io/nextcloud/continuous-integration-mysql-${{ matrix.mysql-versions }}:latest + # Publish only the container port so Docker picks a free host port. + # Fixed binds like 4444:3306 collide under act (shared Docker host + matrix). ports: - - 4444:3306/tcp + - 3306/tcp env: MYSQL_ROOT_PASSWORD: rootpassword options: --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -prootpassword" --health-interval 5s --health-timeout 2s --health-retries 10 mailpit: image: axllent/mailpit ports: - - 8025:8025/tcp - - 1025:1025/tcp + - 8025/tcp + - 1025/tcp steps: - name: Set app env @@ -131,9 +135,17 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Enable ONLY_FULL_GROUP_BY MySQL option + env: + DB_PORT: ${{ job.services.mysql.ports[3306] }} run: | - echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword - echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword + if [ "${ACT}" = "true" ]; then + DB_HOST=mysql + DB_PORT=3306 + else + DB_HOST=127.0.0.1 + fi + echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h "$DB_HOST" -P "$DB_PORT" -u root -prootpassword + echo "SELECT @@sql_mode;" | mysql -h "$DB_HOST" -P "$DB_PORT" -u root -prootpassword - name: Check composer file existence id: check_composer @@ -152,16 +164,24 @@ jobs: - name: Set up Nextcloud env: - DB_PORT: 4444 + DB_PORT: ${{ job.services.mysql.ports[3306] }} + SMTP_PORT: ${{ job.services.mailpit.ports[1025] }} run: | - sudo echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts + if [ "${ACT}" = "true" ]; then + DB_HOST=mysql + DB_PORT=3306 + SMTP_PORT=1025 + else + DB_HOST=127.0.0.1 + echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts + fi mkdir data ./occ maintenance:install \ --verbose \ --database=mysql \ --database-name=nextcloud \ - --database-host=127.0.0.1 \ - --database-port=$DB_PORT \ + --database-host="$DB_HOST" \ + --database-port="$DB_PORT" \ --database-user=root \ --database-pass=rootpassword \ --admin-user admin \ @@ -180,7 +200,7 @@ jobs: ./occ config:system:set allow_local_remote_servers --value true --type boolean ./occ config:system:set auth.bruteforce.protection.enabled --value false --type boolean ./occ config:system:set mail_smtphost --value mailpit - ./occ config:system:set mail_smtpport --value 1025 --type integer + ./occ config:system:set mail_smtpport --value "$SMTP_PORT" --type integer ./occ config:system:set ratelimit.protection.enabled --value false --type boolean ./occ config:app:set dav enableDefaultContact --value false --type boolean @@ -192,7 +212,7 @@ jobs: export BEHAT_RUN_AS=runner export BEHAT_VERBOSE="$RUNNER_DEBUG" # shellcheck disable=SC2086 - vendor/bin/behat -f junit -f pretty --colors ${{ matrix.shard.paths }} + vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} - name: Print logs if: always() diff --git a/.github/workflows/behat-pgsql.yml b/.github/workflows/behat-pgsql.yml index 03acde8b97..c2b90bb30e 100644 --- a/.github/workflows/behat-pgsql.yml +++ b/.github/workflows/behat-pgsql.yml @@ -63,23 +63,27 @@ jobs: matrix: php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} - shard: - - name: account-admin + # Flat shard key so `act --matrix shard:sign` can select a single cell. + shard: [account-admin, file-notify, page-policies, sign] + include: + - shard: account-admin paths: features/account features/admin features/bootstrap features/build - - name: file-notify + - shard: file-notify paths: features/file features/identify-account features/notification - - name: page-policies + - shard: page-policies paths: features/page features/policies features/settings - - name: sign + - shard: sign paths: features/sign - name: PostgreSQL PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} (${{ matrix.shard.name }}) + name: PostgreSQL PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} (${{ matrix.shard }}) services: postgres: image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest + # Publish only the container port so Docker picks a free host port. + # Fixed binds like 4444:5432 collide under act (shared Docker host + matrix). ports: - - 4444:5432/tcp + - 5432/tcp env: POSTGRES_USER: root POSTGRES_PASSWORD: rootpassword @@ -88,8 +92,8 @@ jobs: mailpit: image: axllent/mailpit ports: - - 8025:8025/tcp - - 1025:1025/tcp + - 8025/tcp + - 1025/tcp steps: - name: Set app env @@ -146,16 +150,24 @@ jobs: - name: Set up Nextcloud env: - DB_PORT: 4444 + DB_PORT: ${{ job.services.postgres.ports[5432] }} + SMTP_PORT: ${{ job.services.mailpit.ports[1025] }} run: | - sudo echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts + if [ "${ACT}" = "true" ]; then + DB_HOST=postgres + DB_PORT=5432 + SMTP_PORT=1025 + else + DB_HOST=127.0.0.1 + echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts + fi mkdir data ./occ maintenance:install \ --verbose \ --database=pgsql \ --database-name=nextcloud \ - --database-host=127.0.0.1 \ - --database-port=$DB_PORT \ + --database-host="$DB_HOST" \ + --database-port="$DB_PORT" \ --database-user=root \ --database-pass=rootpassword \ --admin-user admin \ @@ -174,7 +186,7 @@ jobs: ./occ config:system:set allow_local_remote_servers --value true --type boolean ./occ config:system:set auth.bruteforce.protection.enabled --value false --type boolean ./occ config:system:set mail_smtphost --value mailpit - ./occ config:system:set mail_smtpport --value 1025 --type integer + ./occ config:system:set mail_smtpport --value "$SMTP_PORT" --type integer ./occ config:system:set ratelimit.protection.enabled --value false --type boolean ./occ config:app:set dav enableDefaultContact --value false --type boolean @@ -186,7 +198,7 @@ jobs: export BEHAT_RUN_AS=runner export BEHAT_VERBOSE="$RUNNER_DEBUG" # shellcheck disable=SC2086 - vendor/bin/behat -f junit -f pretty --colors ${{ matrix.shard.paths }} + vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} - name: Print logs if: always() diff --git a/.github/workflows/behat-sqlite.yml b/.github/workflows/behat-sqlite.yml index 1693b626b4..a60148a750 100644 --- a/.github/workflows/behat-sqlite.yml +++ b/.github/workflows/behat-sqlite.yml @@ -63,24 +63,28 @@ jobs: matrix: php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} - shard: - - name: account-admin + # Flat shard key so `act --matrix shard:sign` can select a single cell. + shard: [account-admin, file-notify, page-policies, sign] + include: + - shard: account-admin paths: features/account features/admin features/bootstrap features/build - - name: file-notify + - shard: file-notify paths: features/file features/identify-account features/notification - - name: page-policies + - shard: page-policies paths: features/page features/policies features/settings - - name: sign + - shard: sign paths: features/sign - name: SQLite PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} (${{ matrix.shard.name }}) + name: SQLite PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} (${{ matrix.shard }}) services: mailpit: image: axllent/mailpit + # Publish only the container port so Docker picks a free host port. + # Fixed binds collide under act (shared Docker host + matrix). ports: - - 8025:8025/tcp - - 1025:1025/tcp + - 8025/tcp + - 1025/tcp steps: - name: Set app env @@ -137,16 +141,20 @@ jobs: - name: Set up Nextcloud env: - DB_PORT: 4444 + SMTP_PORT: ${{ job.services.mailpit.ports[1025] }} run: | - sudo echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts + if [ "${ACT}" = "true" ]; then + SMTP_PORT=1025 + else + echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts + fi mkdir data ./occ maintenance:install \ --verbose \ --database=sqlite \ --database-name=nextcloud \ --database-host=127.0.0.1 \ - --database-port=$DB_PORT \ + --database-port=4444 \ --database-user=root \ --database-pass=rootpassword \ --admin-user admin \ @@ -165,7 +173,7 @@ jobs: ./occ config:system:set allow_local_remote_servers --value true --type boolean ./occ config:system:set auth.bruteforce.protection.enabled --value false --type boolean ./occ config:system:set mail_smtphost --value mailpit - ./occ config:system:set mail_smtpport --value 1025 --type integer + ./occ config:system:set mail_smtpport --value "$SMTP_PORT" --type integer ./occ config:system:set ratelimit.protection.enabled --value false --type boolean ./occ config:app:set dav enableDefaultContact --value false --type boolean @@ -177,7 +185,7 @@ jobs: export BEHAT_RUN_AS=runner export BEHAT_VERBOSE="$RUNNER_DEBUG" # shellcheck disable=SC2086 - vendor/bin/behat -f junit -f pretty --colors ${{ matrix.shard.paths }} + vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} - name: Print logs if: always() From f0ba6f621ba144054f0fa3626a7bdee5c10096e7 Mon Sep 17 00:00:00 2001 From: Luis Amorim Date: Thu, 24 Sep 2026 01:01:41 +0000 Subject: [PATCH 05/15] ci(behat): reach act services via 127.0.0.1 unique ports act puts the job on host networking, so Docker DNS names like mariadb do not resolve. Bind unique host ports per matrix cell and connect through 127.0.0.1, matching GHA runner-job networking. Signed-off-by: Cursor Agent Co-authored-by: Luis Amorim --- .github/workflows/behat-mariadb.yml | 81 ++++++++++++++++++----------- .github/workflows/behat-mysql.yml | 52 ++++++++---------- .github/workflows/behat-pgsql.yml | 40 +++++++------- .github/workflows/behat-sqlite.yml | 25 ++++----- 4 files changed, 109 insertions(+), 89 deletions(-) diff --git a/.github/workflows/behat-mariadb.yml b/.github/workflows/behat-mariadb.yml index 0ffee14400..e5072106ca 100644 --- a/.github/workflows/behat-mariadb.yml +++ b/.github/workflows/behat-mariadb.yml @@ -65,32 +65,73 @@ jobs: # Flat shard key so `act --matrix shard:sign` can select a single cell. shard: [account-admin, file-notify, page-policies, sign] include: + # Unique host ports per (shard, mariadb) so act matrix cells do not collide. - shard: account-admin + mariadb-versions: '10.6' paths: features/account features/admin features/bootstrap features/build + db_port: 4440 + smtp_port: 1020 + mail_ui_port: 8020 - shard: file-notify + mariadb-versions: '10.6' paths: features/file features/identify-account features/notification + db_port: 4441 + smtp_port: 1021 + mail_ui_port: 8021 - shard: page-policies + mariadb-versions: '10.6' paths: features/page features/policies features/settings + db_port: 4442 + smtp_port: 1022 + mail_ui_port: 8022 - shard: sign + mariadb-versions: '10.6' paths: features/sign + db_port: 4443 + smtp_port: 1023 + mail_ui_port: 8023 + - shard: account-admin + mariadb-versions: '10.11' + paths: features/account features/admin features/bootstrap features/build + db_port: 4450 + smtp_port: 1030 + mail_ui_port: 8030 + - shard: file-notify + mariadb-versions: '10.11' + paths: features/file features/identify-account features/notification + db_port: 4451 + smtp_port: 1031 + mail_ui_port: 8031 + - shard: page-policies + mariadb-versions: '10.11' + paths: features/page features/policies features/settings + db_port: 4452 + smtp_port: 1032 + mail_ui_port: 8032 + - shard: sign + mariadb-versions: '10.11' + paths: features/sign + db_port: 4453 + smtp_port: 1033 + mail_ui_port: 8033 name: MariaDB ${{ matrix.mariadb-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} (${{ matrix.shard }}) services: mariadb: image: ghcr.io/nextcloud/continuous-integration-mariadb-${{ matrix.mariadb-versions }}:latest - # Publish only the container port so Docker picks a free host port. - # Fixed binds like 4444:3306 collide under act (shared Docker host + matrix). + # act runs the job on host networking, so services must be reached via 127.0.0.1. + # Unique matrix.db_port avoids Bind collisions when act expands the matrix locally. ports: - - 3306/tcp + - ${{ matrix.db_port }}:3306/tcp env: MYSQL_ROOT_PASSWORD: rootpassword options: --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -prootpassword" --health-interval 5s --health-timeout 2s --health-retries 5 mailpit: image: axllent/mailpit ports: - - 8025/tcp - - 1025/tcp + - ${{ matrix.mail_ui_port }}:8025/tcp + - ${{ matrix.smtp_port }}:1025/tcp steps: - name: Set app env @@ -131,17 +172,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Enable ONLY_FULL_GROUP_BY MariaDB option - env: - DB_PORT: ${{ job.services.mariadb.ports[3306] }} run: | - if [ "${ACT}" = "true" ]; then - DB_HOST=mariadb - DB_PORT=3306 - else - DB_HOST=127.0.0.1 - fi - echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h "$DB_HOST" -P "$DB_PORT" -u root -prootpassword - echo "SELECT @@sql_mode;" | mysql -h "$DB_HOST" -P "$DB_PORT" -u root -prootpassword + echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P ${{ matrix.db_port }} -u root -prootpassword + echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P ${{ matrix.db_port }} -u root -prootpassword - name: Set up dependencies working-directory: apps/${{ env.APP_NAME }} @@ -151,25 +184,15 @@ jobs: composer --working-dir=tests/integration install - name: Set up Nextcloud - env: - DB_PORT: ${{ job.services.mariadb.ports[3306] }} - SMTP_PORT: ${{ job.services.mailpit.ports[1025] }} run: | - if [ "${ACT}" = "true" ]; then - DB_HOST=mariadb - DB_PORT=3306 - SMTP_PORT=1025 - else - DB_HOST=127.0.0.1 - echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts - fi + sudo echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts mkdir data ./occ maintenance:install \ --verbose \ --database=mysql \ --database-name=nextcloud \ - --database-host="$DB_HOST" \ - --database-port="$DB_PORT" \ + --database-host=127.0.0.1 \ + --database-port=${{ matrix.db_port }} \ --database-user=root \ --database-pass=rootpassword \ --admin-user admin \ @@ -188,7 +211,7 @@ jobs: ./occ config:system:set allow_local_remote_servers --value true --type boolean ./occ config:system:set auth.bruteforce.protection.enabled --value false --type boolean ./occ config:system:set mail_smtphost --value mailpit - ./occ config:system:set mail_smtpport --value "$SMTP_PORT" --type integer + ./occ config:system:set mail_smtpport --value ${{ matrix.smtp_port }} --type integer ./occ config:system:set ratelimit.protection.enabled --value false --type boolean ./occ config:app:set dav enableDefaultContact --value false --type boolean diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml index 728f0a3f31..b114aa5c29 100644 --- a/.github/workflows/behat-mysql.yml +++ b/.github/workflows/behat-mysql.yml @@ -71,30 +71,42 @@ jobs: include: - shard: account-admin paths: features/account features/admin features/bootstrap features/build + db_port: 4440 + smtp_port: 1020 + mail_ui_port: 8020 - shard: file-notify paths: features/file features/identify-account features/notification + db_port: 4441 + smtp_port: 1021 + mail_ui_port: 8021 - shard: page-policies paths: features/page features/policies features/settings + db_port: 4442 + smtp_port: 1022 + mail_ui_port: 8022 - shard: sign paths: features/sign + db_port: 4443 + smtp_port: 1023 + mail_ui_port: 8023 name: MySQL ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} (${{ matrix.shard }}) services: mysql: image: ghcr.io/nextcloud/continuous-integration-mysql-${{ matrix.mysql-versions }}:latest - # Publish only the container port so Docker picks a free host port. - # Fixed binds like 4444:3306 collide under act (shared Docker host + matrix). + # act runs the job on host networking, so services must be reached via 127.0.0.1. + # Unique matrix.db_port avoids Bind collisions when act expands the matrix locally. ports: - - 3306/tcp + - ${{ matrix.db_port }}:3306/tcp env: MYSQL_ROOT_PASSWORD: rootpassword options: --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -prootpassword" --health-interval 5s --health-timeout 2s --health-retries 10 mailpit: image: axllent/mailpit ports: - - 8025/tcp - - 1025/tcp + - ${{ matrix.mail_ui_port }}:8025/tcp + - ${{ matrix.smtp_port }}:1025/tcp steps: - name: Set app env @@ -135,17 +147,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Enable ONLY_FULL_GROUP_BY MySQL option - env: - DB_PORT: ${{ job.services.mysql.ports[3306] }} run: | - if [ "${ACT}" = "true" ]; then - DB_HOST=mysql - DB_PORT=3306 - else - DB_HOST=127.0.0.1 - fi - echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h "$DB_HOST" -P "$DB_PORT" -u root -prootpassword - echo "SELECT @@sql_mode;" | mysql -h "$DB_HOST" -P "$DB_PORT" -u root -prootpassword + echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P ${{ matrix.db_port }} -u root -prootpassword + echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P ${{ matrix.db_port }} -u root -prootpassword - name: Check composer file existence id: check_composer @@ -163,25 +167,15 @@ jobs: composer --working-dir=tests/integration install - name: Set up Nextcloud - env: - DB_PORT: ${{ job.services.mysql.ports[3306] }} - SMTP_PORT: ${{ job.services.mailpit.ports[1025] }} run: | - if [ "${ACT}" = "true" ]; then - DB_HOST=mysql - DB_PORT=3306 - SMTP_PORT=1025 - else - DB_HOST=127.0.0.1 - echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts - fi + sudo echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts mkdir data ./occ maintenance:install \ --verbose \ --database=mysql \ --database-name=nextcloud \ - --database-host="$DB_HOST" \ - --database-port="$DB_PORT" \ + --database-host=127.0.0.1 \ + --database-port=${{ matrix.db_port }} \ --database-user=root \ --database-pass=rootpassword \ --admin-user admin \ @@ -200,7 +194,7 @@ jobs: ./occ config:system:set allow_local_remote_servers --value true --type boolean ./occ config:system:set auth.bruteforce.protection.enabled --value false --type boolean ./occ config:system:set mail_smtphost --value mailpit - ./occ config:system:set mail_smtpport --value "$SMTP_PORT" --type integer + ./occ config:system:set mail_smtpport --value ${{ matrix.smtp_port }} --type integer ./occ config:system:set ratelimit.protection.enabled --value false --type boolean ./occ config:app:set dav enableDefaultContact --value false --type boolean diff --git a/.github/workflows/behat-pgsql.yml b/.github/workflows/behat-pgsql.yml index c2b90bb30e..be61539fbe 100644 --- a/.github/workflows/behat-pgsql.yml +++ b/.github/workflows/behat-pgsql.yml @@ -68,22 +68,34 @@ jobs: include: - shard: account-admin paths: features/account features/admin features/bootstrap features/build + db_port: 4440 + smtp_port: 1020 + mail_ui_port: 8020 - shard: file-notify paths: features/file features/identify-account features/notification + db_port: 4441 + smtp_port: 1021 + mail_ui_port: 8021 - shard: page-policies paths: features/page features/policies features/settings + db_port: 4442 + smtp_port: 1022 + mail_ui_port: 8022 - shard: sign paths: features/sign + db_port: 4443 + smtp_port: 1023 + mail_ui_port: 8023 name: PostgreSQL PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} (${{ matrix.shard }}) services: postgres: image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest - # Publish only the container port so Docker picks a free host port. - # Fixed binds like 4444:5432 collide under act (shared Docker host + matrix). + # act runs the job on host networking, so services must be reached via 127.0.0.1. + # Unique matrix.db_port avoids Bind collisions when act expands the matrix locally. ports: - - 5432/tcp + - ${{ matrix.db_port }}:5432/tcp env: POSTGRES_USER: root POSTGRES_PASSWORD: rootpassword @@ -92,8 +104,8 @@ jobs: mailpit: image: axllent/mailpit ports: - - 8025/tcp - - 1025/tcp + - ${{ matrix.mail_ui_port }}:8025/tcp + - ${{ matrix.smtp_port }}:1025/tcp steps: - name: Set app env @@ -149,25 +161,15 @@ jobs: composer --working-dir=tests/integration install - name: Set up Nextcloud - env: - DB_PORT: ${{ job.services.postgres.ports[5432] }} - SMTP_PORT: ${{ job.services.mailpit.ports[1025] }} run: | - if [ "${ACT}" = "true" ]; then - DB_HOST=postgres - DB_PORT=5432 - SMTP_PORT=1025 - else - DB_HOST=127.0.0.1 - echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts - fi + sudo echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts mkdir data ./occ maintenance:install \ --verbose \ --database=pgsql \ --database-name=nextcloud \ - --database-host="$DB_HOST" \ - --database-port="$DB_PORT" \ + --database-host=127.0.0.1 \ + --database-port=${{ matrix.db_port }} \ --database-user=root \ --database-pass=rootpassword \ --admin-user admin \ @@ -186,7 +188,7 @@ jobs: ./occ config:system:set allow_local_remote_servers --value true --type boolean ./occ config:system:set auth.bruteforce.protection.enabled --value false --type boolean ./occ config:system:set mail_smtphost --value mailpit - ./occ config:system:set mail_smtpport --value "$SMTP_PORT" --type integer + ./occ config:system:set mail_smtpport --value ${{ matrix.smtp_port }} --type integer ./occ config:system:set ratelimit.protection.enabled --value false --type boolean ./occ config:app:set dav enableDefaultContact --value false --type boolean diff --git a/.github/workflows/behat-sqlite.yml b/.github/workflows/behat-sqlite.yml index a60148a750..51eb25e88c 100644 --- a/.github/workflows/behat-sqlite.yml +++ b/.github/workflows/behat-sqlite.yml @@ -68,23 +68,30 @@ jobs: include: - shard: account-admin paths: features/account features/admin features/bootstrap features/build + smtp_port: 1020 + mail_ui_port: 8020 - shard: file-notify paths: features/file features/identify-account features/notification + smtp_port: 1021 + mail_ui_port: 8021 - shard: page-policies paths: features/page features/policies features/settings + smtp_port: 1022 + mail_ui_port: 8022 - shard: sign paths: features/sign + smtp_port: 1023 + mail_ui_port: 8023 name: SQLite PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} (${{ matrix.shard }}) services: mailpit: image: axllent/mailpit - # Publish only the container port so Docker picks a free host port. - # Fixed binds collide under act (shared Docker host + matrix). + # act runs the job on host networking; unique ports avoid Bind collisions locally. ports: - - 8025/tcp - - 1025/tcp + - ${{ matrix.mail_ui_port }}:8025/tcp + - ${{ matrix.smtp_port }}:1025/tcp steps: - name: Set app env @@ -140,14 +147,8 @@ jobs: composer --working-dir=tests/integration install - name: Set up Nextcloud - env: - SMTP_PORT: ${{ job.services.mailpit.ports[1025] }} run: | - if [ "${ACT}" = "true" ]; then - SMTP_PORT=1025 - else - echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts - fi + sudo echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts mkdir data ./occ maintenance:install \ --verbose \ @@ -173,7 +174,7 @@ jobs: ./occ config:system:set allow_local_remote_servers --value true --type boolean ./occ config:system:set auth.bruteforce.protection.enabled --value false --type boolean ./occ config:system:set mail_smtphost --value mailpit - ./occ config:system:set mail_smtpport --value "$SMTP_PORT" --type integer + ./occ config:system:set mail_smtpport --value ${{ matrix.smtp_port }} --type integer ./occ config:system:set ratelimit.protection.enabled --value false --type boolean ./occ config:app:set dav enableDefaultContact --value false --type boolean From bb4273040c7a1063675d2b35d970b2b6a20edd03 Mon Sep 17 00:00:00 2001 From: Luis Amorim Date: Thu, 24 Sep 2026 01:02:04 +0000 Subject: [PATCH 06/15] ci(behat): do not fail Print logs when nextcloud.log is missing Early setup failures leave no data/nextcloud.log; keep the always() diagnostic step non-fatal under act. Signed-off-by: Cursor Agent Co-authored-by: Luis Amorim --- .github/workflows/behat-mariadb.yml | 2 +- .github/workflows/behat-mysql.yml | 2 +- .github/workflows/behat-pgsql.yml | 2 +- .github/workflows/behat-sqlite.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/behat-mariadb.yml b/.github/workflows/behat-mariadb.yml index e5072106ca..dcea6878a6 100644 --- a/.github/workflows/behat-mariadb.yml +++ b/.github/workflows/behat-mariadb.yml @@ -228,7 +228,7 @@ jobs: - name: Print logs if: always() run: | - cat data/nextcloud.log + cat data/nextcloud.log 2>/dev/null || echo "No nextcloud.log yet" summary: permissions: diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml index b114aa5c29..ab3ea5be97 100644 --- a/.github/workflows/behat-mysql.yml +++ b/.github/workflows/behat-mysql.yml @@ -211,7 +211,7 @@ jobs: - name: Print logs if: always() run: | - cat data/nextcloud.log + cat data/nextcloud.log 2>/dev/null || echo "No nextcloud.log yet" summary: permissions: diff --git a/.github/workflows/behat-pgsql.yml b/.github/workflows/behat-pgsql.yml index be61539fbe..a8d744fc48 100644 --- a/.github/workflows/behat-pgsql.yml +++ b/.github/workflows/behat-pgsql.yml @@ -205,7 +205,7 @@ jobs: - name: Print logs if: always() run: | - cat data/nextcloud.log + cat data/nextcloud.log 2>/dev/null || echo "No nextcloud.log yet" summary: permissions: diff --git a/.github/workflows/behat-sqlite.yml b/.github/workflows/behat-sqlite.yml index 51eb25e88c..f69eedfa89 100644 --- a/.github/workflows/behat-sqlite.yml +++ b/.github/workflows/behat-sqlite.yml @@ -191,7 +191,7 @@ jobs: - name: Print logs if: always() run: | - cat data/nextcloud.log + cat data/nextcloud.log 2>/dev/null || echo "No nextcloud.log yet" summary: permissions: From 25ff63707b89bf24e8eb7d63504d0420a8846a05 Mon Sep 17 00:00:00 2001 From: Luis Amorim Date: Thu, 24 Sep 2026 01:11:27 +0000 Subject: [PATCH 07/15] ci(behat): ensure 3rdparty exists before composer under act act local checkout often leaves the 3rdparty gitlink empty, so composer classmap fails on 3rdparty/composer. Clone the pinned submodule when missing. Signed-off-by: Cursor Agent Co-authored-by: Luis Amorim --- .github/workflows/behat-mariadb.yml | 15 +++++++++++++++ .github/workflows/behat-mysql.yml | 15 +++++++++++++++ .github/workflows/behat-pgsql.yml | 15 +++++++++++++++ .github/workflows/behat-sqlite.yml | 15 +++++++++++++++ 4 files changed, 60 insertions(+) diff --git a/.github/workflows/behat-mariadb.yml b/.github/workflows/behat-mariadb.yml index dcea6878a6..4261c62874 100644 --- a/.github/workflows/behat-mariadb.yml +++ b/.github/workflows/behat-mariadb.yml @@ -157,6 +157,21 @@ jobs: submodules: true path: apps/${{ env.APP_NAME }} + # act often copies the worktree without initializing gitlinks; composer classmap needs 3rdparty/composer. + - name: Ensure LibreSign 3rdparty is present + working-directory: apps/${{ env.APP_NAME }} + run: | + if [ -d 3rdparty/composer ]; then + echo "3rdparty already present" + exit 0 + fi + THIRDPARTY_SHA="$(git rev-parse HEAD:3rdparty 2>/dev/null || true)" + rm -rf 3rdparty + git clone https://github.com/LibreSign/3rdparty.git 3rdparty + if [ -n "$THIRDPARTY_SHA" ]; then + git -C 3rdparty checkout --force "$THIRDPARTY_SHA" + fi + - name: Set up php ${{ matrix.php-versions }} uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 with: diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml index ab3ea5be97..ae5bb1e315 100644 --- a/.github/workflows/behat-mysql.yml +++ b/.github/workflows/behat-mysql.yml @@ -132,6 +132,21 @@ jobs: submodules: true path: apps/${{ env.APP_NAME }} + # act often copies the worktree without initializing gitlinks; composer classmap needs 3rdparty/composer. + - name: Ensure LibreSign 3rdparty is present + working-directory: apps/${{ env.APP_NAME }} + run: | + if [ -d 3rdparty/composer ]; then + echo "3rdparty already present" + exit 0 + fi + THIRDPARTY_SHA="$(git rev-parse HEAD:3rdparty 2>/dev/null || true)" + rm -rf 3rdparty + git clone https://github.com/LibreSign/3rdparty.git 3rdparty + if [ -n "$THIRDPARTY_SHA" ]; then + git -C 3rdparty checkout --force "$THIRDPARTY_SHA" + fi + - name: Set up php ${{ matrix.php-versions }} uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 with: diff --git a/.github/workflows/behat-pgsql.yml b/.github/workflows/behat-pgsql.yml index a8d744fc48..76f1722186 100644 --- a/.github/workflows/behat-pgsql.yml +++ b/.github/workflows/behat-pgsql.yml @@ -131,6 +131,21 @@ jobs: submodules: true path: apps/${{ env.APP_NAME }} + # act often copies the worktree without initializing gitlinks; composer classmap needs 3rdparty/composer. + - name: Ensure LibreSign 3rdparty is present + working-directory: apps/${{ env.APP_NAME }} + run: | + if [ -d 3rdparty/composer ]; then + echo "3rdparty already present" + exit 0 + fi + THIRDPARTY_SHA="$(git rev-parse HEAD:3rdparty 2>/dev/null || true)" + rm -rf 3rdparty + git clone https://github.com/LibreSign/3rdparty.git 3rdparty + if [ -n "$THIRDPARTY_SHA" ]; then + git -C 3rdparty checkout --force "$THIRDPARTY_SHA" + fi + - name: Set up php ${{ matrix.php-versions }} uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 with: diff --git a/.github/workflows/behat-sqlite.yml b/.github/workflows/behat-sqlite.yml index f69eedfa89..35093ae0a8 100644 --- a/.github/workflows/behat-sqlite.yml +++ b/.github/workflows/behat-sqlite.yml @@ -117,6 +117,21 @@ jobs: submodules: true path: apps/${{ env.APP_NAME }} + # act often copies the worktree without initializing gitlinks; composer classmap needs 3rdparty/composer. + - name: Ensure LibreSign 3rdparty is present + working-directory: apps/${{ env.APP_NAME }} + run: | + if [ -d 3rdparty/composer ]; then + echo "3rdparty already present" + exit 0 + fi + THIRDPARTY_SHA="$(git rev-parse HEAD:3rdparty 2>/dev/null || true)" + rm -rf 3rdparty + git clone https://github.com/LibreSign/3rdparty.git 3rdparty + if [ -n "$THIRDPARTY_SHA" ]; then + git -C 3rdparty checkout --force "$THIRDPARTY_SHA" + fi + - name: Set up php ${{ matrix.php-versions }} uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 with: From 6f05edc6224ce2c8dc0c8e16de84ae1da7d56879 Mon Sep 17 00:00:00 2001 From: Luis Amorim Date: Thu, 24 Sep 2026 01:20:32 +0000 Subject: [PATCH 08/15] ci(behat): install procps and prepare runner user under act RunServerListener uses ps to detect the PHP built-in server; act images lack procps so isRunning() always fails. Also ensure the runner user owns the Nextcloud tree when BEHAT_RUN_AS=runner under act. Signed-off-by: Cursor Agent Co-authored-by: Luis Amorim --- .github/workflows/behat-mariadb.yml | 8 +++++++- .github/workflows/behat-mysql.yml | 8 +++++++- .github/workflows/behat-pgsql.yml | 8 +++++++- .github/workflows/behat-sqlite.yml | 8 +++++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/.github/workflows/behat-mariadb.yml b/.github/workflows/behat-mariadb.yml index 4261c62874..c0423eeda8 100644 --- a/.github/workflows/behat-mariadb.yml +++ b/.github/workflows/behat-mariadb.yml @@ -140,7 +140,7 @@ jobs: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - name: Install system dependencies - run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils + run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils procps - name: Checkout server uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -235,6 +235,12 @@ jobs: env: BEHAT_ROOT_DIR: ../../../../ run: | + # act images often lack procps and a runner user; RunServerListener needs both. + if [ "${ACT}" = "true" ]; then + id -u runner >/dev/null 2>&1 || useradd -m -s /bin/bash runner + NC_ROOT="$(cd ../../../.. && pwd)" + chown -R runner:runner "$NC_ROOT" + fi export BEHAT_RUN_AS=runner export BEHAT_VERBOSE="$RUNNER_DEBUG" # shellcheck disable=SC2086 diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml index ae5bb1e315..8108e1b36e 100644 --- a/.github/workflows/behat-mysql.yml +++ b/.github/workflows/behat-mysql.yml @@ -115,7 +115,7 @@ jobs: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - name: Install system dependencies - run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils + run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils procps - name: Checkout server uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -218,6 +218,12 @@ jobs: env: BEHAT_ROOT_DIR: ../../../../ run: | + # act images often lack procps and a runner user; RunServerListener needs both. + if [ "${ACT}" = "true" ]; then + id -u runner >/dev/null 2>&1 || useradd -m -s /bin/bash runner + NC_ROOT="$(cd ../../../.. && pwd)" + chown -R runner:runner "$NC_ROOT" + fi export BEHAT_RUN_AS=runner export BEHAT_VERBOSE="$RUNNER_DEBUG" # shellcheck disable=SC2086 diff --git a/.github/workflows/behat-pgsql.yml b/.github/workflows/behat-pgsql.yml index 76f1722186..c2f79c23d3 100644 --- a/.github/workflows/behat-pgsql.yml +++ b/.github/workflows/behat-pgsql.yml @@ -114,7 +114,7 @@ jobs: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - name: Install system dependencies - run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils + run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils procps - name: Checkout server uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -212,6 +212,12 @@ jobs: env: BEHAT_ROOT_DIR: ../../../../ run: | + # act images often lack procps and a runner user; RunServerListener needs both. + if [ "${ACT}" = "true" ]; then + id -u runner >/dev/null 2>&1 || useradd -m -s /bin/bash runner + NC_ROOT="$(cd ../../../.. && pwd)" + chown -R runner:runner "$NC_ROOT" + fi export BEHAT_RUN_AS=runner export BEHAT_VERBOSE="$RUNNER_DEBUG" # shellcheck disable=SC2086 diff --git a/.github/workflows/behat-sqlite.yml b/.github/workflows/behat-sqlite.yml index 35093ae0a8..13dd74f334 100644 --- a/.github/workflows/behat-sqlite.yml +++ b/.github/workflows/behat-sqlite.yml @@ -100,7 +100,7 @@ jobs: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - name: Install system dependencies - run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils + run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils procps - name: Checkout server uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -198,6 +198,12 @@ jobs: env: BEHAT_ROOT_DIR: ../../../../ run: | + # act images often lack procps and a runner user; RunServerListener needs both. + if [ "${ACT}" = "true" ]; then + id -u runner >/dev/null 2>&1 || useradd -m -s /bin/bash runner + NC_ROOT="$(cd ../../../.. && pwd)" + chown -R runner:runner "$NC_ROOT" + fi export BEHAT_RUN_AS=runner export BEHAT_VERBOSE="$RUNNER_DEBUG" # shellcheck disable=SC2086 From b2b58c296af46a2d4e70ca4ae8be283f1c153a4e Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 24 Sep 2026 01:42:22 +0000 Subject: [PATCH 09/15] ci(behat): run behat as runner under act FeatureContext requires the Behat process UID to match file owner. Under act, chown to runner then runuser so php -S and behat share one user. Unset GITHUB_ACTIONS in that process to avoid sudo wrapping without NOPASSWD. Signed-off-by: Cursor Agent Co-authored-by: Luis Amorim --- .github/workflows/behat-mariadb.yml | 19 +++++++++++++++---- .github/workflows/behat-mysql.yml | 19 +++++++++++++++---- .github/workflows/behat-pgsql.yml | 19 +++++++++++++++---- .github/workflows/behat-sqlite.yml | 19 +++++++++++++++---- 4 files changed, 60 insertions(+), 16 deletions(-) diff --git a/.github/workflows/behat-mariadb.yml b/.github/workflows/behat-mariadb.yml index c0423eeda8..c9da37f439 100644 --- a/.github/workflows/behat-mariadb.yml +++ b/.github/workflows/behat-mariadb.yml @@ -236,15 +236,26 @@ jobs: BEHAT_ROOT_DIR: ../../../../ run: | # act images often lack procps and a runner user; RunServerListener needs both. + # FeatureContext also requires the Behat process UID to match BEHAT_RUN_AS / file owner. if [ "${ACT}" = "true" ]; then id -u runner >/dev/null 2>&1 || useradd -m -s /bin/bash runner NC_ROOT="$(cd ../../../.. && pwd)" chown -R runner:runner "$NC_ROOT" + # shellcheck disable=SC2086 + # Drop GITHUB_ACTIONS so RunServerListener does not wrap php -S in sudo + # (behat already runs as runner; act's runner user has no passwordless sudo). + runuser -u runner -- env -u GITHUB_ACTIONS \ + BEHAT_RUN_AS=runner \ + BEHAT_ROOT_DIR=../../../../ \ + BEHAT_VERBOSE="${RUNNER_DEBUG:-}" \ + HOME=/home/runner \ + vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} + else + export BEHAT_RUN_AS=runner + export BEHAT_VERBOSE="$RUNNER_DEBUG" + # shellcheck disable=SC2086 + vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} fi - export BEHAT_RUN_AS=runner - export BEHAT_VERBOSE="$RUNNER_DEBUG" - # shellcheck disable=SC2086 - vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} - name: Print logs if: always() diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml index 8108e1b36e..e0525921e2 100644 --- a/.github/workflows/behat-mysql.yml +++ b/.github/workflows/behat-mysql.yml @@ -219,15 +219,26 @@ jobs: BEHAT_ROOT_DIR: ../../../../ run: | # act images often lack procps and a runner user; RunServerListener needs both. + # FeatureContext also requires the Behat process UID to match BEHAT_RUN_AS / file owner. if [ "${ACT}" = "true" ]; then id -u runner >/dev/null 2>&1 || useradd -m -s /bin/bash runner NC_ROOT="$(cd ../../../.. && pwd)" chown -R runner:runner "$NC_ROOT" + # shellcheck disable=SC2086 + # Drop GITHUB_ACTIONS so RunServerListener does not wrap php -S in sudo + # (behat already runs as runner; act's runner user has no passwordless sudo). + runuser -u runner -- env -u GITHUB_ACTIONS \ + BEHAT_RUN_AS=runner \ + BEHAT_ROOT_DIR=../../../../ \ + BEHAT_VERBOSE="${RUNNER_DEBUG:-}" \ + HOME=/home/runner \ + vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} + else + export BEHAT_RUN_AS=runner + export BEHAT_VERBOSE="$RUNNER_DEBUG" + # shellcheck disable=SC2086 + vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} fi - export BEHAT_RUN_AS=runner - export BEHAT_VERBOSE="$RUNNER_DEBUG" - # shellcheck disable=SC2086 - vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} - name: Print logs if: always() diff --git a/.github/workflows/behat-pgsql.yml b/.github/workflows/behat-pgsql.yml index c2f79c23d3..3881d3c334 100644 --- a/.github/workflows/behat-pgsql.yml +++ b/.github/workflows/behat-pgsql.yml @@ -213,15 +213,26 @@ jobs: BEHAT_ROOT_DIR: ../../../../ run: | # act images often lack procps and a runner user; RunServerListener needs both. + # FeatureContext also requires the Behat process UID to match BEHAT_RUN_AS / file owner. if [ "${ACT}" = "true" ]; then id -u runner >/dev/null 2>&1 || useradd -m -s /bin/bash runner NC_ROOT="$(cd ../../../.. && pwd)" chown -R runner:runner "$NC_ROOT" + # shellcheck disable=SC2086 + # Drop GITHUB_ACTIONS so RunServerListener does not wrap php -S in sudo + # (behat already runs as runner; act's runner user has no passwordless sudo). + runuser -u runner -- env -u GITHUB_ACTIONS \ + BEHAT_RUN_AS=runner \ + BEHAT_ROOT_DIR=../../../../ \ + BEHAT_VERBOSE="${RUNNER_DEBUG:-}" \ + HOME=/home/runner \ + vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} + else + export BEHAT_RUN_AS=runner + export BEHAT_VERBOSE="$RUNNER_DEBUG" + # shellcheck disable=SC2086 + vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} fi - export BEHAT_RUN_AS=runner - export BEHAT_VERBOSE="$RUNNER_DEBUG" - # shellcheck disable=SC2086 - vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} - name: Print logs if: always() diff --git a/.github/workflows/behat-sqlite.yml b/.github/workflows/behat-sqlite.yml index 13dd74f334..63d129d3a7 100644 --- a/.github/workflows/behat-sqlite.yml +++ b/.github/workflows/behat-sqlite.yml @@ -199,15 +199,26 @@ jobs: BEHAT_ROOT_DIR: ../../../../ run: | # act images often lack procps and a runner user; RunServerListener needs both. + # FeatureContext also requires the Behat process UID to match BEHAT_RUN_AS / file owner. if [ "${ACT}" = "true" ]; then id -u runner >/dev/null 2>&1 || useradd -m -s /bin/bash runner NC_ROOT="$(cd ../../../.. && pwd)" chown -R runner:runner "$NC_ROOT" + # shellcheck disable=SC2086 + # Drop GITHUB_ACTIONS so RunServerListener does not wrap php -S in sudo + # (behat already runs as runner; act's runner user has no passwordless sudo). + runuser -u runner -- env -u GITHUB_ACTIONS \ + BEHAT_RUN_AS=runner \ + BEHAT_ROOT_DIR=../../../../ \ + BEHAT_VERBOSE="${RUNNER_DEBUG:-}" \ + HOME=/home/runner \ + vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} + else + export BEHAT_RUN_AS=runner + export BEHAT_VERBOSE="$RUNNER_DEBUG" + # shellcheck disable=SC2086 + vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} fi - export BEHAT_RUN_AS=runner - export BEHAT_VERBOSE="$RUNNER_DEBUG" - # shellcheck disable=SC2086 - vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} - name: Print logs if: always() From 45d00a2cd58357f8b4b5c8f5aa6fe3ee21f15e03 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 24 Sep 2026 01:56:19 +0000 Subject: [PATCH 10/15] ci(behat): cap php -S workers and fix act Mailpit URL Sharding shortens suites but each cell still ran PhpBuiltin with workers:10, which amplifies Empty-reply crashes under act/Docker. Lower default workers to 2 (still enough for nested self-HTTP), set BEHAT_WORKERS=2 in CI, and under act point Mailpit at the published host UI port with verbose Behat output for diagnosis. Signed-off-by: Cursor Agent Co-authored-by: Luis Amorim --- .github/workflows/behat-mariadb.yml | 10 ++++++++-- .github/workflows/behat-mysql.yml | 10 ++++++++-- .github/workflows/behat-pgsql.yml | 10 ++++++++-- .github/workflows/behat-sqlite.yml | 10 ++++++++-- tests/integration/config/behat.yml | 4 +++- 5 files changed, 35 insertions(+), 9 deletions(-) diff --git a/.github/workflows/behat-mariadb.yml b/.github/workflows/behat-mariadb.yml index c9da37f439..4c7f02dc16 100644 --- a/.github/workflows/behat-mariadb.yml +++ b/.github/workflows/behat-mariadb.yml @@ -234,6 +234,8 @@ jobs: working-directory: apps/${{ env.APP_NAME }}/tests/integration env: BEHAT_ROOT_DIR: ../../../../ + # Override PhpBuiltin workers; high PHP_CLI_SERVER_WORKERS correlates with Empty-reply crashes. + BEHAT_WORKERS: "2" run: | # act images often lack procps and a runner user; RunServerListener needs both. # FeatureContext also requires the Behat process UID to match BEHAT_RUN_AS / file owner. @@ -241,15 +243,19 @@ jobs: id -u runner >/dev/null 2>&1 || useradd -m -s /bin/bash runner NC_ROOT="$(cd ../../../.. && pwd)" chown -R runner:runner "$NC_ROOT" + # Under act (host networking) Mailpit is published on matrix.mail_ui_port, not :8025. + sed -i.bak "s|base_url: http://mailpit:8025|base_url: http://127.0.0.1:${{ matrix.mail_ui_port }}|" config/behat.yml # shellcheck disable=SC2086 # Drop GITHUB_ACTIONS so RunServerListener does not wrap php -S in sudo # (behat already runs as runner; act's runner user has no passwordless sudo). runuser -u runner -- env -u GITHUB_ACTIONS \ BEHAT_RUN_AS=runner \ BEHAT_ROOT_DIR=../../../../ \ - BEHAT_VERBOSE="${RUNNER_DEBUG:-}" \ + BEHAT_WORKERS=2 \ + BEHAT_VERBOSE=1 \ HOME=/home/runner \ - vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} + PATH="$PATH" \ + vendor/bin/behat -f junit -f pretty --colors -v ${{ matrix.paths }} else export BEHAT_RUN_AS=runner export BEHAT_VERBOSE="$RUNNER_DEBUG" diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml index e0525921e2..21557d9092 100644 --- a/.github/workflows/behat-mysql.yml +++ b/.github/workflows/behat-mysql.yml @@ -217,6 +217,8 @@ jobs: working-directory: apps/${{ env.APP_NAME }}/tests/integration env: BEHAT_ROOT_DIR: ../../../../ + # Override PhpBuiltin workers; high PHP_CLI_SERVER_WORKERS correlates with Empty-reply crashes. + BEHAT_WORKERS: "2" run: | # act images often lack procps and a runner user; RunServerListener needs both. # FeatureContext also requires the Behat process UID to match BEHAT_RUN_AS / file owner. @@ -224,15 +226,19 @@ jobs: id -u runner >/dev/null 2>&1 || useradd -m -s /bin/bash runner NC_ROOT="$(cd ../../../.. && pwd)" chown -R runner:runner "$NC_ROOT" + # Under act (host networking) Mailpit is published on matrix.mail_ui_port, not :8025. + sed -i.bak "s|base_url: http://mailpit:8025|base_url: http://127.0.0.1:${{ matrix.mail_ui_port }}|" config/behat.yml # shellcheck disable=SC2086 # Drop GITHUB_ACTIONS so RunServerListener does not wrap php -S in sudo # (behat already runs as runner; act's runner user has no passwordless sudo). runuser -u runner -- env -u GITHUB_ACTIONS \ BEHAT_RUN_AS=runner \ BEHAT_ROOT_DIR=../../../../ \ - BEHAT_VERBOSE="${RUNNER_DEBUG:-}" \ + BEHAT_WORKERS=2 \ + BEHAT_VERBOSE=1 \ HOME=/home/runner \ - vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} + PATH="$PATH" \ + vendor/bin/behat -f junit -f pretty --colors -v ${{ matrix.paths }} else export BEHAT_RUN_AS=runner export BEHAT_VERBOSE="$RUNNER_DEBUG" diff --git a/.github/workflows/behat-pgsql.yml b/.github/workflows/behat-pgsql.yml index 3881d3c334..d03099e3f8 100644 --- a/.github/workflows/behat-pgsql.yml +++ b/.github/workflows/behat-pgsql.yml @@ -211,6 +211,8 @@ jobs: working-directory: apps/${{ env.APP_NAME }}/tests/integration env: BEHAT_ROOT_DIR: ../../../../ + # Override PhpBuiltin workers; high PHP_CLI_SERVER_WORKERS correlates with Empty-reply crashes. + BEHAT_WORKERS: "2" run: | # act images often lack procps and a runner user; RunServerListener needs both. # FeatureContext also requires the Behat process UID to match BEHAT_RUN_AS / file owner. @@ -218,15 +220,19 @@ jobs: id -u runner >/dev/null 2>&1 || useradd -m -s /bin/bash runner NC_ROOT="$(cd ../../../.. && pwd)" chown -R runner:runner "$NC_ROOT" + # Under act (host networking) Mailpit is published on matrix.mail_ui_port, not :8025. + sed -i.bak "s|base_url: http://mailpit:8025|base_url: http://127.0.0.1:${{ matrix.mail_ui_port }}|" config/behat.yml # shellcheck disable=SC2086 # Drop GITHUB_ACTIONS so RunServerListener does not wrap php -S in sudo # (behat already runs as runner; act's runner user has no passwordless sudo). runuser -u runner -- env -u GITHUB_ACTIONS \ BEHAT_RUN_AS=runner \ BEHAT_ROOT_DIR=../../../../ \ - BEHAT_VERBOSE="${RUNNER_DEBUG:-}" \ + BEHAT_WORKERS=2 \ + BEHAT_VERBOSE=1 \ HOME=/home/runner \ - vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} + PATH="$PATH" \ + vendor/bin/behat -f junit -f pretty --colors -v ${{ matrix.paths }} else export BEHAT_RUN_AS=runner export BEHAT_VERBOSE="$RUNNER_DEBUG" diff --git a/.github/workflows/behat-sqlite.yml b/.github/workflows/behat-sqlite.yml index 63d129d3a7..417a2368ba 100644 --- a/.github/workflows/behat-sqlite.yml +++ b/.github/workflows/behat-sqlite.yml @@ -197,6 +197,8 @@ jobs: working-directory: apps/${{ env.APP_NAME }}/tests/integration env: BEHAT_ROOT_DIR: ../../../../ + # Override PhpBuiltin workers; high PHP_CLI_SERVER_WORKERS correlates with Empty-reply crashes. + BEHAT_WORKERS: "2" run: | # act images often lack procps and a runner user; RunServerListener needs both. # FeatureContext also requires the Behat process UID to match BEHAT_RUN_AS / file owner. @@ -204,15 +206,19 @@ jobs: id -u runner >/dev/null 2>&1 || useradd -m -s /bin/bash runner NC_ROOT="$(cd ../../../.. && pwd)" chown -R runner:runner "$NC_ROOT" + # Under act (host networking) Mailpit is published on matrix.mail_ui_port, not :8025. + sed -i.bak "s|base_url: http://mailpit:8025|base_url: http://127.0.0.1:${{ matrix.mail_ui_port }}|" config/behat.yml # shellcheck disable=SC2086 # Drop GITHUB_ACTIONS so RunServerListener does not wrap php -S in sudo # (behat already runs as runner; act's runner user has no passwordless sudo). runuser -u runner -- env -u GITHUB_ACTIONS \ BEHAT_RUN_AS=runner \ BEHAT_ROOT_DIR=../../../../ \ - BEHAT_VERBOSE="${RUNNER_DEBUG:-}" \ + BEHAT_WORKERS=2 \ + BEHAT_VERBOSE=1 \ HOME=/home/runner \ - vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} + PATH="$PATH" \ + vendor/bin/behat -f junit -f pretty --colors -v ${{ matrix.paths }} else export BEHAT_RUN_AS=runner export BEHAT_VERBOSE="$RUNNER_DEBUG" diff --git a/tests/integration/config/behat.yml b/tests/integration/config/behat.yml index 6fb644805f..0dd59d88db 100644 --- a/tests/integration/config/behat.yml +++ b/tests/integration/config/behat.yml @@ -16,7 +16,9 @@ default: base_url: http://mailpit:8025 PhpBuiltin\Server: runAs: www-data - workers: 10 + # Keep >=2 so nested same-server HTTP (e.g. develop/pdf) cannot deadlock. + # Cap low: PHP_CLI_SERVER_WORKERS is experimental and high values amplify Empty-reply flakes. + workers: 2 jarnaiz\JUnitFormatter\JUnitFormatterExtension: filename: report.xml outputDir: '%paths.base%/../output/' From f1d1801e5a1502d044f4d9774bf17d37d1e7842b Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 24 Sep 2026 02:14:25 +0000 Subject: [PATCH 11/15] ci(behat): bind php -S to 127.0.0.1 under act/CI localhost can resolve to ::1 while Guzzle prefers IPv4, so the built-in server health check passes but every OCS call fails or cascades. Force BEHAT_HOST=127.0.0.1, trust that domain in Nextcloud, and print php -S process state with the nextcloud.log tail on failure. Signed-off-by: Cursor Agent Co-authored-by: Luis Amorim --- .github/workflows/behat-mariadb.yml | 17 ++++++++++++++++- .github/workflows/behat-mysql.yml | 17 ++++++++++++++++- .github/workflows/behat-pgsql.yml | 17 ++++++++++++++++- .github/workflows/behat-sqlite.yml | 17 ++++++++++++++++- 4 files changed, 64 insertions(+), 4 deletions(-) diff --git a/.github/workflows/behat-mariadb.yml b/.github/workflows/behat-mariadb.yml index 4c7f02dc16..f7aa128695 100644 --- a/.github/workflows/behat-mariadb.yml +++ b/.github/workflows/behat-mariadb.yml @@ -229,6 +229,10 @@ jobs: ./occ config:system:set mail_smtpport --value ${{ matrix.smtp_port }} --type integer ./occ config:system:set ratelimit.protection.enabled --value false --type boolean ./occ config:app:set dav enableDefaultContact --value false --type boolean + # Keep Host header and php -S bind on IPv4; localhost can resolve to ::1 only under Docker/act. + ./occ config:system:set trusted_domains 0 --value=localhost + ./occ config:system:set trusted_domains 1 --value=127.0.0.1 + ./occ config:system:set overwrite.cli.url --value=http://127.0.0.1 - name: Run behat working-directory: apps/${{ env.APP_NAME }}/tests/integration @@ -236,6 +240,8 @@ jobs: BEHAT_ROOT_DIR: ../../../../ # Override PhpBuiltin workers; high PHP_CLI_SERVER_WORKERS correlates with Empty-reply crashes. BEHAT_WORKERS: "2" + # Force IPv4 so php -S bind and Guzzle/cURL agree (avoids localhost → ::1 vs 127.0.0.1 mismatch). + BEHAT_HOST: "127.0.0.1" run: | # act images often lack procps and a runner user; RunServerListener needs both. # FeatureContext also requires the Behat process UID to match BEHAT_RUN_AS / file owner. @@ -251,6 +257,7 @@ jobs: runuser -u runner -- env -u GITHUB_ACTIONS \ BEHAT_RUN_AS=runner \ BEHAT_ROOT_DIR=../../../../ \ + BEHAT_HOST=127.0.0.1 \ BEHAT_WORKERS=2 \ BEHAT_VERBOSE=1 \ HOME=/home/runner \ @@ -258,6 +265,7 @@ jobs: vendor/bin/behat -f junit -f pretty --colors -v ${{ matrix.paths }} else export BEHAT_RUN_AS=runner + export BEHAT_HOST=127.0.0.1 export BEHAT_VERBOSE="$RUNNER_DEBUG" # shellcheck disable=SC2086 vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} @@ -266,7 +274,14 @@ jobs: - name: Print logs if: always() run: | - cat data/nextcloud.log 2>/dev/null || echo "No nextcloud.log yet" + echo "=== php -S processes ===" + ps aux | grep -E '[p]hp -S' || echo "No php -S process" + echo "=== nextcloud.log (tail) ===" + if [ -f data/nextcloud.log ]; then + tail -n 80 data/nextcloud.log + else + echo "No nextcloud.log yet" + fi summary: permissions: diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml index 21557d9092..022e149857 100644 --- a/.github/workflows/behat-mysql.yml +++ b/.github/workflows/behat-mysql.yml @@ -212,6 +212,10 @@ jobs: ./occ config:system:set mail_smtpport --value ${{ matrix.smtp_port }} --type integer ./occ config:system:set ratelimit.protection.enabled --value false --type boolean ./occ config:app:set dav enableDefaultContact --value false --type boolean + # Keep Host header and php -S bind on IPv4; localhost can resolve to ::1 only under Docker/act. + ./occ config:system:set trusted_domains 0 --value=localhost + ./occ config:system:set trusted_domains 1 --value=127.0.0.1 + ./occ config:system:set overwrite.cli.url --value=http://127.0.0.1 - name: Run behat working-directory: apps/${{ env.APP_NAME }}/tests/integration @@ -219,6 +223,8 @@ jobs: BEHAT_ROOT_DIR: ../../../../ # Override PhpBuiltin workers; high PHP_CLI_SERVER_WORKERS correlates with Empty-reply crashes. BEHAT_WORKERS: "2" + # Force IPv4 so php -S bind and Guzzle/cURL agree (avoids localhost → ::1 vs 127.0.0.1 mismatch). + BEHAT_HOST: "127.0.0.1" run: | # act images often lack procps and a runner user; RunServerListener needs both. # FeatureContext also requires the Behat process UID to match BEHAT_RUN_AS / file owner. @@ -234,6 +240,7 @@ jobs: runuser -u runner -- env -u GITHUB_ACTIONS \ BEHAT_RUN_AS=runner \ BEHAT_ROOT_DIR=../../../../ \ + BEHAT_HOST=127.0.0.1 \ BEHAT_WORKERS=2 \ BEHAT_VERBOSE=1 \ HOME=/home/runner \ @@ -241,6 +248,7 @@ jobs: vendor/bin/behat -f junit -f pretty --colors -v ${{ matrix.paths }} else export BEHAT_RUN_AS=runner + export BEHAT_HOST=127.0.0.1 export BEHAT_VERBOSE="$RUNNER_DEBUG" # shellcheck disable=SC2086 vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} @@ -249,7 +257,14 @@ jobs: - name: Print logs if: always() run: | - cat data/nextcloud.log 2>/dev/null || echo "No nextcloud.log yet" + echo "=== php -S processes ===" + ps aux | grep -E '[p]hp -S' || echo "No php -S process" + echo "=== nextcloud.log (tail) ===" + if [ -f data/nextcloud.log ]; then + tail -n 80 data/nextcloud.log + else + echo "No nextcloud.log yet" + fi summary: permissions: diff --git a/.github/workflows/behat-pgsql.yml b/.github/workflows/behat-pgsql.yml index d03099e3f8..80bbfae836 100644 --- a/.github/workflows/behat-pgsql.yml +++ b/.github/workflows/behat-pgsql.yml @@ -206,6 +206,10 @@ jobs: ./occ config:system:set mail_smtpport --value ${{ matrix.smtp_port }} --type integer ./occ config:system:set ratelimit.protection.enabled --value false --type boolean ./occ config:app:set dav enableDefaultContact --value false --type boolean + # Keep Host header and php -S bind on IPv4; localhost can resolve to ::1 only under Docker/act. + ./occ config:system:set trusted_domains 0 --value=localhost + ./occ config:system:set trusted_domains 1 --value=127.0.0.1 + ./occ config:system:set overwrite.cli.url --value=http://127.0.0.1 - name: Run behat working-directory: apps/${{ env.APP_NAME }}/tests/integration @@ -213,6 +217,8 @@ jobs: BEHAT_ROOT_DIR: ../../../../ # Override PhpBuiltin workers; high PHP_CLI_SERVER_WORKERS correlates with Empty-reply crashes. BEHAT_WORKERS: "2" + # Force IPv4 so php -S bind and Guzzle/cURL agree (avoids localhost → ::1 vs 127.0.0.1 mismatch). + BEHAT_HOST: "127.0.0.1" run: | # act images often lack procps and a runner user; RunServerListener needs both. # FeatureContext also requires the Behat process UID to match BEHAT_RUN_AS / file owner. @@ -228,6 +234,7 @@ jobs: runuser -u runner -- env -u GITHUB_ACTIONS \ BEHAT_RUN_AS=runner \ BEHAT_ROOT_DIR=../../../../ \ + BEHAT_HOST=127.0.0.1 \ BEHAT_WORKERS=2 \ BEHAT_VERBOSE=1 \ HOME=/home/runner \ @@ -235,6 +242,7 @@ jobs: vendor/bin/behat -f junit -f pretty --colors -v ${{ matrix.paths }} else export BEHAT_RUN_AS=runner + export BEHAT_HOST=127.0.0.1 export BEHAT_VERBOSE="$RUNNER_DEBUG" # shellcheck disable=SC2086 vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} @@ -243,7 +251,14 @@ jobs: - name: Print logs if: always() run: | - cat data/nextcloud.log 2>/dev/null || echo "No nextcloud.log yet" + echo "=== php -S processes ===" + ps aux | grep -E '[p]hp -S' || echo "No php -S process" + echo "=== nextcloud.log (tail) ===" + if [ -f data/nextcloud.log ]; then + tail -n 80 data/nextcloud.log + else + echo "No nextcloud.log yet" + fi summary: permissions: diff --git a/.github/workflows/behat-sqlite.yml b/.github/workflows/behat-sqlite.yml index 417a2368ba..2623fdb3ea 100644 --- a/.github/workflows/behat-sqlite.yml +++ b/.github/workflows/behat-sqlite.yml @@ -192,6 +192,10 @@ jobs: ./occ config:system:set mail_smtpport --value ${{ matrix.smtp_port }} --type integer ./occ config:system:set ratelimit.protection.enabled --value false --type boolean ./occ config:app:set dav enableDefaultContact --value false --type boolean + # Keep Host header and php -S bind on IPv4; localhost can resolve to ::1 only under Docker/act. + ./occ config:system:set trusted_domains 0 --value=localhost + ./occ config:system:set trusted_domains 1 --value=127.0.0.1 + ./occ config:system:set overwrite.cli.url --value=http://127.0.0.1 - name: Run behat working-directory: apps/${{ env.APP_NAME }}/tests/integration @@ -199,6 +203,8 @@ jobs: BEHAT_ROOT_DIR: ../../../../ # Override PhpBuiltin workers; high PHP_CLI_SERVER_WORKERS correlates with Empty-reply crashes. BEHAT_WORKERS: "2" + # Force IPv4 so php -S bind and Guzzle/cURL agree (avoids localhost → ::1 vs 127.0.0.1 mismatch). + BEHAT_HOST: "127.0.0.1" run: | # act images often lack procps and a runner user; RunServerListener needs both. # FeatureContext also requires the Behat process UID to match BEHAT_RUN_AS / file owner. @@ -214,6 +220,7 @@ jobs: runuser -u runner -- env -u GITHUB_ACTIONS \ BEHAT_RUN_AS=runner \ BEHAT_ROOT_DIR=../../../../ \ + BEHAT_HOST=127.0.0.1 \ BEHAT_WORKERS=2 \ BEHAT_VERBOSE=1 \ HOME=/home/runner \ @@ -221,6 +228,7 @@ jobs: vendor/bin/behat -f junit -f pretty --colors -v ${{ matrix.paths }} else export BEHAT_RUN_AS=runner + export BEHAT_HOST=127.0.0.1 export BEHAT_VERBOSE="$RUNNER_DEBUG" # shellcheck disable=SC2086 vendor/bin/behat -f junit -f pretty --colors ${{ matrix.paths }} @@ -229,7 +237,14 @@ jobs: - name: Print logs if: always() run: | - cat data/nextcloud.log 2>/dev/null || echo "No nextcloud.log yet" + echo "=== php -S processes ===" + ps aux | grep -E '[p]hp -S' || echo "No php -S process" + echo "=== nextcloud.log (tail) ===" + if [ -f data/nextcloud.log ]; then + tail -n 80 data/nextcloud.log + else + echo "No nextcloud.log yet" + fi summary: permissions: From 5af8560d06e0e6bfa6a32b395f8e88b2f99be585 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 24 Sep 2026 12:20:43 +0000 Subject: [PATCH 12/15] ci(behat): set PhpBuiltin workers to 0 for act experiment Single-process php -S (no PHP_CLI_SERVER_WORKERS) to compare Empty-reply behavior under act. Nested same-server HTTP may deadlock with workers 0. Signed-off-by: Cursor Agent Co-authored-by: Luis Amorim --- .github/workflows/behat-mariadb.yml | 6 +++--- .github/workflows/behat-mysql.yml | 6 +++--- .github/workflows/behat-pgsql.yml | 6 +++--- .github/workflows/behat-sqlite.yml | 6 +++--- tests/integration/config/behat.yml | 5 ++--- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/behat-mariadb.yml b/.github/workflows/behat-mariadb.yml index f7aa128695..348ef9bc5d 100644 --- a/.github/workflows/behat-mariadb.yml +++ b/.github/workflows/behat-mariadb.yml @@ -238,8 +238,8 @@ jobs: working-directory: apps/${{ env.APP_NAME }}/tests/integration env: BEHAT_ROOT_DIR: ../../../../ - # Override PhpBuiltin workers; high PHP_CLI_SERVER_WORKERS correlates with Empty-reply crashes. - BEHAT_WORKERS: "2" + # Temporary experiment: single-process php -S (no PHP_CLI_SERVER_WORKERS). + BEHAT_WORKERS: "0" # Force IPv4 so php -S bind and Guzzle/cURL agree (avoids localhost → ::1 vs 127.0.0.1 mismatch). BEHAT_HOST: "127.0.0.1" run: | @@ -258,7 +258,7 @@ jobs: BEHAT_RUN_AS=runner \ BEHAT_ROOT_DIR=../../../../ \ BEHAT_HOST=127.0.0.1 \ - BEHAT_WORKERS=2 \ + BEHAT_WORKERS=0 \ BEHAT_VERBOSE=1 \ HOME=/home/runner \ PATH="$PATH" \ diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml index 022e149857..f10de84552 100644 --- a/.github/workflows/behat-mysql.yml +++ b/.github/workflows/behat-mysql.yml @@ -221,8 +221,8 @@ jobs: working-directory: apps/${{ env.APP_NAME }}/tests/integration env: BEHAT_ROOT_DIR: ../../../../ - # Override PhpBuiltin workers; high PHP_CLI_SERVER_WORKERS correlates with Empty-reply crashes. - BEHAT_WORKERS: "2" + # Temporary experiment: single-process php -S (no PHP_CLI_SERVER_WORKERS). + BEHAT_WORKERS: "0" # Force IPv4 so php -S bind and Guzzle/cURL agree (avoids localhost → ::1 vs 127.0.0.1 mismatch). BEHAT_HOST: "127.0.0.1" run: | @@ -241,7 +241,7 @@ jobs: BEHAT_RUN_AS=runner \ BEHAT_ROOT_DIR=../../../../ \ BEHAT_HOST=127.0.0.1 \ - BEHAT_WORKERS=2 \ + BEHAT_WORKERS=0 \ BEHAT_VERBOSE=1 \ HOME=/home/runner \ PATH="$PATH" \ diff --git a/.github/workflows/behat-pgsql.yml b/.github/workflows/behat-pgsql.yml index 80bbfae836..a85586e353 100644 --- a/.github/workflows/behat-pgsql.yml +++ b/.github/workflows/behat-pgsql.yml @@ -215,8 +215,8 @@ jobs: working-directory: apps/${{ env.APP_NAME }}/tests/integration env: BEHAT_ROOT_DIR: ../../../../ - # Override PhpBuiltin workers; high PHP_CLI_SERVER_WORKERS correlates with Empty-reply crashes. - BEHAT_WORKERS: "2" + # Temporary experiment: single-process php -S (no PHP_CLI_SERVER_WORKERS). + BEHAT_WORKERS: "0" # Force IPv4 so php -S bind and Guzzle/cURL agree (avoids localhost → ::1 vs 127.0.0.1 mismatch). BEHAT_HOST: "127.0.0.1" run: | @@ -235,7 +235,7 @@ jobs: BEHAT_RUN_AS=runner \ BEHAT_ROOT_DIR=../../../../ \ BEHAT_HOST=127.0.0.1 \ - BEHAT_WORKERS=2 \ + BEHAT_WORKERS=0 \ BEHAT_VERBOSE=1 \ HOME=/home/runner \ PATH="$PATH" \ diff --git a/.github/workflows/behat-sqlite.yml b/.github/workflows/behat-sqlite.yml index 2623fdb3ea..e8df309993 100644 --- a/.github/workflows/behat-sqlite.yml +++ b/.github/workflows/behat-sqlite.yml @@ -201,8 +201,8 @@ jobs: working-directory: apps/${{ env.APP_NAME }}/tests/integration env: BEHAT_ROOT_DIR: ../../../../ - # Override PhpBuiltin workers; high PHP_CLI_SERVER_WORKERS correlates with Empty-reply crashes. - BEHAT_WORKERS: "2" + # Temporary experiment: single-process php -S (no PHP_CLI_SERVER_WORKERS). + BEHAT_WORKERS: "0" # Force IPv4 so php -S bind and Guzzle/cURL agree (avoids localhost → ::1 vs 127.0.0.1 mismatch). BEHAT_HOST: "127.0.0.1" run: | @@ -221,7 +221,7 @@ jobs: BEHAT_RUN_AS=runner \ BEHAT_ROOT_DIR=../../../../ \ BEHAT_HOST=127.0.0.1 \ - BEHAT_WORKERS=2 \ + BEHAT_WORKERS=0 \ BEHAT_VERBOSE=1 \ HOME=/home/runner \ PATH="$PATH" \ diff --git a/tests/integration/config/behat.yml b/tests/integration/config/behat.yml index 0dd59d88db..a7ae5e8b96 100644 --- a/tests/integration/config/behat.yml +++ b/tests/integration/config/behat.yml @@ -16,9 +16,8 @@ default: base_url: http://mailpit:8025 PhpBuiltin\Server: runAs: www-data - # Keep >=2 so nested same-server HTTP (e.g. develop/pdf) cannot deadlock. - # Cap low: PHP_CLI_SERVER_WORKERS is experimental and high values amplify Empty-reply flakes. - workers: 2 + # Temporary experiment: workers 0 (single-process php -S). Nested same-server HTTP may deadlock. + workers: 0 jarnaiz\JUnitFormatter\JUnitFormatterExtension: filename: report.xml outputDir: '%paths.base%/../output/' From 49c7446c84650b046f77d56925a60c9dc2d8405b Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 24 Sep 2026 13:09:11 +0000 Subject: [PATCH 13/15] ci(behat): serve Nextcloud with FrankenPHP instead of php -S PhpBuiltin\RunServerListener still spawns via `php -S`, but the Behat job prepends a PATH wrapper that runs FrankenPHP php-server on the same listen address. CLI php (occ, behat) keeps using setup-php. Avoids the experimental PHP_CLI_SERVER_WORKERS built-in server in CI/act only. Signed-off-by: Cursor Agent Co-authored-by: Luis Amorim --- .github/workflows/behat-mariadb.yml | 13 +-- .github/workflows/behat-mysql.yml | 13 +-- .github/workflows/behat-pgsql.yml | 13 +-- .github/workflows/behat-sqlite.yml | 13 +-- .../bin/ci-setup-frankenphp-behat-server.sh | 80 +++++++++++++++++++ 5 files changed, 112 insertions(+), 20 deletions(-) create mode 100755 tests/integration/bin/ci-setup-frankenphp-behat-server.sh diff --git a/.github/workflows/behat-mariadb.yml b/.github/workflows/behat-mariadb.yml index 348ef9bc5d..e1786f8ca4 100644 --- a/.github/workflows/behat-mariadb.yml +++ b/.github/workflows/behat-mariadb.yml @@ -238,11 +238,14 @@ jobs: working-directory: apps/${{ env.APP_NAME }}/tests/integration env: BEHAT_ROOT_DIR: ../../../../ - # Temporary experiment: single-process php -S (no PHP_CLI_SERVER_WORKERS). BEHAT_WORKERS: "0" - # Force IPv4 so php -S bind and Guzzle/cURL agree (avoids localhost → ::1 vs 127.0.0.1 mismatch). + # Force IPv4 so server bind and Guzzle/cURL agree (avoids localhost → ::1 mismatch). BEHAT_HOST: "127.0.0.1" run: | + # Replace PhpBuiltin's php -S with FrankenPHP for this Behat job only. + WRAP_BIN="$(./bin/ci-setup-frankenphp-behat-server.sh)" + export PATH="$WRAP_BIN:$PATH" + hash -r 2>/dev/null || true # act images often lack procps and a runner user; RunServerListener needs both. # FeatureContext also requires the Behat process UID to match BEHAT_RUN_AS / file owner. if [ "${ACT}" = "true" ]; then @@ -252,7 +255,7 @@ jobs: # Under act (host networking) Mailpit is published on matrix.mail_ui_port, not :8025. sed -i.bak "s|base_url: http://mailpit:8025|base_url: http://127.0.0.1:${{ matrix.mail_ui_port }}|" config/behat.yml # shellcheck disable=SC2086 - # Drop GITHUB_ACTIONS so RunServerListener does not wrap php -S in sudo + # Drop GITHUB_ACTIONS so RunServerListener does not wrap the server start in sudo # (behat already runs as runner; act's runner user has no passwordless sudo). runuser -u runner -- env -u GITHUB_ACTIONS \ BEHAT_RUN_AS=runner \ @@ -274,8 +277,8 @@ jobs: - name: Print logs if: always() run: | - echo "=== php -S processes ===" - ps aux | grep -E '[p]hp -S' || echo "No php -S process" + echo "=== Behat web server processes ===" + ps aux | grep -E '[p]hp -S|[f]rankenphp' || echo "No Behat web server process" echo "=== nextcloud.log (tail) ===" if [ -f data/nextcloud.log ]; then tail -n 80 data/nextcloud.log diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml index f10de84552..b6bd80b7d1 100644 --- a/.github/workflows/behat-mysql.yml +++ b/.github/workflows/behat-mysql.yml @@ -221,11 +221,14 @@ jobs: working-directory: apps/${{ env.APP_NAME }}/tests/integration env: BEHAT_ROOT_DIR: ../../../../ - # Temporary experiment: single-process php -S (no PHP_CLI_SERVER_WORKERS). BEHAT_WORKERS: "0" - # Force IPv4 so php -S bind and Guzzle/cURL agree (avoids localhost → ::1 vs 127.0.0.1 mismatch). + # Force IPv4 so server bind and Guzzle/cURL agree (avoids localhost → ::1 mismatch). BEHAT_HOST: "127.0.0.1" run: | + # Replace PhpBuiltin's php -S with FrankenPHP for this Behat job only. + WRAP_BIN="$(./bin/ci-setup-frankenphp-behat-server.sh)" + export PATH="$WRAP_BIN:$PATH" + hash -r 2>/dev/null || true # act images often lack procps and a runner user; RunServerListener needs both. # FeatureContext also requires the Behat process UID to match BEHAT_RUN_AS / file owner. if [ "${ACT}" = "true" ]; then @@ -235,7 +238,7 @@ jobs: # Under act (host networking) Mailpit is published on matrix.mail_ui_port, not :8025. sed -i.bak "s|base_url: http://mailpit:8025|base_url: http://127.0.0.1:${{ matrix.mail_ui_port }}|" config/behat.yml # shellcheck disable=SC2086 - # Drop GITHUB_ACTIONS so RunServerListener does not wrap php -S in sudo + # Drop GITHUB_ACTIONS so RunServerListener does not wrap the server start in sudo # (behat already runs as runner; act's runner user has no passwordless sudo). runuser -u runner -- env -u GITHUB_ACTIONS \ BEHAT_RUN_AS=runner \ @@ -257,8 +260,8 @@ jobs: - name: Print logs if: always() run: | - echo "=== php -S processes ===" - ps aux | grep -E '[p]hp -S' || echo "No php -S process" + echo "=== Behat web server processes ===" + ps aux | grep -E '[p]hp -S|[f]rankenphp' || echo "No Behat web server process" echo "=== nextcloud.log (tail) ===" if [ -f data/nextcloud.log ]; then tail -n 80 data/nextcloud.log diff --git a/.github/workflows/behat-pgsql.yml b/.github/workflows/behat-pgsql.yml index a85586e353..cd9027feee 100644 --- a/.github/workflows/behat-pgsql.yml +++ b/.github/workflows/behat-pgsql.yml @@ -215,11 +215,14 @@ jobs: working-directory: apps/${{ env.APP_NAME }}/tests/integration env: BEHAT_ROOT_DIR: ../../../../ - # Temporary experiment: single-process php -S (no PHP_CLI_SERVER_WORKERS). BEHAT_WORKERS: "0" - # Force IPv4 so php -S bind and Guzzle/cURL agree (avoids localhost → ::1 vs 127.0.0.1 mismatch). + # Force IPv4 so server bind and Guzzle/cURL agree (avoids localhost → ::1 mismatch). BEHAT_HOST: "127.0.0.1" run: | + # Replace PhpBuiltin's php -S with FrankenPHP for this Behat job only. + WRAP_BIN="$(./bin/ci-setup-frankenphp-behat-server.sh)" + export PATH="$WRAP_BIN:$PATH" + hash -r 2>/dev/null || true # act images often lack procps and a runner user; RunServerListener needs both. # FeatureContext also requires the Behat process UID to match BEHAT_RUN_AS / file owner. if [ "${ACT}" = "true" ]; then @@ -229,7 +232,7 @@ jobs: # Under act (host networking) Mailpit is published on matrix.mail_ui_port, not :8025. sed -i.bak "s|base_url: http://mailpit:8025|base_url: http://127.0.0.1:${{ matrix.mail_ui_port }}|" config/behat.yml # shellcheck disable=SC2086 - # Drop GITHUB_ACTIONS so RunServerListener does not wrap php -S in sudo + # Drop GITHUB_ACTIONS so RunServerListener does not wrap the server start in sudo # (behat already runs as runner; act's runner user has no passwordless sudo). runuser -u runner -- env -u GITHUB_ACTIONS \ BEHAT_RUN_AS=runner \ @@ -251,8 +254,8 @@ jobs: - name: Print logs if: always() run: | - echo "=== php -S processes ===" - ps aux | grep -E '[p]hp -S' || echo "No php -S process" + echo "=== Behat web server processes ===" + ps aux | grep -E '[p]hp -S|[f]rankenphp' || echo "No Behat web server process" echo "=== nextcloud.log (tail) ===" if [ -f data/nextcloud.log ]; then tail -n 80 data/nextcloud.log diff --git a/.github/workflows/behat-sqlite.yml b/.github/workflows/behat-sqlite.yml index e8df309993..f5a75e0efa 100644 --- a/.github/workflows/behat-sqlite.yml +++ b/.github/workflows/behat-sqlite.yml @@ -201,11 +201,14 @@ jobs: working-directory: apps/${{ env.APP_NAME }}/tests/integration env: BEHAT_ROOT_DIR: ../../../../ - # Temporary experiment: single-process php -S (no PHP_CLI_SERVER_WORKERS). BEHAT_WORKERS: "0" - # Force IPv4 so php -S bind and Guzzle/cURL agree (avoids localhost → ::1 vs 127.0.0.1 mismatch). + # Force IPv4 so server bind and Guzzle/cURL agree (avoids localhost → ::1 mismatch). BEHAT_HOST: "127.0.0.1" run: | + # Replace PhpBuiltin's php -S with FrankenPHP for this Behat job only. + WRAP_BIN="$(./bin/ci-setup-frankenphp-behat-server.sh)" + export PATH="$WRAP_BIN:$PATH" + hash -r 2>/dev/null || true # act images often lack procps and a runner user; RunServerListener needs both. # FeatureContext also requires the Behat process UID to match BEHAT_RUN_AS / file owner. if [ "${ACT}" = "true" ]; then @@ -215,7 +218,7 @@ jobs: # Under act (host networking) Mailpit is published on matrix.mail_ui_port, not :8025. sed -i.bak "s|base_url: http://mailpit:8025|base_url: http://127.0.0.1:${{ matrix.mail_ui_port }}|" config/behat.yml # shellcheck disable=SC2086 - # Drop GITHUB_ACTIONS so RunServerListener does not wrap php -S in sudo + # Drop GITHUB_ACTIONS so RunServerListener does not wrap the server start in sudo # (behat already runs as runner; act's runner user has no passwordless sudo). runuser -u runner -- env -u GITHUB_ACTIONS \ BEHAT_RUN_AS=runner \ @@ -237,8 +240,8 @@ jobs: - name: Print logs if: always() run: | - echo "=== php -S processes ===" - ps aux | grep -E '[p]hp -S' || echo "No php -S process" + echo "=== Behat web server processes ===" + ps aux | grep -E '[p]hp -S|[f]rankenphp' || echo "No Behat web server process" echo "=== nextcloud.log (tail) ===" if [ -f data/nextcloud.log ]; then tail -n 80 data/nextcloud.log diff --git a/tests/integration/bin/ci-setup-frankenphp-behat-server.sh b/tests/integration/bin/ci-setup-frankenphp-behat-server.sh new file mode 100755 index 0000000000..d42f94590d --- /dev/null +++ b/tests/integration/bin/ci-setup-frankenphp-behat-server.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash +# SPDX-FileCopyrightText: 2026 LibreCode coop and contributors +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# Install FrankenPHP and put a `php` wrapper earlier on PATH so PhpBuiltin\RunServerListener's +# `php -S` invocation becomes FrankenPHP instead of the experimental built-in server. +# Prints the wrapper bin directory (prepend to PATH). Safe to re-run. +set -euo pipefail + +DEST="${FRANKENPHP_DIR:-/tmp/libresign-frankenphp-behat}" +mkdir -p "$DEST/bin" + +ARCH="$(uname -m)" +case "$ARCH" in + x86_64|amd64) ASSET="frankenphp-linux-x86_64" ;; + aarch64|arm64) ASSET="frankenphp-linux-aarch64" ;; + *) + echo "ci-setup-frankenphp-behat-server: unsupported architecture: $ARCH" >&2 + exit 1 + ;; +esac + +VER="${FRANKENPHP_VERSION:-1.12.7}" +if [[ ! -x "$DEST/frankenphp" ]]; then + echo "Downloading FrankenPHP v${VER} (${ASSET})..." >&2 + curl -fsSL -o "$DEST/frankenphp" \ + "https://github.com/php/frankenphp/releases/download/v${VER}/${ASSET}" + chmod +x "$DEST/frankenphp" +fi + +REAL_PHP="$(command -v php)" +if [[ -z "$REAL_PHP" ]]; then + echo "ci-setup-frankenphp-behat-server: php not found on PATH" >&2 + exit 1 +fi +ln -sfn "$REAL_PHP" "$DEST/bin/php.real" + +cat >"$DEST/bin/php" <<'WRAP' +#!/usr/bin/env bash +# SPDX-FileCopyrightText: 2026 LibreCode coop and contributors +# SPDX-License-Identifier: AGPL-3.0-or-later +set -euo pipefail +if [[ "${1:-}" == "-S" ]]; then + LISTEN="${2:?php -S requires host:port}" + ROOT="." + shift 2 + while [[ $# -gt 0 ]]; do + case "$1" in + -t) + ROOT="${2:?}" + shift 2 + ;; + *) + shift + ;; + esac + done + # escapeshellarg may quote the document root + ROOT="${ROOT#\'}" + ROOT="${ROOT%\'}" + FRANKENPHP="$(cd "$(dirname "$0")/.." && pwd)/frankenphp" + # Keep argv0 looking like php -S so RunServerListener killZombies can find leftovers. + exec -a "php -S ${LISTEN}" "$FRANKENPHP" php-server --listen="$LISTEN" --root="$ROOT" +fi +exec "$(dirname "$0")/php.real" "$@" +WRAP +chmod +x "$DEST/bin/php" + +# Also match frankenphp in killZombies (idempotent). +LISTENER="" +if [[ -f vendor/libresign/behat-builtin-extension/src/RunServerListener.php ]]; then + LISTENER="vendor/libresign/behat-builtin-extension/src/RunServerListener.php" +elif [[ -f vendor/phpbuiltin/server/src/RunServerListener.php ]]; then + LISTENER="vendor/phpbuiltin/server/src/RunServerListener.php" +fi +if [[ -n "$LISTENER" ]] && grep -q 'grep "php -S ' "$LISTENER"; then + sed -i.bak 's/grep "php -S /grep -E "php -S|frankenphp php-server /' "$LISTENER" +fi + +echo "$DEST/bin" From bd4a3ebc2bf69df78f632c5905aab6d5a8dddaab Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 24 Sep 2026 13:52:23 +0000 Subject: [PATCH 14/15] ci(behat): fix Mailpit SMTP for act vs GHA networking FrankenPHP moved failures past request-signature onto inbox assertions. Under act (host network) Nextcloud must send SMTP to 127.0.0.1 on the published host port; GHA still uses mailpit:1025. Also set mail_smtpmode and preflight Mailpit API/SMTP before Behat under act. Signed-off-by: Cursor Agent Co-authored-by: Luis Amorim --- .github/workflows/behat-mariadb.yml | 27 ++++++++++++++++++++++++--- .github/workflows/behat-mysql.yml | 27 ++++++++++++++++++++++++--- .github/workflows/behat-pgsql.yml | 27 ++++++++++++++++++++++++--- .github/workflows/behat-sqlite.yml | 27 ++++++++++++++++++++++++--- 4 files changed, 96 insertions(+), 12 deletions(-) diff --git a/.github/workflows/behat-mariadb.yml b/.github/workflows/behat-mariadb.yml index e1786f8ca4..7edc2fc802 100644 --- a/.github/workflows/behat-mariadb.yml +++ b/.github/workflows/behat-mariadb.yml @@ -225,11 +225,22 @@ jobs: ./occ app:enable --force guests ./occ config:system:set allow_local_remote_servers --value true --type boolean ./occ config:system:set auth.bruteforce.protection.enabled --value false --type boolean - ./occ config:system:set mail_smtphost --value mailpit - ./occ config:system:set mail_smtpport --value ${{ matrix.smtp_port }} --type integer + # SMTP: GHA reaches the service on container port 1025; act (host network) uses the published host port. + ./occ config:system:set mail_smtpmode --value smtp + ./occ config:system:set mail_sendmailmode --value smtp + ./occ config:system:set mail_smtpauth --value false --type boolean + ./occ config:system:set mail_from_address --value noreply + ./occ config:system:set mail_domain --value example.com + if [ "${ACT}" = "true" ]; then + ./occ config:system:set mail_smtphost --value 127.0.0.1 + ./occ config:system:set mail_smtpport --value ${{ matrix.smtp_port }} --type integer + else + ./occ config:system:set mail_smtphost --value mailpit + ./occ config:system:set mail_smtpport --value 1025 --type integer + fi ./occ config:system:set ratelimit.protection.enabled --value false --type boolean ./occ config:app:set dav enableDefaultContact --value false --type boolean - # Keep Host header and php -S bind on IPv4; localhost can resolve to ::1 only under Docker/act. + # Keep Host header and server bind on IPv4; localhost can resolve to ::1 only under Docker/act. ./occ config:system:set trusted_domains 0 --value=localhost ./occ config:system:set trusted_domains 1 --value=127.0.0.1 ./occ config:system:set overwrite.cli.url --value=http://127.0.0.1 @@ -254,6 +265,16 @@ jobs: chown -R runner:runner "$NC_ROOT" # Under act (host networking) Mailpit is published on matrix.mail_ui_port, not :8025. sed -i.bak "s|base_url: http://mailpit:8025|base_url: http://127.0.0.1:${{ matrix.mail_ui_port }}|" config/behat.yml + echo "Mailpit API preflight:" + curl -fsS "http://127.0.0.1:${{ matrix.mail_ui_port }}/api/v1/info" || { + echo "Mailpit UI not reachable on 127.0.0.1:${{ matrix.mail_ui_port }}" + exit 1 + } + echo "Mailpit SMTP preflight:" + timeout 3 bash -c "echo >/dev/tcp/127.0.0.1/${{ matrix.smtp_port }}" || { + echo "Mailpit SMTP not reachable on 127.0.0.1:${{ matrix.smtp_port }}" + exit 1 + } # shellcheck disable=SC2086 # Drop GITHUB_ACTIONS so RunServerListener does not wrap the server start in sudo # (behat already runs as runner; act's runner user has no passwordless sudo). diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml index b6bd80b7d1..0576292f95 100644 --- a/.github/workflows/behat-mysql.yml +++ b/.github/workflows/behat-mysql.yml @@ -208,11 +208,22 @@ jobs: ./occ app:enable --force guests ./occ config:system:set allow_local_remote_servers --value true --type boolean ./occ config:system:set auth.bruteforce.protection.enabled --value false --type boolean - ./occ config:system:set mail_smtphost --value mailpit - ./occ config:system:set mail_smtpport --value ${{ matrix.smtp_port }} --type integer + # SMTP: GHA reaches the service on container port 1025; act (host network) uses the published host port. + ./occ config:system:set mail_smtpmode --value smtp + ./occ config:system:set mail_sendmailmode --value smtp + ./occ config:system:set mail_smtpauth --value false --type boolean + ./occ config:system:set mail_from_address --value noreply + ./occ config:system:set mail_domain --value example.com + if [ "${ACT}" = "true" ]; then + ./occ config:system:set mail_smtphost --value 127.0.0.1 + ./occ config:system:set mail_smtpport --value ${{ matrix.smtp_port }} --type integer + else + ./occ config:system:set mail_smtphost --value mailpit + ./occ config:system:set mail_smtpport --value 1025 --type integer + fi ./occ config:system:set ratelimit.protection.enabled --value false --type boolean ./occ config:app:set dav enableDefaultContact --value false --type boolean - # Keep Host header and php -S bind on IPv4; localhost can resolve to ::1 only under Docker/act. + # Keep Host header and server bind on IPv4; localhost can resolve to ::1 only under Docker/act. ./occ config:system:set trusted_domains 0 --value=localhost ./occ config:system:set trusted_domains 1 --value=127.0.0.1 ./occ config:system:set overwrite.cli.url --value=http://127.0.0.1 @@ -237,6 +248,16 @@ jobs: chown -R runner:runner "$NC_ROOT" # Under act (host networking) Mailpit is published on matrix.mail_ui_port, not :8025. sed -i.bak "s|base_url: http://mailpit:8025|base_url: http://127.0.0.1:${{ matrix.mail_ui_port }}|" config/behat.yml + echo "Mailpit API preflight:" + curl -fsS "http://127.0.0.1:${{ matrix.mail_ui_port }}/api/v1/info" || { + echo "Mailpit UI not reachable on 127.0.0.1:${{ matrix.mail_ui_port }}" + exit 1 + } + echo "Mailpit SMTP preflight:" + timeout 3 bash -c "echo >/dev/tcp/127.0.0.1/${{ matrix.smtp_port }}" || { + echo "Mailpit SMTP not reachable on 127.0.0.1:${{ matrix.smtp_port }}" + exit 1 + } # shellcheck disable=SC2086 # Drop GITHUB_ACTIONS so RunServerListener does not wrap the server start in sudo # (behat already runs as runner; act's runner user has no passwordless sudo). diff --git a/.github/workflows/behat-pgsql.yml b/.github/workflows/behat-pgsql.yml index cd9027feee..bd3cdde671 100644 --- a/.github/workflows/behat-pgsql.yml +++ b/.github/workflows/behat-pgsql.yml @@ -202,11 +202,22 @@ jobs: ./occ app:enable --force guests ./occ config:system:set allow_local_remote_servers --value true --type boolean ./occ config:system:set auth.bruteforce.protection.enabled --value false --type boolean - ./occ config:system:set mail_smtphost --value mailpit - ./occ config:system:set mail_smtpport --value ${{ matrix.smtp_port }} --type integer + # SMTP: GHA reaches the service on container port 1025; act (host network) uses the published host port. + ./occ config:system:set mail_smtpmode --value smtp + ./occ config:system:set mail_sendmailmode --value smtp + ./occ config:system:set mail_smtpauth --value false --type boolean + ./occ config:system:set mail_from_address --value noreply + ./occ config:system:set mail_domain --value example.com + if [ "${ACT}" = "true" ]; then + ./occ config:system:set mail_smtphost --value 127.0.0.1 + ./occ config:system:set mail_smtpport --value ${{ matrix.smtp_port }} --type integer + else + ./occ config:system:set mail_smtphost --value mailpit + ./occ config:system:set mail_smtpport --value 1025 --type integer + fi ./occ config:system:set ratelimit.protection.enabled --value false --type boolean ./occ config:app:set dav enableDefaultContact --value false --type boolean - # Keep Host header and php -S bind on IPv4; localhost can resolve to ::1 only under Docker/act. + # Keep Host header and server bind on IPv4; localhost can resolve to ::1 only under Docker/act. ./occ config:system:set trusted_domains 0 --value=localhost ./occ config:system:set trusted_domains 1 --value=127.0.0.1 ./occ config:system:set overwrite.cli.url --value=http://127.0.0.1 @@ -231,6 +242,16 @@ jobs: chown -R runner:runner "$NC_ROOT" # Under act (host networking) Mailpit is published on matrix.mail_ui_port, not :8025. sed -i.bak "s|base_url: http://mailpit:8025|base_url: http://127.0.0.1:${{ matrix.mail_ui_port }}|" config/behat.yml + echo "Mailpit API preflight:" + curl -fsS "http://127.0.0.1:${{ matrix.mail_ui_port }}/api/v1/info" || { + echo "Mailpit UI not reachable on 127.0.0.1:${{ matrix.mail_ui_port }}" + exit 1 + } + echo "Mailpit SMTP preflight:" + timeout 3 bash -c "echo >/dev/tcp/127.0.0.1/${{ matrix.smtp_port }}" || { + echo "Mailpit SMTP not reachable on 127.0.0.1:${{ matrix.smtp_port }}" + exit 1 + } # shellcheck disable=SC2086 # Drop GITHUB_ACTIONS so RunServerListener does not wrap the server start in sudo # (behat already runs as runner; act's runner user has no passwordless sudo). diff --git a/.github/workflows/behat-sqlite.yml b/.github/workflows/behat-sqlite.yml index f5a75e0efa..02f5bafec1 100644 --- a/.github/workflows/behat-sqlite.yml +++ b/.github/workflows/behat-sqlite.yml @@ -188,11 +188,22 @@ jobs: ./occ app:enable --force guests ./occ config:system:set allow_local_remote_servers --value true --type boolean ./occ config:system:set auth.bruteforce.protection.enabled --value false --type boolean - ./occ config:system:set mail_smtphost --value mailpit - ./occ config:system:set mail_smtpport --value ${{ matrix.smtp_port }} --type integer + # SMTP: GHA reaches the service on container port 1025; act (host network) uses the published host port. + ./occ config:system:set mail_smtpmode --value smtp + ./occ config:system:set mail_sendmailmode --value smtp + ./occ config:system:set mail_smtpauth --value false --type boolean + ./occ config:system:set mail_from_address --value noreply + ./occ config:system:set mail_domain --value example.com + if [ "${ACT}" = "true" ]; then + ./occ config:system:set mail_smtphost --value 127.0.0.1 + ./occ config:system:set mail_smtpport --value ${{ matrix.smtp_port }} --type integer + else + ./occ config:system:set mail_smtphost --value mailpit + ./occ config:system:set mail_smtpport --value 1025 --type integer + fi ./occ config:system:set ratelimit.protection.enabled --value false --type boolean ./occ config:app:set dav enableDefaultContact --value false --type boolean - # Keep Host header and php -S bind on IPv4; localhost can resolve to ::1 only under Docker/act. + # Keep Host header and server bind on IPv4; localhost can resolve to ::1 only under Docker/act. ./occ config:system:set trusted_domains 0 --value=localhost ./occ config:system:set trusted_domains 1 --value=127.0.0.1 ./occ config:system:set overwrite.cli.url --value=http://127.0.0.1 @@ -217,6 +228,16 @@ jobs: chown -R runner:runner "$NC_ROOT" # Under act (host networking) Mailpit is published on matrix.mail_ui_port, not :8025. sed -i.bak "s|base_url: http://mailpit:8025|base_url: http://127.0.0.1:${{ matrix.mail_ui_port }}|" config/behat.yml + echo "Mailpit API preflight:" + curl -fsS "http://127.0.0.1:${{ matrix.mail_ui_port }}/api/v1/info" || { + echo "Mailpit UI not reachable on 127.0.0.1:${{ matrix.mail_ui_port }}" + exit 1 + } + echo "Mailpit SMTP preflight:" + timeout 3 bash -c "echo >/dev/tcp/127.0.0.1/${{ matrix.smtp_port }}" || { + echo "Mailpit SMTP not reachable on 127.0.0.1:${{ matrix.smtp_port }}" + exit 1 + } # shellcheck disable=SC2086 # Drop GITHUB_ACTIONS so RunServerListener does not wrap the server start in sudo # (behat already runs as runner; act's runner user has no passwordless sudo). From 16107a51de372bc3ed2441d45abbf414c69f5638 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 24 Sep 2026 20:06:49 +0000 Subject: [PATCH 15/15] ci(behat): retry apt-get update on Ubuntu mirror sync races act hits transient archive.ubuntu.com hash mismatches mid-mirror-sync. Retry apt-get update up to 5 times before installing poppler/procps, and make Print logs tolerate missing ps when that step never ran. Signed-off-by: Cursor Agent Co-authored-by: Luis Amorim --- .github/workflows/behat-mariadb.yml | 20 ++++++++++++++++++-- .github/workflows/behat-mysql.yml | 20 ++++++++++++++++++-- .github/workflows/behat-pgsql.yml | 20 ++++++++++++++++++-- .github/workflows/behat-sqlite.yml | 20 ++++++++++++++++++-- 4 files changed, 72 insertions(+), 8 deletions(-) diff --git a/.github/workflows/behat-mariadb.yml b/.github/workflows/behat-mariadb.yml index 7edc2fc802..cbafac80c9 100644 --- a/.github/workflows/behat-mariadb.yml +++ b/.github/workflows/behat-mariadb.yml @@ -140,7 +140,19 @@ jobs: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - name: Install system dependencies - run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils procps + run: | + # Ubuntu mirrors occasionally mid-sync under act ("unexpected size"); retry a few times. + for attempt in 1 2 3 4 5; do + if sudo apt-get update; then + break + fi + echo "apt-get update failed (attempt ${attempt}/5); waiting before retry..." + sleep $((attempt * 5)) + if [ "$attempt" -eq 5 ]; then + exit 1 + fi + done + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils procps - name: Checkout server uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -299,7 +311,11 @@ jobs: if: always() run: | echo "=== Behat web server processes ===" - ps aux | grep -E '[p]hp -S|[f]rankenphp' || echo "No Behat web server process" + if command -v ps >/dev/null 2>&1; then + ps aux | grep -E '[p]hp -S|[f]rankenphp' || echo "No Behat web server process" + else + echo "ps not installed (Install system dependencies may have failed earlier)" + fi echo "=== nextcloud.log (tail) ===" if [ -f data/nextcloud.log ]; then tail -n 80 data/nextcloud.log diff --git a/.github/workflows/behat-mysql.yml b/.github/workflows/behat-mysql.yml index 0576292f95..77becd4cd8 100644 --- a/.github/workflows/behat-mysql.yml +++ b/.github/workflows/behat-mysql.yml @@ -115,7 +115,19 @@ jobs: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - name: Install system dependencies - run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils procps + run: | + # Ubuntu mirrors occasionally mid-sync under act ("unexpected size"); retry a few times. + for attempt in 1 2 3 4 5; do + if sudo apt-get update; then + break + fi + echo "apt-get update failed (attempt ${attempt}/5); waiting before retry..." + sleep $((attempt * 5)) + if [ "$attempt" -eq 5 ]; then + exit 1 + fi + done + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils procps - name: Checkout server uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -282,7 +294,11 @@ jobs: if: always() run: | echo "=== Behat web server processes ===" - ps aux | grep -E '[p]hp -S|[f]rankenphp' || echo "No Behat web server process" + if command -v ps >/dev/null 2>&1; then + ps aux | grep -E '[p]hp -S|[f]rankenphp' || echo "No Behat web server process" + else + echo "ps not installed (Install system dependencies may have failed earlier)" + fi echo "=== nextcloud.log (tail) ===" if [ -f data/nextcloud.log ]; then tail -n 80 data/nextcloud.log diff --git a/.github/workflows/behat-pgsql.yml b/.github/workflows/behat-pgsql.yml index bd3cdde671..f912845329 100644 --- a/.github/workflows/behat-pgsql.yml +++ b/.github/workflows/behat-pgsql.yml @@ -114,7 +114,19 @@ jobs: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - name: Install system dependencies - run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils procps + run: | + # Ubuntu mirrors occasionally mid-sync under act ("unexpected size"); retry a few times. + for attempt in 1 2 3 4 5; do + if sudo apt-get update; then + break + fi + echo "apt-get update failed (attempt ${attempt}/5); waiting before retry..." + sleep $((attempt * 5)) + if [ "$attempt" -eq 5 ]; then + exit 1 + fi + done + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils procps - name: Checkout server uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -276,7 +288,11 @@ jobs: if: always() run: | echo "=== Behat web server processes ===" - ps aux | grep -E '[p]hp -S|[f]rankenphp' || echo "No Behat web server process" + if command -v ps >/dev/null 2>&1; then + ps aux | grep -E '[p]hp -S|[f]rankenphp' || echo "No Behat web server process" + else + echo "ps not installed (Install system dependencies may have failed earlier)" + fi echo "=== nextcloud.log (tail) ===" if [ -f data/nextcloud.log ]; then tail -n 80 data/nextcloud.log diff --git a/.github/workflows/behat-sqlite.yml b/.github/workflows/behat-sqlite.yml index 02f5bafec1..ba353e399a 100644 --- a/.github/workflows/behat-sqlite.yml +++ b/.github/workflows/behat-sqlite.yml @@ -100,7 +100,19 @@ jobs: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - name: Install system dependencies - run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils procps + run: | + # Ubuntu mirrors occasionally mid-sync under act ("unexpected size"); retry a few times. + for attempt in 1 2 3 4 5; do + if sudo apt-get update; then + break + fi + echo "apt-get update failed (attempt ${attempt}/5); waiting before retry..." + sleep $((attempt * 5)) + if [ "$attempt" -eq 5 ]; then + exit 1 + fi + done + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y poppler-utils procps - name: Checkout server uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -262,7 +274,11 @@ jobs: if: always() run: | echo "=== Behat web server processes ===" - ps aux | grep -E '[p]hp -S|[f]rankenphp' || echo "No Behat web server process" + if command -v ps >/dev/null 2>&1; then + ps aux | grep -E '[p]hp -S|[f]rankenphp' || echo "No Behat web server process" + else + echo "ps not installed (Install system dependencies may have failed earlier)" + fi echo "=== nextcloud.log (tail) ===" if [ -f data/nextcloud.log ]; then tail -n 80 data/nextcloud.log