Splitting CI images into separate ones #59
Workflow file for this run
This file contains 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: Integration tests | |
on: | |
pull_request: | |
paths: | |
- '.github/workflows/integration.yml' | |
- 'appinfo/**' | |
- 'lib/**' | |
- 'tests/**' | |
- 'composer.*' | |
push: | |
branches: | |
- main | |
- master | |
- stable* | |
env: | |
APP_NAME: user_saml | |
LDAP_SUFFIX: dc=idptestbed | |
jobs: | |
integration: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
php-versions: [ "8.0" ] | |
databases: [ "sqlite" ] | |
server-versions: [ "master" ] | |
name: Integration php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }} | |
services: | |
directory: | |
image: quay.io/389ds/dirsrv:latest | |
ports: | |
- 389:3389/tcp | |
env: | |
DS_DM_PASSWORD: admin | |
DS_SUFFIX_NAME: dc=idptestbed | |
sso: | |
image: ghcr.io/nextcloud/continuous-integration-user_saml_shibboleth-idp:latest | |
ports: | |
- 4443:8443/tcp | |
steps: | |
- name: Checkout server | |
uses: actions/checkout@v3 | |
with: | |
repository: nextcloud/server | |
ref: ${{ matrix.server-versions }} | |
- name: Checkout submodules | |
shell: bash | |
run: | | |
auth_header="$(git config --local --get http.https://github.com/.extraheader)" | |
git submodule sync --recursive | |
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 | |
- name: Checkout app | |
uses: actions/checkout@v3 | |
with: | |
path: apps/${{ env.APP_NAME }} | |
- name: Initialize LDAP Service | |
shell: bash | |
run: | | |
CONTAINER_NAME=$(docker ps -a | grep dirsrv | awk '{ print $1; }') | |
# Initialize LDAP Database. May wait until server is ready. | |
while : ; do | |
sleep 1 | |
if docker exec ${CONTAINER_NAME} dsconf localhost backend create --suffix "${{ env.LDAP_SUFFIX }}" --be-name ci_root; then | |
break; | |
fi | |
if [ $(docker exec ${CONTAINER_NAME} dsconf localhost backend suffix list | grep "${{ env.LDAP_SUFFIX }}" | wc -l) -eq 1 ]; then | |
break | |
fi | |
done | |
# Add custom schema | |
docker cp apps/${{ env.APP_NAME }}/tests/integration/data/98nextcloud-schema.ldif ${CONTAINER_NAME}:/etc/dirsrv/slapd-localhost/schema/ | |
docker exec ${CONTAINER_NAME} dsconf localhost schema reload | |
# Add test entries | |
docker cp apps/${{ env.APP_NAME }}/tests/integration/data/entries.ldif ${CONTAINER_NAME}:/var/opt/ | |
docker exec ${CONTAINER_NAME} dsconf localhost backend import "${{ env.LDAP_SUFFIX }}" /var/opt/entries.ldif | |
- name: Set up php ${{ matrix.php-versions }} | |
uses: shivammathur/setup-php@72ae4ccbe57f82bbe08411e84e2130bd4ba1c10f # v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation | |
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite | |
coverage: none | |
ini-file: production | |
ini-values: disabled_functions= | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: DEBUG diagnose PHP modules | |
run: | | |
echo 'extension=pcntl.so' | sudo tee /etc/php/${{ matrix.php-versions }}/fpm/conf.d/10-pcntl.ini | |
php -m | |
- name: Set up dependencies | |
working-directory: apps/${{ env.APP_NAME }} | |
run: composer i --no-dev | |
- name: Set up Nextcloud | |
run: | | |
if [ "${{ matrix.databases }}" = "mysql" ]; then | |
export DB_PORT=4444 | |
elif [ "${{ matrix.databases }}" = "pgsql" ]; then | |
export DB_PORT=4445 | |
fi | |
mkdir data | |
./occ maintenance:install --verbose --database=${{ matrix.databases }} --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin | |
./occ app:enable --force ${{ env.APP_NAME }} | |
php -S localhost:8080 & | |
- name: Run behat | |
working-directory: apps/${{ env.APP_NAME }}/tests/integration | |
run: | | |
composer install | |
./vendor/bin/behat --colors | |
- name: Dump nextcloud.log | |
if: always() | |
run: cat data/nextcloud.log |