Skip to content

Commit

Permalink
Github actions setup. Test MariaDB,MySQL, Postgresql Database integra…
Browse files Browse the repository at this point in the history
…tion. Test Setup script executes successfully.
  • Loading branch information
Ioannis committed Mar 12, 2026
1 parent 1d35e2c commit f22ca3e
Show file tree
Hide file tree
Showing 13 changed files with 3,607 additions and 1,566 deletions.
23 changes: 0 additions & 23 deletions app/.github/ISSUE_TEMPLATE.md

This file was deleted.

14 changes: 0 additions & 14 deletions app/.github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

82 changes: 0 additions & 82 deletions app/.github/workflows/ci.yml

This file was deleted.

145 changes: 145 additions & 0 deletions app/.github/workflows/registry-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
name: COmanage Registry setup + PHPUnit (multi-PHP, multi-DB)

on:
workflow_dispatch:
push:
pull_request:

jobs:
setup-and-test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: ["8.3", "8.4", "8.5"]
db_engine: ["postgres", "mysql", "mariadb"]

env:
COMANAGE_REGISTRY_DIR: /srv/comanage-registry
COMANAGE_REGISTRY_URL_PATH: registry
COMANAGE_REGISTRY_VERSION: develop
# COMANAGE_REGISTRY_SRC_URL is computed dynamically in a step.

TEST_DB_NAME: test_db
TEST_DB_USER: test_user
TEST_DB_PASS: test_password

steps:
- name: Checkout (only for workflow files)
uses: actions/checkout@v4

- name: Setup PHP (recommended approach)
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none
extensions: >
mbstring, json, openssl, intl, ldap, xml, zlib, sodium,
pdo, pdo_mysql, pdo_pgsql, gd, xsl, memcached, pcntl, posix
- name: Compute COMANAGE_REGISTRY_SRC_URL
shell: bash
run: |
set -euo pipefail
echo "COMANAGE_REGISTRY_SRC_URL=https://github.internet2.edu/COmanage/registry/archive/${COMANAGE_REGISTRY_VERSION}.tar.gz" >> "$GITHUB_ENV"
- name: Show versions
shell: bash
run: |
set -euxo pipefail
php -v
composer --version
docker --version
- name: Install OS packages needed for setup + some PHP extensions
shell: bash
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
wget curl tar ca-certificates \
git unzip \
libicu-dev \
libldap2-dev \
libxml2 \
zlib1g \
libsodium23 \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libxslt1.1 \
libmemcached11
- name: Create apache user/group (to match your chown step)
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: Download and unpack COmanage Registry (${COMANAGE_REGISTRY_VERSION})
shell: bash
env:
GHE_TOKEN: ${{ secrets.GHE_TOKEN }}
run: |
set -euxo pipefail
sudo mkdir -p "${COMANAGE_REGISTRY_DIR}"
sudo rm -rf "${COMANAGE_REGISTRY_DIR:?}/"*
# If your GitHub Enterprise requires auth, use token. If not needed, wget/curl will still work.
if [ -n "${GHE_TOKEN:-}" ]; then
curl -fL \
-H "Authorization: token ${GHE_TOKEN}" \
-o /tmp/comanage.tar.gz \
"${COMANAGE_REGISTRY_SRC_URL}"
else
wget -O /tmp/comanage.tar.gz "${COMANAGE_REGISTRY_SRC_URL}"
fi
sudo tar -zxf /tmp/comanage.tar.gz -C "${COMANAGE_REGISTRY_DIR}" --strip-components=1
rm -f /tmp/comanage.tar.gz
sudo rm -rf "${COMANAGE_REGISTRY_DIR}/local/"*
- name: Create local tmp/cache + webroot symlink
shell: bash
run: |
set -euxo pipefail
sudo mkdir -p "${COMANAGE_REGISTRY_DIR}/local"
sudo mkdir -p /var/cache/registry/tmp
sudo rm -rf "${COMANAGE_REGISTRY_DIR}/local/tmp"
sudo ln -s /var/cache/registry/tmp "${COMANAGE_REGISTRY_DIR}/local/tmp"
sudo chown -h apache:apache "${COMANAGE_REGISTRY_DIR}/local/tmp"
sudo mkdir -p /var/www/html
sudo rm -f "/var/www/html/${COMANAGE_REGISTRY_URL_PATH}"
sudo ln -s "${COMANAGE_REGISTRY_DIR}/app/webroot" "/var/www/html/${COMANAGE_REGISTRY_URL_PATH}"
echo "Registry URL path is: ${COMANAGE_REGISTRY_URL_PATH}"
echo "Registry Version is: ${COMANAGE_REGISTRY_VERSION}"
- name: Composer install (app/)
shell: bash
working-directory: /srv/comanage-registry/app
run: |
set -euxo pipefail
composer install --no-interaction --no-progress
- 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
DB_ENGINE="${DB_ENGINE}" vendor/bin/phpunit --testsuite app
23 changes: 0 additions & 23 deletions app/.github/workflows/stale.yml

This file was deleted.

7 changes: 5 additions & 2 deletions app/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
"cakephp/debug_kit": "^5.0.0",
"josegonzalez/dotenv": "^4.0",
"phpunit/phpunit": "^10.5.5 || ^11.1.3 || ^12.1",
"psy/psysh": "@stable"
"psy/psysh": "@stable",
"symfony/http-client": "^7.4",
"testcontainers/testcontainers": "^1.0"
},
"suggest": {
"markstory/asset_compress": "An asset compression plugin which provides file concatenation and a flexible filter system for preprocessing and minification.",
Expand Down Expand Up @@ -89,8 +91,9 @@
"config": {
"sort-packages": true,
"allow-plugins": {
"cakephp/plugin-installer": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"cakephp/plugin-installer": true
"php-http/discovery": true
}
}
}
Loading

0 comments on commit f22ca3e

Please sign in to comment.