Skip to content

Fix README protocol labels for Mail and Collectives (OCS, not REST) #233

Fix README protocol labels for Mail and Collectives (OCS, not REST)

Fix README protocol labels for Mail and Collectives (OCS, not REST) #233

name: Integration Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test-integration:
name: NC ${{ matrix.nextcloud-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
nextcloud-version: ["32", "33"]
services:
nextcloud:
image: nextcloud:${{ matrix.nextcloud-version }}
env:
SQLITE_DATABASE: nextcloud
NEXTCLOUD_ADMIN_USER: admin
NEXTCLOUD_ADMIN_PASSWORD: admin
ports:
- 8080:80
options: >-
--health-cmd "curl -f http://localhost/status.php || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 30
--health-start-period 60s
smtp4dev:
image: rnwood/smtp4dev:latest
env:
ServerOptions__BasePath: /smtp4dev
ports:
- 9025:25
- 9143:143
- 9080:80
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.12"
cache: pip
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Wait for Nextcloud
run: |
for i in $(seq 1 60); do
if curl -sf http://localhost:8080/status.php | python3 -c "import sys,json; sys.exit(0 if json.load(sys.stdin)['installed'] else 1)" 2>/dev/null; then
echo "Nextcloud is ready"
break
fi
echo "Waiting... ($i)"
sleep 3
done
- name: Configure Nextcloud for testing
run: |
NC_CONTAINER=${{ job.services.nextcloud.id }}
OCC="docker exec $NC_CONTAINER su -s /bin/bash www-data -c"
$OCC "php occ config:system:set ratelimit_protection_enabled --value=false --type=boolean"
$OCC "php occ config:system:set auth.bruteforce.protection.enabled --value=false --type=boolean"
$OCC "php occ config:system:set loglevel --value=2 --type=integer"
$OCC "php occ config:system:set ratelimit_overwrite files_sharing.shareapi.createshare user limit --value=1000 --type=integer"
$OCC "php occ config:system:set ratelimit_overwrite files_sharing.shareapi.createshare user period --value=60 --type=integer"
$OCC "php occ app:install spreed" || echo "spreed already installed"
$OCC "php occ app:install announcementcenter" || echo "announcementcenter already installed"
$OCC "php occ app:install collectives" || echo "collectives already installed"
$OCC "php occ app:install mail"
$OCC "php occ app:install forms" || echo "forms already installed"
SMTP4DEV_IP=$(docker inspect ${{ job.services.smtp4dev.id }} --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}')
echo "smtp4dev IP: $SMTP4DEV_IP"
$OCC "php occ mail:account:create admin 'Test Mail' test@localhost $SMTP4DEV_IP 143 none test test $SMTP4DEV_IP 25 none test test"
$OCC "php occ mail:account:sync 1"
APP_PASS=$($OCC "php occ user:auth-tokens:add admin" | grep -oP '[A-Za-z0-9]{72}' | head -1)
if [ -z "$APP_PASS" ]; then echo "::error::Failed to generate app password"; exit 1; fi
echo "::add-mask::$APP_PASS"
echo "NC_APP_PASSWORD=$APP_PASS" >> "$GITHUB_ENV"
- name: Seed pagination test data
run: python scripts/seed_pagination_data.py http://localhost:8080 admin "$NC_APP_PASSWORD"
- name: Run integration tests
env:
NEXTCLOUD_URL: http://localhost:8080
NEXTCLOUD_USER: admin
NEXTCLOUD_PASSWORD: ${{ env.NC_APP_PASSWORD }}
NEXTCLOUD_MCP_APP_PASSWORD: "true"
SMTP4DEV_HOST: localhost
SMTP4DEV_HTTP_PORT: "9080"
SMTP4DEV_SMTP_PORT: "9025"
MAIL_RECIPIENT: test@localhost
NC_CONTAINER: ${{ job.services.nextcloud.id }}
MAIL_ACCOUNT_ID: "1"
run: pytest tests/integration/ -v -m integration --ignore=tests/integration/test_session_cache.py --cov=nc_mcp_server --cov-report=xml:coverage-integration.xml
- name: Upload coverage
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v5
with:
files: coverage-integration.xml
flags: integration,nc${{ matrix.nextcloud-version }}
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
- name: Dump Nextcloud logs on failure
if: failure()
run: |
docker exec ${{ job.services.nextcloud.id }} cat /var/www/html/data/nextcloud.log 2>/dev/null | tail -50 || echo "No logs found"
test-session-cache:
name: Session cache (NC ${{ matrix.nextcloud-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
nextcloud-version: ["32", "33"]
services:
nextcloud:
image: nextcloud:${{ matrix.nextcloud-version }}
env:
SQLITE_DATABASE: nextcloud
NEXTCLOUD_ADMIN_USER: admin
NEXTCLOUD_ADMIN_PASSWORD: admin
ports:
- 8080:80
options: >-
--health-cmd "curl -f http://localhost/status.php || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 30
--health-start-period 60s
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.12"
cache: pip
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Wait for Nextcloud
run: |
for i in $(seq 1 60); do
if curl -sf http://localhost:8080/status.php | python3 -c "import sys,json; sys.exit(0 if json.load(sys.stdin)['installed'] else 1)" 2>/dev/null; then
echo "Nextcloud is ready"
break
fi
echo "Waiting... ($i)"
sleep 3
done
- name: Configure Nextcloud for testing
run: |
NC_CONTAINER=${{ job.services.nextcloud.id }}
docker exec $NC_CONTAINER su -s /bin/bash www-data -c "php occ config:system:set ratelimit_protection_enabled --value=false --type=boolean"
docker exec $NC_CONTAINER su -s /bin/bash www-data -c "php occ config:system:set auth.bruteforce.protection.enabled --value=false --type=boolean"
- name: Run session cache tests (regular password)
env:
NEXTCLOUD_URL: http://localhost:8080
NEXTCLOUD_USER: admin
NEXTCLOUD_PASSWORD: admin
NC_CONTAINER: ${{ job.services.nextcloud.id }}
run: pytest tests/integration/test_session_cache.py -v -m integration --cov=nc_mcp_server --cov-report=xml:coverage-session-cache.xml
- name: Upload coverage
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v5
with:
files: coverage-session-cache.xml
flags: session-cache
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
- name: Dump Nextcloud logs on failure
if: failure()
run: |
docker exec ${{ job.services.nextcloud.id }} cat /var/www/html/data/nextcloud.log 2>/dev/null | tail -50 || echo "No logs found"
test-user-permissions:
name: User permissions (NC ${{ matrix.nextcloud-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
nextcloud-version: ["32", "33"]
services:
nextcloud:
image: nextcloud:${{ matrix.nextcloud-version }}
env:
SQLITE_DATABASE: nextcloud
NEXTCLOUD_ADMIN_USER: admin
NEXTCLOUD_ADMIN_PASSWORD: admin
ports:
- 8080:80
options: >-
--health-cmd "curl -f http://localhost/status.php || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 30
--health-start-period 60s
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.12"
cache: pip
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Wait for Nextcloud
run: |
for i in $(seq 1 60); do
if curl -sf http://localhost:8080/status.php | python3 -c "import sys,json; sys.exit(0 if json.load(sys.stdin)['installed'] else 1)" 2>/dev/null; then
echo "Nextcloud is ready"
break
fi
echo "Waiting... ($i)"
sleep 3
done
- name: Configure Nextcloud for testing
run: |
NC_CONTAINER=${{ job.services.nextcloud.id }}
docker exec $NC_CONTAINER su -s /bin/bash www-data -c "php occ config:system:set ratelimit_protection_enabled --value=false --type=boolean"
docker exec $NC_CONTAINER su -s /bin/bash www-data -c "php occ config:system:set auth.bruteforce.protection.enabled --value=false --type=boolean"
docker exec $NC_CONTAINER su -s /bin/bash www-data -c "php occ app:install spreed" || echo "spreed already installed"
- name: Warm up OCS API
run: |
for i in $(seq 1 10); do
if curl -sf -u admin:admin -H "OCS-APIRequest: true" http://localhost:8080/ocs/v2.php/cloud/user > /dev/null 2>&1; then
echo "OCS API is ready"
break
fi
echo "Waiting for OCS API... ($i)"
sleep 3
done
- name: Run user permission tests
env:
NEXTCLOUD_URL: http://localhost:8080
NEXTCLOUD_USER: admin
NEXTCLOUD_PASSWORD: admin
run: pytest tests/integration/test_user_permissions.py -v -m integration --cov=nc_mcp_server --cov-report=xml:coverage-user-perms.xml
- name: Upload coverage
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v5
with:
files: coverage-user-perms.xml
flags: user-permissions
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
- name: Dump Nextcloud logs on failure
if: failure()
run: |
docker exec ${{ job.services.nextcloud.id }} cat /var/www/html/data/nextcloud.log 2>/dev/null | tail -50 || echo "No logs found"