tasks/.github/workflows/test.yml
Raimund Schlüßler 3dfa2b8199
Run actions on push as well
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
2020-02-18 20:05:19 +01:00

79 lines
2.5 KiB
YAML

name: Test
on:
pull_request:
push:
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 }};