diff --git a/.github/actions/tests.sh b/.github/actions/tests.sh new file mode 100755 index 0000000..8129a66 --- /dev/null +++ b/.github/actions/tests.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -e + +# Add python libraries +sudo apt update +sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev wget libbz2-dev +sudo add-apt-repository ppa:deadsnakes/ppa -y +sudo apt install python3.7 +sudo apt-get install python3-lxml xmlstarlet +pip install lxml + + +git clone -b ${APP_BRANCH} https://github.com/pkp/jatsTemplate plugins/generic/jatsTemplate +php lib/pkp/tools/installPluginVersion.php plugins/generic/jatsTemplate/version.xml +php lib/pkp/tools/installPluginVersion.php plugins/oaiMetadataFormats/oaiJats/version.xml + +echo "Run cypress tests" +npx cypress run --config '{"specPattern":["plugins/oaiMetadataFormats/oaiJats/cypress/tests/functional/*.cy.js"]}' + +wget -q -O - "http://localhost/index.php/publicknowledge/oai?verb=ListRecords&metadataPrefix=jats" | xmlstarlet sel -N x="https://jats.nlm.nih.gov/publishing/1.1/" -t -c "(//x:article)[1]" > jats.xml +wget -q "https://eruditps.docs.erudit.org/_downloads/f0f9fb861e01a47df2ce48f588524d29/erudit-style-0.3.sch" + +echo "Validate against erudit-style" +python3 plugins/oaiMetadataFormats/oaiJats/validate.py jats.xml erudit-style-0.3.sch \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..879457a --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,30 @@ +on: [push] +name: oaiJats +jobs: + oaiJats: + 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: oaiJats + 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 6052a40..0000000 --- a/.travis.yml +++ /dev/null @@ -1,65 +0,0 @@ -# @file -# .travis.yml - PKP Plugins Integration - -dist: bionic -os: linux -language: php -python: - - "3.8" - -addons: - postgresql: "9.5" - apt: - update: true - packages: - - libvulkan1 - - libu2f-udev - -sudo: required - -php: - - 8.1.0 - - 8.2.0 -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 - # Install Schematron validation and XML munging toolset - - sudo apt-get install xmlstarlet python3-lxml - - wget -q "https://eruditps.docs.erudit.org/_downloads/f0f9fb861e01a47df2ce48f588524d29/erudit-style-0.3.sch" - # Build/install dependencies - - lib/pkp/tools/travis/install-composer-dependencies.sh - - npm i g -npm && npm install && npm run build - # Install this plugin's source - - cp -r ${TRAVIS_BUILD_DIR} ~/${APPLICATION}/plugins/oaiMetadataFormats/oaiJats - # This plugin also requires the OAI JATS plugin (they are tested together via this script) - - git clone -b ${BRANCH} https://github.com/pkp/jatsTemplate plugins/generic/jatsTemplate - -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 - - php lib/pkp/tools/installPluginVersion.php plugins/generic/jatsTemplate/version.xml - - php lib/pkp/tools/installPluginVersion.php plugins/oaiMetadataFormats/oaiJats/version.xml - - # Run Cypress tests - - $(npm bin)/cypress run --config '{"specPattern":["plugins/oaiMetadataFormats/oaiJats/cypress/tests/functional/*.cy.js"]}' - - # Fetch a JATS document through oaiJats, removing the OAI-PMH wrapper using xmlstarlet - - wget -q -O - "http://localhost/index.php/publicknowledge/oai?verb=ListRecords&metadataPrefix=jats" | xmlstarlet sel -N x="https://jats.nlm.nih.gov/publishing/1.1/" -t -c "(//x:article)[1]" > jats.xml - - python3 plugins/oaiMetadataFormats/oaiJats/validate.py jats.xml erudit-style-0.3.sch - -after_failure: - - cat error.log - - sudo apt-get install sharutils - - tar cz cypress/screenshots | uuencode /dev/stdout