From a19861c8da93e616d361f1c4c0035a474755e2a6 Mon Sep 17 00:00:00 2001 From: withanage Date: Mon, 29 Jul 2024 22:28:28 +0200 Subject: [PATCH] Add github actions support for main --- .github/actions/tests.sh | 36 +++++++++++++++++++ .github/workflows/main.yml | 30 ++++++++++++++++ .travis.yml | 73 -------------------------------------- 3 files changed, 66 insertions(+), 73 deletions(-) create mode 100755 .github/actions/tests.sh create mode 100644 .github/workflows/main.yml delete mode 100644 .travis.yml diff --git a/.github/actions/tests.sh b/.github/actions/tests.sh new file mode 100755 index 0000000..5b37bb7 --- /dev/null +++ b/.github/actions/tests.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +set -e + +# Install JRE and Lucene +sudo apt-get install openjdk-11-jre +cd plugins/generic/lucene/lib +wget https://archive.apache.org/dist/lucene/solr/8.1.1/solr-8.1.1.zip +unzip solr-8.1.1.zip +ln -s solr-8.1.1 solr +cd ../../../../ +# Ensure we don't get any false positives from the built-in search index by deleting its contents. +#echo "DELETE FROM submission_search_object_keywords; DELETE FROM submission_search_keyword_list; DELETE FROM submission_search_objects;" | ~//datasets/tools/dbclient.sh +if [[ "$TEST" == "mysql" || "$TEST" == "mariadb" ]]; then + sudo mysql -u root -e "use ojs-ci; DELETE FROM submission_search_object_keywords; DELETE FROM submission_search_keyword_list; DELETE FROM submission_search_objects; "; +elif [[ "$TEST" == "psql" ]]; then + psql -d ojs-ci -c "DELETE FROM submission_search_object_keywords;" + psql -d ojs-ci -c "DELETE FROM submission_search_keyword_list;" + psql -d ojs-ci -c "DELETE FROM submission_search_objects;" + +fi + +#Install plugin version (not included in dataset DB dump). FIXME: Build and install plugin through upload? +php lib/pkp/tools/installPluginVersion.php plugins/generic/lucene/version.xml + +# Check Lucene configuration and start server +# (Lucene plugin does not like relative file paths; make absolute in config file) +sed -i -e "s/files_dir = files/files_dir = \/home\/runner\/ojs\/files/" config.inc.php +cd plugins/generic/lucene/embedded/bin +./chkconfig.sh +./start.sh + +# Run plugin test set +cd ~/$APPLICATION + +npx cypress run --config '{"specPattern":["plugins/generic/lucene/cypress/tests/functional/*.cy.js"]}' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..69c41b0 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,30 @@ +on: [push] +name: lucene +jobs: + lucene: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - application: ojs + php-version: 8.3 + database: mysql + - application: ojs + php-version: 8.2 + database: mysql + - application: ojs + php-version: 8.3 + database: pgsql + - application: ojs + php-version: 8.2 + database: pgsql + name: lucene + steps: + - uses: pkp/pkp-github-actions@v1 + with: + node_version: 20 + branch: main + repository: pkp + plugin: true + dataset_inject: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index fe6610d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,73 +0,0 @@ -# @file -# .travis.yml - PKP Plugins Integration - -dist: focal -os: linux -language: php - -addons: - postgresql: "9.5" - apt: - update: true - packages: - - libvulkan1 - - libu2f-udev - -php: - - 8.1 -env: - - APPLICATION=ojs BRANCH=main TEST=mysql - - APPLICATION=ojs BRANCH=main TEST=pgsql - -install: - # Prepare OJS/OMP environment - - git clone -b ${BRANCH} https://github.com/pkp/${APPLICATION} ~/${APPLICATION} - - cd ~/${APPLICATION} - - git submodule update --init --recursive - - source lib/pkp/tools/travis/prepare-tests.sh - - lib/pkp/tools/travis/prepare-webserver.sh - - # Build/install dependencies - - lib/pkp/tools/travis/install-composer-dependencies.sh - - npm i g -npm && npm install && npm run build - - # Install plugin source (Lucene scripts do not like symbolic links) - - mv ${TRAVIS_BUILD_DIR} ~/${APPLICATION}/plugins/generic/lucene - - # Install JRE and Lucene - - sudo apt-get install openjdk-11-jre - - cd plugins/generic/lucene/lib - - wget https://archive.apache.org/dist/lucene/solr/8.1.1/solr-8.1.1.zip - - unzip solr-8.1.1.zip - - ln -s solr-8.1.1 solr - - cd ../../../.. - -script: - # Install data set - - git clone https://github.com/pkp/datasets - - cp datasets/${APPLICATION}/${BRANCH}/${TEST}/config.inc.php . - - cp -rf datasets/${APPLICATION}/${BRANCH}/${TEST}/public/* public/ - - cp -rf datasets/${APPLICATION}/${BRANCH}/${TEST}/files/* files/ - - cat datasets/${APPLICATION}/${BRANCH}/${TEST}/database.sql | ./datasets/tools/dbclient.sh - - # Ensure we don't get any false positives from the built-in search index by deleting its contents. - - echo "DELETE FROM submission_search_object_keywords; DELETE FROM submission_search_keyword_list; DELETE FROM submission_search_objects;" | ./datasets/tools/dbclient.sh - - # Install plugin version (not included in dataset DB dump). FIXME: Build and install plugin through upload? - - php lib/pkp/tools/installPluginVersion.php plugins/generic/lucene/version.xml - - # Check Lucene configuration and start server - # (Lucene plugin does not like relative file paths; make absolute in config file) - - sed -i -e "s/files_dir = files/files_dir = \/home\/travis\/ojs\/files/" config.inc.php - - cd plugins/generic/lucene/embedded/bin - - ./chkconfig.sh - - ./start.sh - - cd ../../../../.. - - # Run plugin test set - - $(npm bin)/cypress run --config '{"specPattern":["plugins/generic/lucene/cypress/tests/functional/*.cy.js"]}' - -after_failure: - - cat error.log - - sudo apt-get install sharutils - - tar cz cypress/screenshots | uuencode /dev/stdout