Skip to content

fixing github actions steps and configuration #14

fixing github actions steps and configuration

fixing github actions steps and configuration #14

Workflow file for this run

name: COmanage Registry setup + PHPUnit (multi-PHP, multi-DB)
on:
workflow_dispatch:
push:
pull_request:
jobs:
setup-and-test:
runs-on:
- codebuild-comanage-pipeline-${{ github.run_id }}-${{ github.run_attempt }}
strategy:
fail-fast: false
matrix:
php: ["8.3"]
db_engine: ["postgres", "mysql", "mariadb"]
env:
COMANAGE_REGISTRY_DIR: /srv/comanage-registry
COMANAGE_REGISTRY_ADMIN_GIVEN_NAME: Admin
COMANAGE_REGISTRY_ADMIN_FAMILY_NAME: User
COMANAGE_REGISTRY_ADMIN_USERNAME: admin
COMANAGE_REGISTRY_SECURITY_SALT: phpunit-security-salt
COMANAGE_REGISTRY_DATABASE: registry_test
COMANAGE_REGISTRY_DATABASE_USER: test_user
COMANAGE_REGISTRY_DATABASE_USER_PASSWORD: test_password
COMANAGE_REGISTRY_DATABASE_PERSISTENT: "false"
steps:
- name: Show OS info
shell: bash
run: |
cat /etc/os-release
uname -a
docker --version
- name: Upgrade Docker Engine
shell: bash
run: |
set -euxo pipefail
# Remove old docker packages first to avoid conflicts
sudo yum remove -y docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine || true
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 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
PHP_VER="${{ matrix.php }}"
# 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 yum install -y \
wget curl tar ca-certificates \
git unzip \
libicu-devel \
openldap-devel \
libxml2 \
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
run: |
set -euxo pipefail
php -v
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
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: |
tree -L 3 "${COMANAGE_REGISTRY_DIR}"
- name: Run PHPUnit (DB_ENGINE=${{ matrix.db_engine }})
shell: bash
working-directory: /srv/comanage-registry/app
env:
DB_ENGINE: ${{ matrix.db_engine }}
run: |
set -euxo pipefail
output=$(DB_ENGINE="${DB_ENGINE}" vendor/bin/phpunit --testsuite app 2>&1)
echo "${output}"
if echo "${output}" | grep -q "Could not load