enh(Git): Mention profile label in commit message #1893
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
init: | |
runs-on: ubuntu-latest | |
strategy: | |
# do not stop on another job's failure | |
fail-fast: false | |
matrix: | |
node-version: [ 20.x ] | |
npm-version: [ 10.x ] | |
steps: | |
- name: Checkout floccus | |
uses: actions/checkout@v2 | |
with: | |
path: floccus | |
- 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: Save context | |
uses: buildjet/cache/save@v3 | |
with: | |
key: selenium-context-${{ github.run_id }} | |
path: ./ | |
selenium: | |
runs-on: ubuntu-latest | |
needs: init | |
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: [20.x] | |
npm-version: [10.x] | |
server-version: ['30'] | |
app-version: ['stable'] | |
floccus-adapter: | |
- fake | |
- nextcloud-bookmarks | |
- webdav-xbel | |
- webdav-html | |
- webdav-html-encrypted | |
- webdav-xbel-encrypted | |
- git-xbel | |
- git-html | |
- google-drive | |
- google-drive-encrypted | |
- linkwarden | |
test-name: | |
- test | |
browsers: | |
- firefox | |
- chrome | |
include: | |
- app-version: master | |
server-version: 30 | |
floccus-adapter: nextcloud-bookmarks | |
test-name: test | |
browsers: firefox | |
node-version: 14.x | |
npm-version: 7.x | |
- app-version: master | |
server-version: 30 | |
floccus-adapter: nextcloud-bookmarks | |
test-name: benchmark root | |
browsers: firefox | |
node-version: 14.x | |
npm-version: 7.x | |
- app-version: stable | |
server-version: 28 | |
floccus-adapter: fake-noCache | |
test-name: test | |
browsers: firefox | |
node-version: 14.x | |
npm-version: 7.x | |
name: ${{ matrix.browsers == 'firefox' && '🦊' || '🔵' }} ${{matrix.floccus-adapter}}:${{ matrix.test-name}} ⭐${{ matrix.app-version }} | |
services: | |
hub: | |
image: selenium/hub:4.20.0-20240425 | |
ports: | |
- 4442:4442 | |
- 4443:4443 | |
- 4444:4444 | |
firefox: | |
image: selenium/node-firefox:4.20.0-20240425 | |
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.20.0-20240425 | |
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: Restore context | |
uses: buildjet/cache/restore@v3 | |
with: | |
fail-on-cache-miss: true | |
key: selenium-context-${{ github.run_id }} | |
path: ./ | |
- 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: 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: Setup git http server | |
run: | | |
mkdir __fixtures__ | |
cd __fixtures__ | |
git init --bare test.git -b main | |
npx git-http-server & | |
npx htpasswd -cb test.git/.htpasswd admin admin | |
if: matrix.floccus-adapter == 'git-xbel' || matrix.floccus-adapter == 'git-html' | |
- name: Run git adapter tests | |
working-directory: floccus | |
env: | |
SELENIUM_BROWSER: ${{ matrix.browsers }} | |
FLOCCUS_TEST: ${{matrix.floccus-adapter}} ${{ matrix.test-name}} | |
FLOCCUS_TEST_SEED: ${{ github.sha }} | |
TEST_HOST: 172.17.0.1:8174 | |
run: | | |
npm run test | |
if: matrix.floccus-adapter == 'git-xbel' || matrix.floccus-adapter == 'git-html' | |
- name: Run tests | |
working-directory: floccus | |
env: | |
SELENIUM_BROWSER: ${{ matrix.browsers }} | |
FLOCCUS_TEST: ${{matrix.floccus-adapter}} ${{ matrix.test-name}} | |
FLOCCUS_TEST_SEED: ${{ github.sha }} | |
GIST_TOKEN: ${{ secrets.GIST_TOKEN }} | |
GOOGLE_API_REFRESH_TOKEN: ${{ secrets.GOOGLE_API_REFRESH_TOKEN }} | |
LINKWARDEN_TOKEN: ${{ secrets.LINKWARDEN_TOKEN }} | |
APP_VERSION: ${{ matrix.app-version }} | |
run: | | |
npm run test | |
if: matrix.floccus-adapter != 'git-xbel' && matrix.floccus-adapter != 'git-html' | |
- name: Cancelling parallel jobs | |
if: failure() && matrix.floccus-adapter == 'fake' && matrix.test-name == 'test' | |
uses: andymckay/[email protected] | |
summary: | |
runs-on: ubuntu-latest | |
needs: [ init, selenium ] | |
if: always() | |
name: selenium-summary | |
steps: | |
- name: Summary status | |
run: if ${{ needs.init.result != 'success' || ( needs.selenium.result != 'success' && needs.selenium.result != 'skipped' ) }}; then exit 1; fi |