forked from ayselafsar/dicomviewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ayselafsar#76 Add compatibility with Nextcloud 22
- Loading branch information
1 parent
8245330
commit c077bf3
Showing
118 changed files
with
5,272 additions
and
1,872 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: PHPUnit | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- stable* | ||
|
||
env: | ||
APP_NAME: dicomviewer | ||
|
||
jobs: | ||
oci: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
# do not stop on another job's failure | ||
fail-fast: false | ||
matrix: | ||
php-versions: ['7.4'] | ||
databases: ['oci'] | ||
server-versions: ['master'] | ||
|
||
name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }} | ||
|
||
services: | ||
oracle: | ||
image: deepdiver/docker-oracle-xe-11g # "wnameless/oracle-xe-11g-r2" | ||
ports: | ||
- "1521:1521" | ||
|
||
steps: | ||
- name: Checkout server | ||
uses: actions/checkout@v2 | ||
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@v2 | ||
with: | ||
path: apps/${{ env.APP_NAME }} | ||
|
||
- name: Set up PHPUnit | ||
working-directory: apps/${{ env.APP_NAME }} | ||
run: composer i | ||
|
||
- name: Set up php ${{ matrix.php-versions }} | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
php-version: "${{ matrix.php-versions }}" | ||
extensions: mbstring, iconv, fileinfo, intl, oci8 | ||
tools: phpunit:8.5.2 | ||
coverage: none | ||
|
||
- name: Set up Nextcloud | ||
run: | | ||
mkdir data | ||
./occ maintenance:install --verbose --database=oci --database-name=XE --database-host=127.0.0.1 --database-port=1521 --database-user=autotest --database-pass=owncloud --admin-user admin --admin-pass admin | ||
php -f index.php | ||
./occ app:enable --force ${{ env.APP_NAME }} | ||
- name: PHPUnit | ||
working-directory: apps/${{ env.APP_NAME }}/tests | ||
run: phpunit -c phpunit.xml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version' | ||
required: true | ||
|
||
name: Production Release | ||
|
||
jobs: | ||
build: | ||
name: Build, upload and release in the appstore | ||
environment: release | ||
env: | ||
APP_ID: dicomviewer | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Use Node 12 | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
extensions: mbstring, intl, sqlite3 | ||
ini-values: post_max_size=256M, max_execution_time=180 | ||
coverage: xdebug | ||
tools: php-cs-fixer, phpunit | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build project | ||
id: build_release | ||
run: | | ||
echo "##[set-output name=app_id;]$APP_ID" | ||
echo "###### copy app certificate" | ||
mkdir -p ~/.nextcloud/certificates | ||
echo "$APP_CRT" > ~/.nextcloud/certificates/${APP_ID}.crt | ||
echo "$APP_KEY" > ~/.nextcloud/certificates/${APP_ID}.key | ||
echo "###### install dependencies" | ||
export DEBIAN_FRONTEND=noninteractive | ||
sudo apt update -y | ||
sudo apt install make openssl -y | ||
echo "###### installing nextcloud" | ||
mkdir ~/html | ||
git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b stable21 ~/html/nextcloud | ||
sed -i $'s|if (substr($fullPath, 0, strlen($root) + 1) === $root . \'/\')|if (is_string($root) and substr($fullPath, 0, strlen($root) + 1) === $root . \'/\')|g' ~/html/nextcloud/lib/autoloader.php | ||
cp -r $GITHUB_WORKSPACE ~/html/nextcloud/apps/${APP_ID} | ||
php ~/html/nextcloud/occ maintenance:install --database "sqlite" --admin-user "admin" --admin-pass "password" | ||
echo "###### make" | ||
rm -rf ~/html/nextcloud/.eslintrc.js | ||
cd ~/html/nextcloud/apps/${APP_ID} | ||
webserveruser=runner occ_dir=~/html/nextcloud version=${version} make | ||
php ~/html/nextcloud/occ app:enable ${APP_ID} | ||
php ~/html/nextcloud/occ maintenance:mode --off | ||
echo "###### make appstore" | ||
cd ~/html/nextcloud/apps/${APP_ID} | ||
version=${app_version} | ||
tag=${version} | ||
webserveruser=runner occ_dir=~/html/nextcloud version=${version} make appstore | ||
build_dir=/tmp/build | ||
sign_dir=/tmp/sign | ||
echo "###### check code integrity" | ||
php ~/html/nextcloud/occ integrity:check-app --path=${sign_dir}/${APP_ID}/ ${APP_ID} | ||
echo "##[set-output name=version;]$version" | ||
echo "##[set-output name=build_dir;]$build_dir" | ||
echo "##[set-output name=sign_dir;]$sign_dir" | ||
env: | ||
app_version: ${{ github.event.inputs.version }} | ||
APP_CRT: ${{ secrets.APP_CRT }} | ||
APP_KEY: ${{ secrets.APP_KEY }} | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.build_release.outputs.version }} | ||
release_name: ${{ steps.build_release.outputs.version }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ${{ steps.build_release.outputs.build_dir }}/${{ steps.build_release.outputs.app_id }}-${{ steps.build_release.outputs.version }}.tar.gz | ||
asset_name: ${{ steps.build_release.outputs.app_id }}-${{ steps.build_release.outputs.version }}.tar.gz | ||
asset_content_type: application/gzip | ||
|
||
- name: Publish production release to appstore | ||
id: publish | ||
run: | | ||
appsigndir=${{ steps.build_release.outputs.sign_dir }} | ||
SIGNATURE=$(cat ${appsigndir}/sign.txt | tr -d '\n') | ||
VERSION=${{ steps.build_release.outputs.version }} | ||
DOWNLOAD_URL=https://github.com/${{ github.repository }}/releases/download/${VERSION}/${APP_ID}-${VERSION}.tar.gz | ||
curl -X POST -H "Authorization: Token $APPSTORE_TOKEN" https://apps.nextcloud.com/api/v1/apps/releases -H "Content-Type: application/json" -d '{"download":"'${DOWNLOAD_URL}'", "signature": "'${SIGNATURE}'"}' | ||
env: | ||
APPSTORE_TOKEN: ${{ secrets.APPSTORE_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
.idea/ | ||
.history/ | ||
node_modules | ||
.npm | ||
npm-debug.log | ||
package-lock.json | ||
vendor | ||
build | ||
js/dist | ||
js/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,41 @@ | ||
sudo: false | ||
dist: xenial | ||
language: php | ||
php: | ||
- 7.2 | ||
- 7.3 | ||
- 7.4 | ||
|
||
services: | ||
- mysql | ||
- postgresql | ||
|
||
env: | ||
global: | ||
- CORE_BRANCH=stable18 | ||
- MOZ_HEADLESS=1 | ||
- APP_NAME=dicomviewer | ||
- DB=sqlite | ||
matrix: | ||
- DB=pgsql | ||
- CORE_BRANCH=master | ||
|
||
matrix: | ||
allow_failures: | ||
- env: DB=pgsql CORE_BRANCH=master | ||
- php: nightly | ||
include: | ||
- php: 7.2 | ||
env: DB=mysql | ||
- php: 7.2 | ||
env: DB=pgsql CORE_BRANCH=master | ||
- php: 7.3 | ||
env: DB=mysql | ||
- php: 7.3 | ||
env: DB=pgsql CORE_BRANCH=master | ||
- php: 7.4 | ||
env: DB=mysql | ||
- php: 7.4 | ||
env: DB=pgsql CORE_BRANCH=master | ||
- php: nightly | ||
env: DB=pgsql CORE_BRANCH=master | ||
fast_finish: true | ||
branches: | ||
only: | ||
- master | ||
- /^stable\d+(\.\d+)?$/ | ||
|
||
install: | ||
- make | ||
- make source | ||
# install core | ||
before_install: | ||
- cd ../ | ||
- git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b $CORE_BRANCH nextcloud | ||
- mv dicomviewer/build/artifacts/source/dicomviewer nextcloud/apps/ | ||
- mv $APP_NAME nextcloud/apps/ | ||
|
||
script: | ||
- if [[ "$DB" == 'pgsql' ]]; then psql -c "CREATE ROLE oc_autotest LOGIN PASSWORD 'oc_autotest'" -U postgres; fi | ||
- if [[ "$DB" == 'pgsql' ]]; then psql -c "CREATE DATABASE oc_autotest OWNER oc_autotest;" -U postgres; fi | ||
- if [[ "$DB" == 'mysql' ]]; then mysql -u root -e 'CREATE DATABASE oc_autotest;'; fi | ||
- if [[ "$DB" == 'mysql' ]]; then mysql -u root -e "CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY 'oc_autotest';"; fi | ||
- if [[ "$DB" == 'mysql' ]]; then mysql -u root -e "GRANT ALL ON oc_autotest.* TO 'oc_autotest'@'localhost';"; fi | ||
# fill nextcloud with default configs and enable dicomviewer | ||
before_script: | ||
# fill nextcloud with default configs and enable the app | ||
- cd nextcloud | ||
- mkdir data | ||
- ./occ maintenance:install --database-name oc_autotest --database-user oc_autotest --admin-user admin --admin-pass admin --database $DB --database-pass="oc_autotest" | ||
- ./occ app:enable dicomviewer | ||
- ./occ app:check-code dicomviewer | ||
- ./occ background:cron # enable default cron | ||
- php -S localhost:8080 & | ||
- ./occ maintenance:install --database-name oc_autotest --database-user oc_autotest --admin-user admin --admin-pass admin --database $DB --database-pass='' | ||
- ./occ app:enable $APP_NAME | ||
- cd apps/$APP_NAME | ||
- composer install | ||
|
||
script: | ||
# check syntax | ||
- vendor/bin/parallel-lint --exclude app --exclude vendor --exclude tests . | ||
# Run phpunit tests | ||
- cd tests | ||
- ../vendor/bin/phpunit --configuration phpunit.xml | ||
# build js | ||
- cd .. | ||
- make | ||
|
||
after_failure: | ||
- cat ../../data/nextcloud.log |
Oops, something went wrong.