Skip to content

Merge pull request #1389 from floccusaddon/dependabot/npm_and_yarn/xm… #1546

Merge pull request #1389 from floccusaddon/dependabot/npm_and_yarn/xm…

Merge pull request #1389 from floccusaddon/dependabot/npm_and_yarn/xm… #1546

Workflow file for this run

name: Tests
on:
pull_request:
push:
branches:
- master
- develop
paths:
- 'src/**'
- 'test/**'
- 'package.json'
- 'package-lock.json'
- 'webpack*'
- 'gulpfile.js'
env:
APP_NAME: bookmarks
concurrency:
group: floccus-tests-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
php:
runs-on: ubuntu-latest
env:
SELENIUM_HUB_HOST: hub
TEST_HOST: nextcloud
SERVER_BRANCH: ${{ matrix.server-version }}
NC_APP_VERSION: ${{ matrix.app-version }}
MYSQL_PASSWORD: root
strategy:
# do not stop on another job's failure
fail-fast: false
matrix:
node-version: [14.x]
npm-version: [7.x]
server-version: ['25']
app-version: ['stable12']
floccus-adapter:
- fake
- nextcloud-bookmarks
- nextcloud-bookmarks-old
- webdav-xbel
- webdav-html
- webdav-html-encrypted
- webdav-xbel-encrypted
- google-drive
- google-drive-encrypted
test-name:
- test
- benchmark root
browsers:
- firefox
- chrome
include:
- app-version: stable
server-version: 26
floccus-adapter: nextcloud-bookmarks
test-name: test
browsers: firefox
node-version: 14.x
npm-version: 7.x
- app-version: master
server-version: 26
floccus-adapter: nextcloud-bookmarks
test-name: test
browsers: firefox
node-version: 14.x
npm-version: 7.x
- app-version: master
server-version: 26
floccus-adapter: nextcloud-bookmarks
test-name: benchmark root
browsers: firefox
node-version: 14.x
npm-version: 7.x
- app-version: master
server-version: 26
floccus-adapter: nextcloud-bookmarks-old
test-name: benchmark root
browsers: firefox
node-version: 14.x
npm-version: 7.x
- app-version: stable
server-version: 26
floccus-adapter: fake-noCache
test-name: test
browsers: firefox
node-version: 14.x
npm-version: 7.x
name: ${{matrix.floccus-adapter}}:${{ matrix.test-name}} nc@${{ matrix.server-version }} bm@${{ matrix.app-version }} ${{ matrix.browsers }}
services:
hub:
image: selenium/hub:4.11.0-20230801
ports:
- 4442:4442
- 4443:4443
- 4444:4444
firefox:
image: selenium/node-firefox:4.11.0-20230801
env:
SE_EVENT_BUS_HOST: hub
SE_EVENT_BUS_PUBLISH_PORT: 4442
SE_EVENT_BUS_SUBSCRIBE_PORT: 4443
options: --shm-size="2g"
chrome:
image: selenium/node-chrome:4.11.0-20230801
env:
SE_EVENT_BUS_HOST: hub
SE_EVENT_BUS_PUBLISH_PORT: 4442
SE_EVENT_BUS_SUBSCRIBE_PORT: 4443
options: --shm-size="2g"
nextcloud:
image: nextcloud:${{ matrix.server-version }}
env:
NEXTCLOUD_ADMIN_USER: admin
NEXTCLOUD_ADMIN_PASSWORD: admin
MYSQL_DATABASE: nextcloud
MYSQL_USER: root
MYSQL_PASSWORD: ${{env.MYSQL_PASSWORD}}
MYSQL_HOST: mysql
NEXTCLOUD_TRUSTED_DOMAINS: nextcloud
volumes:
- /home/runner/work/floccus/floccus/apps:/var/www/html/custom_apps
options: --name nextcloud
mysql:
image: mariadb:10.5 # see https://github.com/nextcloud/docker/issues/1536
env:
MYSQL_ROOT_PASSWORD: ${{env.MYSQL_PASSWORD}}
steps:
- name: Checkout floccus
uses: actions/checkout@v2
with:
path: floccus
- name: Checkout bookmarks app
uses: actions/checkout@v2
with:
repository: nextcloud/${{ env.APP_NAME }}
ref: ${{ matrix.app-version }}
path: ${{ env.APP_NAME }}
if: matrix.floccus-adapter == 'nextcloud-bookmarks' || matrix.floccus-adapter == 'nextcloud-bookmarks-old'
- name: Install bookmarks app
shell: bash
run: |
cd ${{ env.APP_NAME }}
composer install --ignore-platform-req=php --no-dev
if: matrix.floccus-adapter == 'nextcloud-bookmarks' || matrix.floccus-adapter == 'nextcloud-bookmarks-old'
- name: Enable bookmarks app
shell: bash
run: |
sudo cp -R ${{env.APP_NAME}} apps/
NEXT_WAIT_TIME=0
until [ $NEXT_WAIT_TIME -eq 25 ] || docker exec --user www-data nextcloud php occ app:enable ${{ env.APP_NAME }}; do
sleep $(( NEXT_WAIT_TIME++ ))
done
[ $NEXT_WAIT_TIME -lt 25 ]
if: matrix.floccus-adapter == 'nextcloud-bookmarks' || matrix.floccus-adapter == 'nextcloud-bookmarks-old'
- name: Enable APCu
run: |
NEXT_WAIT_TIME=0
until [ $NEXT_WAIT_TIME -eq 25 ] || docker exec --user www-data nextcloud php occ config:system:set --value "\\OC\\Memcache\\APCu" memcache.local; do
sleep $(( NEXT_WAIT_TIME++ ))
done
[ $NEXT_WAIT_TIME -lt 25 ]
if: matrix.floccus-adapter != 'fake'
- name: Set up node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Set up npm ${{ matrix.npm-version }}
run: npm i -g npm@"${{ matrix.npm-version }}"
- name: Cache node modules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies & build
working-directory: floccus
run: |
npm ci
npm run build-release --if-present
- name: Wait for Selenium
run: |
sudo apt install -y jq
while ! curl -sSL "http://localhost:4444/wd/hub/status" 2>&1 \
| jq -r '.value.ready' 2>&1 | grep "true" >/dev/null; do
echo 'Waiting for the Grid'
sleep 1
done
echo "Selenium Grid is up - executing tests"
- name: Run tests
working-directory: floccus
env:
SELENIUM_BROWSER: ${{ matrix.browsers }}
FLOCCUS_TEST: ${{matrix.floccus-adapter}} ${{ matrix.test-name}}
GIST_TOKEN: ${{ secrets.GIST_TOKEN }}
GOOGLE_API_REFRESH_TOKEN: ${{ secrets.GOOGLE_API_REFRESH_TOKEN }}
APP_VERSION: ${{ matrix.app-version }}
run: |
npm run test