Skip to content

Commit

Permalink
Merge pull request #103 from nextcloud/install-check
Browse files Browse the repository at this point in the history
Check installation of the app
  • Loading branch information
CarlSchwan authored Sep 19, 2022
2 parents 58de382 + 1f4121a commit f464bd3
Show file tree
Hide file tree
Showing 7 changed files with 972 additions and 685 deletions.
120 changes: 120 additions & 0 deletions .github/workflows/phpunit-sqlite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# 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

name: PHPUnit

on:
pull_request:
push:
branches:
- main
- master
- stable*

permissions:
contents: read

env:
# Location of the phpunit.xml and phpunit.integration.xml files
PHPUNIT_CONFIG: ./tests/phpunit.xml
PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml

jobs:
phpunit-sqlite:
runs-on: ubuntu-latest

strategy:
matrix:
php-versions: ['7.4', '8.0', '8.1']
server-versions: ['master']

steps:
- name: Set app env
run: |
# Split and keep last
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Checkout server
uses: actions/checkout@v3
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}

- name: Checkout app
uses: actions/checkout@v3
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
coverage: none

- name: Check composer file existence
id: check_composer
uses: andstor/file-existence-action@v1
with:
files: apps/${{ env.APP_NAME }}/composer.json

- name: Set up PHPUnit
# Only run if phpunit config file exists
if: steps.check_composer.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: composer i

- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
./occ app:enable ${{ env.APP_NAME }}
- name: Check PHPUnit config file existence
id: check_phpunit
uses: andstor/file-existence-action@v1
with:
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}

- name: PHPUnit
# Only run if phpunit config file exists
if: steps.check_phpunit.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_CONFIG }}

- name: Check PHPUnit integration config file existence
id: check_integration
uses: andstor/file-existence-action@v1
with:
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }}

- name: Run Nextcloud
# Only run if phpunit integration config file exists
if: steps.check_integration.outputs.files_exists == 'true'
run: php -S localhost:8080 &

- name: PHPUnit integration
# Only run if phpunit integration config file exists
if: steps.check_integration.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}

summary:
permissions:
contents: none
runs-on: ubuntu-latest
needs: phpunit-sqlite

if: always()

name: phpunit-sqlite-summary

steps:
- name: Summary status
run: if ${{ needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi
65 changes: 65 additions & 0 deletions .github/workflows/update-christophwurst-nextcloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# 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

name: Update christophwurst/nextcloud

on:
workflow_dispatch:
schedule:
- cron: "5 4 * * 0"

jobs:
update-christophwurst-nextcloud:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
branches: ["master", "stable24", "stable23", "stable22"]

name: update-christophwurst-nextcloud-${{ matrix.branches }}

steps:
- uses: actions/checkout@v3
with:
ref: ${{ matrix.branches }}
submodules: true

- name: Set up php7.4
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: ctype,curl,dom,fileinfo,gd,intl,json,mbstring,openssl,pdo_sqlite,posix,sqlite,xml,zip
coverage: none

- name: Composer install
run: composer install

- name: Composer update christophwurst/nextcloud
run: composer require --dev christophwurst/nextcloud:dev-${{ matrix.branches }}
continue-on-error: true

- name: Reset checkout dirs
run: |
git clean -f 3rdparty
git clean -f vendor
git checkout 3rdparty vendor
continue-on-error: true

- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.COMMAND_BOT_PAT }}
commit-message: Update psalm baseline
committer: GitHub <noreply@github.com>
author: nextcloud-command <nextcloud-command@users.noreply.github.com>
signoff: true
branch: automated/noid/${{ matrix.branches }}-update-christophwurst-nextcloud
title: "[${{ matrix.branches }}] Update christophwurst/nextcloud dependency"
body: |
Auto-generated update of [christophwurst/nextcloud](https://github.com/ChristophWurst/nextcloud_composer/) dependency
labels: |
dependencies
3. to review
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ nbproject
/.buildpath

# Tests - auto-generated files
/.php_cs.cache
/.php-cs-fixer.cache
/tests/coverage*
/tests/clover.xml
/vendor
File renamed without changes.
19 changes: 9 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,13 @@
"name": "nextcloud/nextcloud_announcements",
"description": "nextcloud_announcements",
"license": "AGPL",
"require": {
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"nextcloud/coding-standard": "^0.5.0",
"christophwurst/nextcloud": "dev-master@dev",
"vimeo/psalm": "^4.3.2"
},
"config": {
"optimize-autoloader": true,
"classmap-authoritative": true,
"optimize-autoloader": true,
"platform": {
"php": "7.4"
}
},
"sort-packages": true
},
"scripts": {
"lint": "find . -name \\*.php -not -path './vendor/*' -not -path './build/*' -print0 | xargs -0 -n1 php -l",
Expand All @@ -31,5 +24,11 @@
"psalm:update-baseline": "psalm --threads=1 --update-baseline --set-baseline=tests/psalm-baseline.xml",
"psalm:clear": "psalm --clear-cache && psalm --clear-global-cache",
"psalm:fix": "psalm --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType"
},
"require-dev": {
"christophwurst/nextcloud": "dev-master",
"nextcloud/coding-standard": "^1.0.0",
"phpunit/phpunit": "^9.5",
"vimeo/psalm": "^4.27.0"
}
}
Loading

0 comments on commit f464bd3

Please sign in to comment.