Merge pull request #844 from nextcloud/add/actions/lint
Move to github actions 1
This commit is contained in:
commit
00618b4e3f
6 changed files with 156 additions and 125 deletions
19
.github/workflows/build.yml
vendored
Normal file
19
.github/workflows/build.yml
vendored
Normal file
|
@ -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
|
43
.github/workflows/lint.yml
vendored
Normal file
43
.github/workflows/lint.yml
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
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
|
||||
- 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
|
||||
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
|
78
.github/workflows/test.yml
vendored
Normal file
78
.github/workflows/test.yml
vendored
Normal file
|
@ -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 }};
|
125
.travis.yml
125
.travis.yml
|
@ -1,125 +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
|
||||
|
||||
# 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
|
||||
|
||||
# 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:
|
||||
- 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:
|
||||
- "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
|
||||
|
||||
- language: php
|
||||
php: 7.3
|
||||
env: "DB=mysql CORE_BRANCH=master PHP_COVERAGE=TRUE"
|
||||
fast_finish: true
|
12
composer.json
Normal file
12
composer.json
Normal file
|
@ -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 \"{}\" \\;"
|
||||
}
|
||||
}
|
|
@ -1,5 +1,9 @@
|
|||
module.exports = {
|
||||
env: {
|
||||
jest: true
|
||||
},
|
||||
rules: {
|
||||
"node/no-missing-import": ["off"],
|
||||
"import/no-unresolved": ["off"],
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue