Fix JSON deleted column index migrations #569
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: PHP Tests | |
| on: | |
| push: | |
| branches: [ main, development ] | |
| pull_request: | |
| branches: [ main, development ] | |
| jobs: | |
| php-tests: | |
| if: false # Disabled temporarily - matrix tests | |
| runs-on: ubuntu-latest | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ROOT_PASSWORD: nextcloud | |
| MYSQL_DATABASE: nextcloud | |
| MYSQL_USER: nextcloud | |
| MYSQL_PASSWORD: nextcloud | |
| ports: | |
| - 3306:3306 | |
| options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
| strategy: | |
| matrix: | |
| php-versions: ['8.1', '8.2', '8.3'] | |
| nextcloud-versions: ['29.0.0', '30.0.0'] | |
| fail-fast: false # Don't cancel other jobs if one fails | |
| name: PHP ${{ matrix.php-versions }} - Nextcloud ${{ matrix.nextcloud-versions }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| path: apps/openregister | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-versions }} | |
| extensions: mbstring, intl, mysql, zip, gd, curl, xml, json | |
| coverage: xdebug | |
| tools: composer:v2 | |
| - name: Setup Nextcloud | |
| run: | | |
| # Download and extract Nextcloud | |
| wget https://download.nextcloud.com/server/releases/nextcloud-${{ matrix.nextcloud-versions }}.tar.bz2 | |
| tar -xjf nextcloud-${{ matrix.nextcloud-versions }}.tar.bz2 | |
| # Move our app to the apps directory | |
| mv apps/openregister nextcloud/apps/ | |
| cd nextcloud | |
| # Install Nextcloud | |
| php occ maintenance:install \ | |
| --database mysql \ | |
| --database-host 127.0.0.1 \ | |
| --database-port 3306 \ | |
| --database-name nextcloud \ | |
| --database-user nextcloud \ | |
| --database-pass nextcloud \ | |
| --admin-user admin \ | |
| --admin-pass admin | |
| # Enable our app | |
| php occ app:enable openregister | |
| # Set permissions | |
| chmod -R 755 . | |
| chown -R www-data:www-data . || true | |
| - name: Install PHP dependencies | |
| run: | | |
| cd nextcloud/apps/openregister | |
| composer install --no-progress --prefer-dist --optimize-autoloader | |
| - name: Run PHP Lint | |
| run: | | |
| cd nextcloud/apps/openregister | |
| composer lint || echo "Lint check completed with issues" | |
| continue-on-error: true | |
| - name: Run PHP CodeSniffer | |
| run: | | |
| cd nextcloud/apps/openregister | |
| composer phpcs || echo "PHPCS check completed with issues" | |
| continue-on-error: true | |
| - name: Run Psalm | |
| run: | | |
| cd nextcloud/apps/openregister | |
| composer psalm || echo "Psalm check completed with issues" | |
| continue-on-error: true | |
| - name: Run PHPMD | |
| run: | | |
| cd nextcloud/apps/openregister | |
| composer phpmd || echo "PHPMD check completed with issues" | |
| continue-on-error: true | |
| - name: Run PHPUnit Tests | |
| run: | | |
| cd nextcloud/apps/openregister | |
| # Set up test environment | |
| export NEXTCLOUD_ROOT=$(pwd)/../../ | |
| export OC_PASS=admin | |
| # Run tests with proper bootstrap | |
| ./vendor/bin/phpunit --configuration phpunit.xml --coverage-clover=coverage.xml || echo "Tests completed with some failures" | |
| continue-on-error: true | |
| - name: Upload coverage reports to Codecov | |
| if: always() && matrix.php-versions == '8.2' && matrix.nextcloud-versions == '30.0.0' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: nextcloud/apps/openregister/coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| docker-tests: | |
| if: false # Disabled temporarily | |
| runs-on: ubuntu-latest | |
| name: Docker Integration Tests | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Create Docker Compose for Testing | |
| run: | | |
| cat > docker-compose.test.yml << 'EOF' | |
| version: '3.8' | |
| services: | |
| nextcloud: | |
| image: nextcloud:latest | |
| container_name: nextcloud-test | |
| environment: | |
| - MYSQL_DATABASE=nextcloud | |
| - MYSQL_USER=nextcloud | |
| - MYSQL_PASSWORD=nextcloud | |
| - MYSQL_HOST=db | |
| - NEXTCLOUD_ADMIN_USER=admin | |
| - NEXTCLOUD_ADMIN_PASSWORD=admin | |
| volumes: | |
| - ./:/var/www/html/apps-extra/openregister | |
| depends_on: | |
| - db | |
| ports: | |
| - "8080:80" | |
| db: | |
| image: mysql:8.0 | |
| container_name: mysql-test | |
| environment: | |
| - MYSQL_ROOT_PASSWORD=nextcloud | |
| - MYSQL_DATABASE=nextcloud | |
| - MYSQL_USER=nextcloud | |
| - MYSQL_PASSWORD=nextcloud | |
| ports: | |
| - "3307:3306" | |
| EOF | |
| - name: Start Docker services | |
| run: | | |
| docker-compose -f docker-compose.test.yml up -d | |
| # Wait for services to be ready | |
| echo "Waiting for services to start..." | |
| sleep 30 | |
| # Wait for MySQL to be ready | |
| timeout=60 | |
| counter=0 | |
| while ! docker exec mysql-test mysqladmin ping -h localhost --silent; do | |
| sleep 2 | |
| counter=$((counter + 2)) | |
| if [ $counter -ge $timeout ]; then | |
| echo "MySQL did not become ready in time" | |
| docker-compose -f docker-compose.test.yml logs | |
| exit 1 | |
| fi | |
| done | |
| echo "MySQL is ready" | |
| # Wait for Nextcloud container to be ready | |
| timeout=60 | |
| counter=0 | |
| while ! docker exec nextcloud-test test -f /var/www/html/config/config.php 2>/dev/null; do | |
| sleep 2 | |
| counter=$((counter + 2)) | |
| if [ $counter -ge $timeout ]; then | |
| echo "Nextcloud container did not become ready in time" | |
| docker-compose -f docker-compose.test.yml logs | |
| exit 1 | |
| fi | |
| done | |
| echo "Nextcloud container is ready" | |
| # Install Nextcloud | |
| docker exec nextcloud-test bash -c " | |
| cd /var/www/html && | |
| php occ maintenance:install \ | |
| --database mysql \ | |
| --database-host db \ | |
| --database-name nextcloud \ | |
| --database-user nextcloud \ | |
| --database-pass nextcloud \ | |
| --admin-user admin \ | |
| --admin-pass admin | |
| " || echo "Nextcloud installation may have failed or already exists" | |
| # Enable our app | |
| docker exec nextcloud-test bash -c " | |
| cd /var/www/html && | |
| php occ app:enable openregister | |
| " || echo "App enable may have failed or app already enabled" | |
| - name: Install dependencies in container | |
| run: | | |
| docker exec nextcloud-test bash -c " | |
| cd /var/www/html/apps-extra/openregister && | |
| composer install --no-progress --prefer-dist --optimize-autoloader | |
| " | |
| - name: Run Docker-based tests | |
| run: | | |
| # Run our Docker test suite | |
| docker exec -u 33 nextcloud-test bash -c " | |
| cd /var/www/html/apps-extra/openregister && | |
| ./vendor/bin/phpunit --colors=always --testsuite='Integration Tests' || | |
| echo 'Integration tests completed with issues' | |
| " || echo "Docker tests completed with some failures" | |
| continue-on-error: true | |
| - name: Test API endpoints | |
| run: | | |
| # Wait a bit more for full startup | |
| sleep 10 | |
| # Test basic API connectivity | |
| docker exec nextcloud-test bash -c " | |
| curl -f -u 'admin:admin' -H 'OCS-APIREQUEST: true' \ | |
| 'http://localhost/index.php/apps/openregister/api/registers' || | |
| echo 'API test completed' | |
| " || echo "API tests completed with some failures" | |
| continue-on-error: true | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| docker-compose -f docker-compose.test.yml down -v | |