Skip to content

Commit

Permalink
fixing github actions steps and configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Apr 14, 2026
1 parent 0177adc commit 91f78f8
Showing 1 changed file with 80 additions and 55 deletions.
135 changes: 80 additions & 55 deletions .github/workflows/registry-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,15 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["8.3"]
php: ["8.3", "8.4"]
db_engine: ["postgres", "mysql", "mariadb"]

env:
COMANAGE_REGISTRY_DIR: /srv/comanage-registry

# Values used by your PHPUnit setup test
COMANAGE_REGISTRY_ADMIN_GIVEN_NAME: Admin
COMANAGE_REGISTRY_ADMIN_FAMILY_NAME: User
COMANAGE_REGISTRY_ADMIN_USERNAME: admin
COMANAGE_REGISTRY_SECURITY_SALT: phpunit-security-salt

# Values used by tests/bootstrap.php to create containers (host/port are set dynamically after start)
COMANAGE_REGISTRY_DATABASE: registry_test
COMANAGE_REGISTRY_DATABASE_USER: test_user
COMANAGE_REGISTRY_DATABASE_USER_PASSWORD: test_password
Expand All @@ -37,69 +33,81 @@ jobs:
run: |
cat /etc/os-release
uname -a
docker --version
- name: Checkout (only for workflow files)
- name: Upgrade Docker Engine
shell: bash
run: |
set -euxo pipefail
git clone \
--depth=1 \
--branch "${GITHUB_REF_NAME}" \
"${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" \
"${COMANAGE_REGISTRY_DIR}"
# Amazon Linux 2 ships with an older Docker via amazon-linux-extras
# Install latest Docker CE from the official Docker repo for CentOS/RHEL
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install -y --allowerasing docker-ce docker-ce-cli containerd.io
sudo systemctl start docker || true
docker --version
- name: Install PHP ${{ matrix.php }} and extensions
shell: bash
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
software-properties-common ca-certificates gnupg
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update
PHP_VER="${{ matrix.php }}"
sudo apt-get install -y --no-install-recommends \
php${PHP_VER}-cli \
php${PHP_VER}-mbstring \
php${PHP_VER}-intl \
php${PHP_VER}-ldap \
php${PHP_VER}-xml \
php${PHP_VER}-zip \
php${PHP_VER}-pdo \
php${PHP_VER}-mysql \
php${PHP_VER}-pgsql \
php${PHP_VER}-gd \
php${PHP_VER}-xsl \
php${PHP_VER}-memcached \
php${PHP_VER}-curl
# Force the correct version via update-alternatives
sudo update-alternatives --set php /usr/bin/php${PHP_VER}
# Also override via /usr/local/bin which is earlier in PATH
sudo ln -sf /usr/bin/php${PHP_VER} /usr/local/bin/php
# Persist for subsequent steps
echo "PHP_VER=${PHP_VER}" >> "$GITHUB_ENV"
# Prepend /usr/local/bin to PATH for all subsequent steps
# Enable EPEL and Remi repo for multiple PHP versions on AL2
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm || true
sudo yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm || true
sudo yum-config-manager --enable remi-php$(echo $PHP_VER | tr -d '.')
sudo yum install -y \
php${PHP_VER/./} \
php${PHP_VER/./}-php-cli \
php${PHP_VER/./}-php-mbstring \
php${PHP_VER/./}-php-intl \
php${PHP_VER/./}-php-ldap \
php${PHP_VER/./}-php-xml \
php${PHP_VER/./}-php-zip \
php${PHP_VER/./}-php-pdo \
php${PHP_VER/./}-php-mysqlnd \
php${PHP_VER/./}-php-pgsql \
php${PHP_VER/./}-php-gd \
php${PHP_VER/./}-php-xsl \
php${PHP_VER/./}-php-memcached \
php${PHP_VER/./}-php-curl \
php${PHP_VER/./}-php-sodium
# Make the correct version the default
sudo ln -sf /usr/bin/php${PHP_VER/./} /usr/local/bin/php
echo "/usr/local/bin" >> "$GITHUB_PATH"
echo "PHP_VER=${PHP_VER}" >> "$GITHUB_ENV"
- name: Install OS packages needed for setup
shell: bash
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
sudo yum install -y \
wget curl tar ca-certificates \
git unzip \
libicu-dev \
libldap2-dev \
libicu-devel \
openldap-devel \
libxml2 \
zlib1g \
libsodium23 \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libxslt1.1 \
libmemcached11 \
tree
zlib \
libsodium \
libpng-devel \
libjpeg-devel \
freetype-devel \
libxslt \
libmemcached \
tree
- name: Checkout source
shell: bash
run: |
set -euxo pipefail
git clone \
--depth=1 \
--branch "${GITHUB_REF_NAME}" \
"${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" \
"${COMANAGE_REGISTRY_DIR}"
- name: Show versions
shell: bash
Expand All @@ -109,19 +117,35 @@ jobs:
composer --version
docker --version
- name: Create apache user/group
shell: bash
run: |
set -euxo pipefail
if ! getent group apache >/dev/null; then
sudo groupadd --system apache
fi
if ! id -u apache >/dev/null 2>&1; then
sudo useradd --system --no-create-home --gid apache apache
fi
- name: Create local/config/database.php placeholder
shell: bash
run: |
set -euxo pipefail
cd "${COMANAGE_REGISTRY_DIR}"/local/config
sudo touch database.php
sudo chown www-data:www-data database.php
sudo tee "database.php" > /dev/null <<'EOF'
sudo mkdir -p "${COMANAGE_REGISTRY_DIR}/local/config"
sudo tee "${COMANAGE_REGISTRY_DIR}/local/config/database.php" > /dev/null <<'EOF'
<?php
// Placeholder: actual connection is configured dynamically by tests/bootstrap.php via Testcontainers
return [];
EOF
- name: Composer install
shell: bash
working-directory: /srv/comanage-registry/app
run: |
set -euxo pipefail
composer install --no-interaction --no-progress
- name: Show working directory
shell: bash
run: |
Expand All @@ -134,5 +158,6 @@ jobs:
DB_ENGINE: ${{ matrix.db_engine }}
run: |
set -euxo pipefail
cd "${COMANAGE_REGISTRY_DIR}"/app
DB_ENGINE="${DB_ENGINE}" vendor/bin/phpunit --testsuite app
output=$(DB_ENGINE="${DB_ENGINE}" vendor/bin/phpunit --testsuite app 2>&1)
echo "${output}"
if echo "${output}" | grep -q "Could not load

0 comments on commit 91f78f8

Please sign in to comment.