update pipeline steps and config #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| # 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 | |
| COMANAGE_REGISTRY_DATABASE_PERSISTENT: "false" | |
| steps: | |
| - name: Checkout (only for workflow files) | |
| shell: bash | |
| run: | | |
| set -euxo pipefail | |
| git clone \ | |
| --depth=1 \ | |
| --branch "${GITHUB_REF_NAME}" \ | |
| "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" \ | |
| "${COMANAGE_REGISTRY_DIR}" | |
| - 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 | |
| sudo ln -sf /usr/bin/php${PHP_VER} /usr/local/bin/php | |
| 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 \ | |
| wget curl tar ca-certificates \ | |
| git unzip \ | |
| libicu-dev \ | |
| libldap2-dev \ | |
| libxml2 \ | |
| zlib1g \ | |
| libsodium23 \ | |
| libpng-dev \ | |
| libjpeg-dev \ | |
| libfreetype6-dev \ | |
| libxslt1.1 \ | |
| libmemcached11 \ | |
| tree | |
| - name: Show versions | |
| shell: bash | |
| run: | | |
| set -euxo pipefail | |
| php -v | |
| composer --version | |
| docker --version | |
| - name: Show working directory | |
| shell: bash | |
| run: | | |
| tree -L 2 "${COMANAGE_REGISTRY_DIR}" | |
| - 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: 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 |