Skip to content

feat: Make all config keys lazy #292

feat: Make all config keys lazy

feat: Make all config keys lazy #292

# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
#
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT
name: Integration test
on:
pull_request:
push:
branches:
- master
- main
- stable*
env:
APP_NAME: integration_dropbox
permissions:
contents: read
concurrency:
group: integration-test-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
strategy:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: [ '8.2' ]
server-versions: [ 'master', 'stable33', 'stable32' ]
name: Integration test
steps:
- name: Checkout nextcloud
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: server
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Set up php
uses: shivammathur/setup-php@cf4cade2721270509d5b1c766ab3549210a39a2a # v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
ini-file: development
# 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, mysql, pdo_mysql
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install nextcloud
working-directory: server/
run: |
git submodule update --init
php occ maintenance:install --verbose --admin-user admin --admin-pass admin
- name: Checkout app
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: server/apps/${{ env.APP_NAME }}
- name: Install dependencies
working-directory: server/apps/${{ env.APP_NAME }}
run: composer i
- name: Install app
working-directory: server/
run: |
php occ app:enable integration_dropbox -vvv
# for good measure
sed -i '$d' config/config.php && echo " 'debug' => true," >> config/config.php && echo ");" >> config/config.php
php occ migrations:execute integration_dropbox 030002Date20241021105515
- name: Run Nextcloud
working-directory: server/
run: php -S localhost:8080 &
- name: Run import
working-directory: server/
env:
DROPBOX_CONFIG: ${{ secrets.DROPBOX_CONFIG }}
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
run: |
echo $DROPBOX_CONFIG > config.json
php occ integration_dropbox:setup $OAUTH_CLIENT_ID $OAUTH_CLIENT_SECRET
php occ integration_dropbox:setup-user admin "$(cat config.json | jq '.config.account_id' | sed 's/["'\'']//g')" "$(cat config.json | jq '.config.refresh_token' | sed 's/["'\'']//g')" "$(cat config.json | jq '.config.token' | sed 's/["'\'']//g')"
php occ integration_dropbox:start-import admin
for run in {1..10}; do date; echo "run $run starting"; php cron.php; ls -lh data/admin/files/Dropbox\ import/ ; echo "run $run done"; done
date
du -shc data/admin/files/Dropbox\ import/*
- name: Check import result
if: always()
working-directory: server/
run: |
sqlite3 data/owncloud.db "SELECT * from oc_preferences where configkey = 'nb_imported_files';" > result.txt
sqlite3 data/owncloud.db "SELECT * from oc_preferences where configkey = 'importing_dropbox';" >> result.txt
sqlite3 data/owncloud.db "SELECT * from oc_preferences where configkey = 'last_import_error';" >> result.txt
cat > result.expected.txt <<- EOM
admin|integration_dropbox|nb_imported_files|0|1|1|0|
admin|integration_dropbox|importing_dropbox|0|1|1|0|
admin|integration_dropbox|last_import_error||1|1|0|
EOM
diff result.expected.txt result.txt
cat > du-sh.expected.txt <<- EOM
1.5G data/admin/files/Dropbox import/
1.5G total
EOM
echo CHECK "du -shc --apparent-size data/admin/files/Dropbox\ import/*"
du -shc --apparent-size data/admin/files/Dropbox\ import/*
echo CHECK "md5sum data/admin/files/Dropbox\ import/*"
md5sum data/admin/files/Dropbox\ import/*
echo END CHECKS
du -sh --apparent-size data/admin/files/Dropbox\ import/ > du-sh.result.txt
du -sh --apparent-size data/admin/files/Dropbox\ import/
diff du-sh.expected.txt du-sh.result.txt
- name: Show log on failure
working-directory: server/
if: always()
run: |
du -sh data/admin/files/Dropbox\ import/
cat result.txt || echo "No result"
tail data/nextcloud.log