From 6fa74fa5d5089899690f94853fc9efe9382ca492 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6?= Date: Thu, 30 Jan 2020 09:32:31 +0100 Subject: [PATCH 1/6] Create lint.yml --- .github/workflow/lint.yml | 36 ++++++++++++++++++++++++++++++++++++ composer.json | 12 ++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 .github/workflow/lint.yml create mode 100644 composer.json diff --git a/.github/workflow/lint.yml b/.github/workflow/lint.yml new file mode 100644 index 00000000..3e50644f --- /dev/null +++ b/.github/workflow/lint.yml @@ -0,0 +1,36 @@ +name: Lint +on: pull_request + +jobs: + php-linters: + runs-on: ubuntu-latest + strategy: + matrix: + php-versions: ['7.2', '7.3', 7.4] + name: php${{ matrix.php-versions }} lint + steps: + - name: Checkout + uses: actions/checkout@master + - name: Set up php${{ matrix.php-versions }} + uses: shivammathur/setup-php@master + with: + php-version: ${{ matrix.php-versions }} + coverage: none + - name: Lint + run: composer run lint + + node-linters: + runs-on: ubuntu-latest + name: ESLint + steps: + - uses: actions/checkout@master + - name: Set up Node + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: npm install + run: npm ci + - name: eslint + run: npm run lint + env: + CI: true diff --git a/composer.json b/composer.json new file mode 100644 index 00000000..0ca66095 --- /dev/null +++ b/composer.json @@ -0,0 +1,12 @@ +{ + "name": "nextcloud/tasks", + "description": "Lint config for nextcloud/tasks", + "license": "MIT", + "config": { + "optimize-autoloader": true, + "classmap-authoritative": true + }, + "scripts": { + "lint": "find . -name \\*.php -not -path './vendor/*' -exec php -l \"{}\" \\;" + } +} From e1bd589646892ff71c05c0702a84cd3a62a76b4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6?= Date: Thu, 30 Jan 2020 09:35:13 +0100 Subject: [PATCH 2/6] Remove old npm tests --- .github/{workflow => workflows}/lint.yml | 0 .travis.yml | 14 -------------- 2 files changed, 14 deletions(-) rename .github/{workflow => workflows}/lint.yml (100%) diff --git a/.github/workflow/lint.yml b/.github/workflows/lint.yml similarity index 100% rename from .github/workflow/lint.yml rename to .github/workflows/lint.yml diff --git a/.travis.yml b/.travis.yml index 096e13e2..062c9df7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -63,9 +63,6 @@ script: - xmllint appinfo/info.xml --schema info.xsd --noout - rm info.xsd - # Check PHP syntax errors - - find . -name \*.php -not -path './vendor/*' -exec php -l "{}" \; - # Run server's app code checker - php ../../occ app:check-code tasks @@ -86,17 +83,6 @@ after_failure: matrix: include: - - stage: build - language: node_js - node_js: - - "10" - before_install: - before_script: - script: - - make - after_failure: - after_success: - - stage: test language: node_js node_js: From 2c14c3803017d297f921182291477e1c47e14b74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raimund=20Schl=C3=BC=C3=9Fler?= Date: Sun, 9 Feb 2020 22:10:38 +0100 Subject: [PATCH 3/6] Add github test and build config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raimund Schlüßler --- .github/workflows/build.yml | 19 +++++++++ .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 78 +++++++++++++++++++++++++++++++++++++ .travis.yml | 19 --------- 4 files changed, 98 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..6fb9d8eb --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,19 @@ +name: Build +on: + pull_request: + branches: + - master + - stable* + +jobs: + node-build: + runs-on: ubuntu-latest + name: Javascript build + steps: + - uses: actions/checkout@master + - name: Set up Node + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Make + run: make diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3e50644f..73e95dde 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['7.2', '7.3', 7.4] + php-versions: ['7.2', '7.3', '7.4'] name: php${{ matrix.php-versions }} lint steps: - name: Checkout diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..d7139a8e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,78 @@ +name: Test +on: + pull_request: + branches: + - master + - stable* + +jobs: + php-test: + runs-on: ubuntu-latest + strategy: + matrix: + php-versions: ['7.2', '7.3', '7.4'] + name: php${{ matrix.php-versions }} test + steps: + - name: Checkout + uses: actions/checkout@master + - name: Set up php${{ matrix.php-versions }} + if: matrix.php-versions != '7.4' + uses: shivammathur/setup-php@master + with: + php-version: ${{ matrix.php-versions }} + coverage: none + - name: Set up php${{ matrix.php-versions }} with coverage + if: matrix.php-versions == '7.4' + uses: shivammathur/setup-php@master + with: + php-version: ${{ matrix.php-versions }} + coverage: xdebug + - name: Setup Nextcloud + run: | + mysql -u root -proot -e 'create database oc_autotest;' + mysql -u root -proot -e "CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY '';" + mysql -u root -proot -e "GRANT ALL ON oc_autotest.* TO 'oc_autotest'@'localhost';" + cd .. + git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b master core + cp -r tasks core/apps/ + php -f core/occ maintenance:install --database-name oc_autotest --database-user oc_autotest --admin-user admin --admin-pass admin --database mysql --database-pass='' + - name: Setup Tasks + run: | + cd .. + php -f ./core/occ app:enable tasks + # Enable app twice to check occ errors of registered commands + php -f core/occ app:enable tasks + cd core/apps/tasks + php ../../occ app:check-code tasks + - name: Test PHP + if: matrix.php-versions != '7.4' + run: | + cd ../core/apps/tasks + make test-php + # Check php test coverage and upload to codecov + - name: Test PHP with coverage + if: matrix.php-versions == '7.4' + run: | + cd ../core/apps/tasks + make test-php-coverage + bash <(curl -s https://codecov.io/bash) -cF php -t ${{ secrets.CODECOV_TOKEN }}; + + node-test: + runs-on: ubuntu-latest + name: Javascript test + steps: + - uses: actions/checkout@master + - name: Set up Node + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: npm install + run: npm ci + - name: Set up Codecov + run: npm install -g codecov + - name: Test + run: npm run test + env: + CI: true + - name: Upload coverage + run: bash <(curl -s https://codecov.io/bash) -cF javascript -t ${{ secrets.CODECOV_TOKEN }}; diff --git a/.travis.yml b/.travis.yml index 062c9df7..9932ad57 100644 --- a/.travis.yml +++ b/.travis.yml @@ -83,25 +83,6 @@ after_failure: matrix: include: - - stage: test - language: node_js - node_js: - - "10" - - before_install: - before_script: - - install: - - npm install -g codecov - - script: - - make dev-setup - - make test - - bash <(curl -s https://codecov.io/bash) -cF javascript; - - after_failure: - after_success: - - language: php php: 7.2 From b58591ffed71d43c32a0f6c5d67785e19601bf7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raimund=20Schl=C3=BC=C3=9Fler?= Date: Sun, 9 Feb 2020 22:27:27 +0100 Subject: [PATCH 4/6] Disable failing eslint rules for tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raimund Schlüßler --- tests/javascript/unit/.eslintrc.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/javascript/unit/.eslintrc.js b/tests/javascript/unit/.eslintrc.js index 391d41eb..c562f13d 100644 --- a/tests/javascript/unit/.eslintrc.js +++ b/tests/javascript/unit/.eslintrc.js @@ -1,5 +1,9 @@ module.exports = { env: { jest: true + }, + rules: { + "node/no-missing-import": ["off"], + "import/no-unresolved": ["off"], } } From 86c3cb70071f35715f4fd1a19ef3b987d3d38879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raimund=20Schl=C3=BC=C3=9Fler?= Date: Mon, 10 Feb 2020 13:36:07 +0100 Subject: [PATCH 5/6] Delete travis config --- .travis.yml | 92 ----------------------------------------------------- 1 file changed, 92 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9932ad57..00000000 --- a/.travis.yml +++ /dev/null @@ -1,92 +0,0 @@ -dist: trusty - -addons: - apt: - packages: - - mysql-server-5.6 - - mysql-client-core-5.6 - - mysql-client-5.6 - - libxml2-utils - -branches: - only: - - master - - /^stable\d+(\.\d+)?$/ - -cache: - directories: - - "$HOME/.composer/cache/files" - - "$HOME/.npm" - - -env: - global: - - CORE_BRANCH=master - - PHP_COVERAGE=FALSE - - DB=mysql - -before_install: - - php --info - - # Set up DB - - if [[ "$DB" == 'pgsql' ]]; then createuser -U travis -s oc_autotest; 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 '';"; fi - - if [[ "$DB" == 'mysql' ]]; then mysql -u root -e "GRANT ALL ON oc_autotest.* TO 'oc_autotest'@'localhost';"; fi - - cd .. - - git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b $CORE_BRANCH core - - mv tasks core/apps/ - -before_script: - # Set up core - - php -f core/occ maintenance:install --database-name oc_autotest --database-user oc_autotest --admin-user admin --admin-pass admin --database $DB --database-pass='' - - # Set up app - - php -f core/occ app:enable tasks - - # Enable app twice to check occ errors of registered commands - - php -f core/occ app:enable tasks - - cd core/apps/tasks - - # Run JS tests - - npm install -g npm@latest - - make dev-setup - - # XDebug is only needed if we report coverage -> speeds up other builds - - if [[ "$PHP_COVERAGE" = "FALSE" ]]; - then phpenv config-rm xdebug.ini; - fi - -script: - # Check info.xml schema validity - - wget https://apps.nextcloud.com/schema/apps/info.xsd - - xmllint appinfo/info.xml --schema info.xsd --noout - - rm info.xsd - - # Run server's app code checker - - php ../../occ app:check-code tasks - - # Test php - - make test-php - - if [[ "$PHP_COVERAGE" = "TRUE" ]]; - then make test-php-coverage; - else make test-php; - fi - -after_success: - - if [[ "$PHP_COVERAGE" = "TRUE" ]]; - then bash <(curl -s https://codecov.io/bash) -cF php; - fi - -after_failure: - - cat ../../data/nextcloud.log - -matrix: - include: - - language: php - php: 7.2 - - - language: php - php: 7.3 - env: "DB=mysql CORE_BRANCH=master PHP_COVERAGE=TRUE" - fast_finish: true From abe9abd3232cb6539e823da56955c46f6662e2bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raimund=20Schl=C3=BC=C3=9Fler?= Date: Mon, 10 Feb 2020 15:27:10 +0100 Subject: [PATCH 6/6] Also test info.xml validity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raimund Schlüßler --- .github/workflows/lint.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 73e95dde..e3023437 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,6 +18,13 @@ jobs: coverage: none - name: Lint run: composer run lint + - name: Download schema + run: wget https://apps.nextcloud.com/schema/apps/info.xsd + - name: Lint info.xml + uses: ChristophWurst/xmllint-action@v1 + with: + xml-file: ./appinfo/info.xml + xml-schema-file: ./info.xsd node-linters: runs-on: ubuntu-latest