forked from COmanage/registry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Github actions setup. Test MariaDB,MySQL, Postgresql Database integra…
…tion. Test Setup script executes successfully.
- Loading branch information
Showing
13 changed files
with
3,607 additions
and
1,566 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
| 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 |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.