Skip to content

Update composer dependencies #429

Update composer dependencies

Update composer dependencies #429

name: PHPUnit-Integration
on:
pull_request:
push:
branches:
- master
- stable*
env:
APP_NAME: workflow_ocr
NEXTCLOUD_PORT: 8080
NEXTCLOUD_USER: "admin"
NEXTCLOUD_PASS: "password"
NEXTCLOUD_NGINX_PORT: 80
HP_SHARED_KEY: "some_secure_password"
DB_PORT: 4444
MYSQL_ROOT_PASSWORD: "rootpassword"
jobs:
# Do not change this name, it is used in the integration tests
github-php-integrationtests:
runs-on: ubuntu-24.04
services:
mysql:
image: mariadb:10.5
ports:
- 4444:3306/tcp
env:
MYSQL_ROOT_PASSWORD: rootpassword
options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5
strategy:
fail-fast: false
matrix:
php-versions: ['8.4']
databases: ['mysql']
server-versions: ['master']
backend: ['remote', 'local'] # Do not change these names, they're used in the integration tests
name: php-integrationtests-${{ matrix.backend }}-${{ matrix.php-versions }}-${{ matrix.databases }}
steps:
- name: Checkout server
uses: actions/checkout@v5
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@v5
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite, gd, zip, imagick
coverage: none
- name: Install ocrmypdf
if: matrix.backend == 'local'
run: |
sudo apt-get update && sudo apt-get install -y ocrmypdf
ocrmypdf --version
- name: Install composer dependencies
working-directory: apps/${{ env.APP_NAME }}
run: composer i
# Note: ./occ maintenance:mimetype:update-db is required to avoid
# issues with the application/pdf mimetype
- name: Set up Nextcloud
run: |
mkdir data
./occ maintenance:install --verbose \
--database=${{ matrix.databases }} \
--database-name=nextcloud \
--database-host=127.0.0.1 \
--database-port=${{ env.DB_PORT }} \
--database-user=root \
--database-pass=${{ env.MYSQL_ROOT_PASSWORD }} \
--admin-user ${{ env.NEXTCLOUD_USER }} \
--admin-pass ${{ env.NEXTCLOUD_PASS }}
./occ app:enable ${{ env.APP_NAME }}
./occ app:enable files_external
./occ maintenance:mimetype:update-db
php -S localhost:${{ env.NEXTCLOUD_PORT }} &
- name: Start nginx Proxy
if: matrix.backend == 'remote'
run: |
docker run \
--name nc_nginx_proxy \
--network host \
-v ./apps/${{ env.APP_NAME }}/tests/nginx-harp-test.conf.template:/etc/nginx/templates/default.conf.template \
-e NEXTCLOUD_NGINX_PORT=${{ env.NEXTCLOUD_NGINX_PORT }} \
-e NEXTCLOUD_PORT=${{ env.NEXTCLOUD_PORT }} \
-d nginx:latest
- name: Checkout AppApi
uses: actions/checkout@v5
if: matrix.backend == 'remote'
with:
repository: nextcloud/app_api
ref: ${{ matrix.server-versions == 'master' && 'main' || matrix.server-versions }}
path: apps/app_api
- name: Start AppApi HaRP container
if: matrix.backend == 'remote'
run: |
docker run \
--network host \
-e HP_SHARED_KEY="${{ env.HP_SHARED_KEY }}" \
-e NC_INSTANCE_URL="http://localhost:${{ env.NEXTCLOUD_NGINX_PORT }}" \
-e HP_BLACKLIST_COUNT=10000 \
-e HP_BLACKLIST_WINDOW=1 \
-e HP_LOG_LEVEL=DEBUG \
-v /var/run/docker.sock:/var/run/docker.sock \
--name nc_harp_proxy \
-d ghcr.io/nextcloud/nextcloud-appapi-harp:release
echo "Waiting for nc_harp_proxy to report healthy..."
times=30
until [ "$(docker inspect --format='{{.State.Health.Status}}' nc_harp_proxy 2>/dev/null || echo unknown)" = "healthy" ]; do
if [ "$times" -le 0 ]; then
echo "Timed out waiting for nc_harp_proxy to become healthy"
echo "==== nc_harp_proxy logs ===="
docker logs nc_harp_proxy || true
exit 1
fi
echo "."
sleep 2
times=$((times - 1))
done
echo "nc_harp_proxy is healthy"
- name: Set up AppApi/ExApp infrastructure and deploy OCR Backend
if: matrix.backend == 'remote'
run: |
./occ app:enable app_api
./occ config:app:set --value 5 --type string app_api init_timeout
./occ app_api:daemon:register \
--set-default \
--harp \
--harp_frp_address "localhost:8782" \
--harp_shared_key "${{ env.HP_SHARED_KEY }}" \
--harp_docker_socket_port 24000 \
--net host \
"harp_proxy_docker" \
"HaRP Proxy (Docker)" \
"docker-install" \
"http" \
"localhost:8780" \
"http://localhost:${{ env.NEXTCLOUD_NGINX_PORT }}"
./occ app_api:app:register workflow_ocr_backend \
--info-xml https://raw.githubusercontent.com/R0Wi-DEV/workflow_ocr_backend/refs/heads/${{ matrix.server-versions }}/appinfo/info.xml
- name: PHPUnit
working-directory: apps/${{ env.APP_NAME }}
env:
GITHUB_MATRIX_BACKEND: ${{ matrix.backend }}
run: make php-integrationtest
- name: Output logs
if: failure() && matrix.backend == 'remote'
run: |
echo "#### Logs ####"
echo ""
echo "==== ocr_backend logs ===="
docker logs nc_app_workflow_ocr_backend || echo "Failed to get ocr_backend logs"
echo "==== harp_proxy logs ===="
docker logs nc_harp_proxy || echo "Failed to get harp_proxy logs"
echo "==== nginx_proxy logs ===="
docker logs nc_nginx_proxy || echo "Failed to get nginx_proxy logs"
echo "==== nextcloud logs ===="
cat data/nextcloud.log || echo "Failed to get nextcloud logs"