Skip to content

Commit

Permalink
Merge pull request #13 from andmor-/master
Browse files Browse the repository at this point in the history
CI setup and NC26/PHP8.2 compatibility
  • Loading branch information
andmor- authored May 5, 2023
2 parents 75fd788 + b50cd4a commit d1815a7
Show file tree
Hide file tree
Showing 18 changed files with 18,384 additions and 146 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
extends: [
'@nextcloud',
],
}
197 changes: 197 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
name: CI

on:
push:
pull_request:
release:
types: [published]
workflow_dispatch:
schedule:
- cron: "23 4 5 * *"

jobs:
lint:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [ 16.x, 18.x ]
php-version: [ 8.0, 8.1, 8.2 ]

name: Lint on Node${{matrix.node-version}}, PHP${{ matrix.php-version }}

steps:
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
ini-file: apps/switchboardbridge/tests/php.ini
tools: phpcs, phpcbf

- uses: actions/checkout@v3
name: Checkout switchboardbridge

- name: Install npm dependencies for switchboardbridge
run: npm ci --force --save-dev

- name: Style checking
continue-on-error: true
run: npm run stylelint
- name: Fix Style Lint
run: npm run stylelint:fix

- name: Js Lint checking
continue-on-error: true
run: npm run lint
- name: Fix Js Lint
run: npm run lint:fix

- name: PHP lint and fix
continue-on-error: true
run: phpcbf --extensions=php --ignore=*/tests/*,*/node_modules/* .

- name: PHP lint verify
run: phpcs --extensions=php --ignore=*/tests/*,*/node_modules/* .

- name: Archive workspace
run: tar cf switchboardbridge-lint_node${{matrix.node-version}}_php${{ matrix.php-version }}.tar .

- name: Upload lint result workspace
uses: actions/upload-artifact@v3
with:
name: switchboardbridge-lint_node${{matrix.node-version}}_php${{ matrix.php-version }}
path: switchboardbridge-lint_node${{matrix.node-version}}_php${{ matrix.php-version }}.tar


build:
needs: [lint]
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [ 16.x, 18.x ]
php-version: [ 8.0, 8.1, 8.2 ]

name: Build Js on Node${{matrix.node-version}}, PHP${{ matrix.php-version }}

steps:
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Download lint job workspace
uses: actions/download-artifact@v3
with:
name: switchboardbridge-lint_node${{matrix.node-version}}_php${{ matrix.php-version }}

- name: Extract workspace
run: tar xf switchboardbridge-lint_node${{matrix.node-version}}_php${{ matrix.php-version }}.tar .

- name: Build target Js
run: npm run build

- name: Archive workspace
run: tar cf switchboardbridge-build_node${{matrix.node-version}}_php${{ matrix.php-version }}.tar .

- name: Upload build result workspace
uses: actions/upload-artifact@v3
with:
name: switchboardbridge-build_node${{matrix.node-version}}_php${{ matrix.php-version }}
path: switchboardbridge-build_node${{matrix.node-version}}_php${{ matrix.php-version }}.tar

deploy:
needs: [build]
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 18.x ]
php-version: [ 8.0, 8.1, 8.2 ]
nextcloud-version-branch: [ stable24, stable25, stable26 ] # see https://github.com/nextcloud/server/branches
exclude:
- php-version: 8.2
nextcloud-version-branch: stable24
- php-version: 8.2
nextcloud-version-branch: stable25

name: Deploy on NC${{matrix.nextcloud-version-branch}}, PHP${{ matrix.php-version }}
env:
DB_DATABASE: oc_autotest
DB_ROOT: root

steps:
- name: Setup MySQL
run: |
sudo /etc/init.d/mysql start
mysql -u${{ env.DB_ROOT }} -p${{ env.DB_ROOT }} -e 'CREATE DATABASE ${{ env.DB_DATABASE }};'
mysql -u${{ env.DB_ROOT }} -p${{ env.DB_ROOT }} -e "CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY '';"
mysql -u${{ env.DB_ROOT }} -p${{ env.DB_ROOT }} -e "grant all on oc_autotest.* to 'oc_autotest'@'localhost';"
- uses: actions/checkout@v3
name: Checkout Nextcloud ${{matrix.nextcloud-version-branch}}
with:
repository: nextcloud/server
ref: ${{matrix.nextcloud-version-branch}}
fetch-depth: 1
submodules: true # 'Composer autoloader' is required in order to run the code check

- name: Add switchboardbridge to nextcloud from build job workspace
uses: actions/download-artifact@v3
with:
name: switchboardbridge-build_node${{matrix.node-version}}_php${{ matrix.php-version }} # node version not relevant for this job

- name: Extract workspace
run: |
mkdir apps/switchboardbridge
tar xf switchboardbridge-build_node18.x_php${{ matrix.php-version }}.tar -C apps/switchboardbridge
- name: Install PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
ini-file: apps/switchboardbridge/tests/php.ini
tools: phpcs, phpcbf

- name: Configure NC
run: |
mkdir data
./occ maintenance:install --database-name $DB_DATABASE --database-user oc_autotest --admin-user admin --admin-pass admin --database mysql --database-pass=''
- name: Deploy switchboardbridge plugin
run: |
./occ app:enable switchboardbridge
commit:
needs: [build, deploy]
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 18.x ]
php-version: [ 8.2 ]

name: Commit from PHP${{ matrix.php-version }} and Node${{ matrix.node-version }}

steps:
- uses: actions/checkout@v3
name: Checkout switchboardbridge

- name: Get switchboardbridge build job workspace
uses: actions/download-artifact@v3
with:
name: switchboardbridge-build_node${{ matrix.node-version }}_php${{ matrix.php-version }}

- name: Extract job build workspace
run: tar xvf switchboardbridge-build_node${{ matrix.node-version }}_php${{ matrix.php-version }}.tar -C . --exclude=.git --exclude=node_modules

- name: Commit lint fixes and target Js
uses: stefanzweifel/git-auto-commit-action@v4
with:
repository: .
file_pattern: '*.php *.js *.map *.css'
disable_globbing: true
commit_message: Apply PHP, CSS and JS auto fix changes
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
.idea/*
node_modules
package.json
package-lock.json
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ from the cloud, and processes it as usual.
1. on your B2DROP server go to the <nextcloud>/apps directory
2. git clone this repository using

```git clone https://github.com/clarin-eric/B2Drop2LRSwitchboard.git switchboardBridge ```
```git clone https://github.com/clarin-eric/B2Drop2LRSwitchboard.git switchboardbridge ```

3. enable the app on the B2DROP/nextcloud web interface. The menu item for
managing the apps is hidden in the collapsible menu under the avatar icon on
the top-right corner. ALTERNATIVELY, use:

```php occ app:enable switchboardBridge ```
```php occ app:enable switchboardbridge ```


# Website
Expand Down
6 changes: 3 additions & 3 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<info>
<id>switchboardBridge</id>
<id>switchboardbridge</id>
<name>EUDAT Switchboard bridge</name>
<summary>The Switchboard bridge sends a file from B2DROP to the CLARIN
Language Resource Switchboard.</summary>
Expand All @@ -13,13 +13,13 @@
<version>2.0</version>
<licence>AGPL</licence>
<author>CLARIN-PLUS/EUDAT</author>
<namespace>switchboardBridge</namespace>
<namespace>switchboardbridge</namespace>
<category>integration</category>
<website>https://www.clarin.eu</website>
<bugs>https://github.com/clarin-eric/B2Drop2LRSwitchboard/issues</bugs>
<repository type="git">https://github.com/clarin-eric/B2Drop2LRSwitchboard.git</repository>
<dependencies>
<nextcloud min-version="21" max-version="24" />
<nextcloud min-version="21" max-version="26" />
<lib>curl</lib>
</dependencies>
<rememberlogin>false</rememberlogin>
Expand Down
13 changes: 7 additions & 6 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
/**
* Nextcloud - switchboardbridge App
*
* PHP Version 7-2
* PHP Version 8-2
*
* @category Nextcloud
* @package switchboardBridge
* @package SwitchboardBridge
* @author André Moreira <[email protected]>
* @author CLARIN-PLUS/EUDAT <[email protected]>
* @copyright 2017- CLARIN-PLUS/EUDAT
* @license AGPL3 https://github.com/clarin-eric/B2Drop2LRSwitchboard/blob/master/LICENSE
* @link https://github.com/clarin-eric/B2Drop2LRSwitchboard
* @copyright 2017 CLARIN-PLUS/EUDAT
* @license AGPL v3 https://github.com/clarin-eric/B2Drop2LRS/blob/master/LICENSE
* @link https://github.com/clarin-eric/B2Drop2LRS
*/

namespace OCA\switchboardBridge\AppInfo;
namespace OCA\SwitchboardBridge\AppInfo;

return [];
17 changes: 9 additions & 8 deletions css/settings.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
.regexstatus {
display: inline-block;
height: 16px;
width: 16px;
vertical-align: text-bottom;
display: inline-block;
height: 16px;
width: 16px;
vertical-align: text-bottom;
}

.regexstatus.success {
border-radius: 50%;
border-radius: 50%;
}

span.success {
background: #37ce02;
border-radius: 3px;
background: #37ce02;
border-radius: 3px;
}

span.error {
background: #ce3702;
background: #ce3702;
}
1 change: 0 additions & 1 deletion img/cog.svg

This file was deleted.

Loading

0 comments on commit d1815a7

Please sign in to comment.