# @file
# .travis.yml - PKP Plugins Integration

dist: focal
os: linux
language: php

addons:
  chrome: beta
  postgresql: "9.5"
  apt:
    update: true
    packages:
      - libvulkan1
      - libu2f-udev

sudo: required

php:
  - 8.1.0
  - 8.2.0

env:
  matrix:
  - APPLICATION=ojs BRANCH=stable-3_4_0 TEST=mysql ORCID_URL=https://sandbox.orcid.org ORCID_APIPATH=https://api.sandbox.orcid.org  ORCID_APITYPE="Member Sandbox"
  - APPLICATION=ojs BRANCH=stable-3_4_0 TEST=pgsql ORCID_URL=https://sandbox.orcid.org ORCID_APIPATH=https://api.sandbox.orcid.org  ORCID_APITYPE="Member Sandbox"
  - APPLICATION=ops BRANCH=stable-3_4_0 TEST=mysql ORCID_URL=https://sandbox.orcid.org ORCID_APIPATH=https://api.sandbox.orcid.org  ORCID_APITYPE="Member Sandbox"
  - APPLICATION=ops BRANCH=stable-3_4_0 TEST=pgsql ORCID_URL=https://sandbox.orcid.org ORCID_APIPATH=https://api.sandbox.orcid.org  ORCID_APITYPE="Member Sandbox"
  global:
  - secure: m+AQsfJZriXSWFqZI0GztPJIGAj4PHvxjrXeNSrk+ew4MMlEeZCvKUtnAY+/C9LXa06Q2s+TpMOfAV+B6qcg3Cy1nP5Lbsj4qdIhJpqj1MxSqEZrJn5JonDthD2pQ4GlltJm6vUnlGF40pPF1JKoUl8vXCXLSgFppBnYP7jw9XSPwdzlK6Wcm1JhFQz2qJ7nojUj7q3mZuie89aSdZG45xMzsi8ndTQI8KlF0uKQ0UgvZMhYO5jd2uRHodcRZr7fPvIjfFAueMqsLuVsnQCl5d+xb+esH4ZhBQcAa1s7Q8ak/XE3zss6d3sx7FEsSTBsurNMIDLKtJtRRyD33sQTSvyHtUta6Hj2NjY6QXDc8lYZUGgLeZ5z9QyQ73oW3tkT1rz82e27MFpSB00TjIIxmUvxdbFTD9vD5yoaRq9O9bXG6IyC7zYggXpYvcbw1j+0z6hp4kAY6iF8EQRG3Vd08noyOH5qtM1LBZ2czqUBeE70PoBX1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IvYT1nBHBScznnE9HSYANH2gSE8YhMiUMi9Fb14Koys9HtB9p+jGwKeezmk0uO2vii/pRe4RNwHvMZiyekXs93S1Pd6Yts6b9p1xNQ=

install:
- 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
- lib/pkp/tools/travis/install-composer-dependencies.sh
- npm i g -npm && npm install && npm run build
- rm -rf ~/${APPLICATION}/plugins/generic/orcidProfile
- ln -s ${TRAVIS_BUILD_DIR} ~/${APPLICATION}/plugins/generic/orcidProfile

script:
- $(npm bin)/cypress run --spec "cypress/tests/data/10-ApplicationSetup/10-Installation.cy.js,cypress/tests/data/10-ApplicationSetup/20-CreateContext.cy.js"
- $(npm bin)/cypress run --env orcid_url=$ORCID_URL,orcid_apiPath=$ORCID_APIPATH,orcid_apiType=$ORCID_APITYPE,orcid_clientId=$ORCID_CLIENTID,orcid_clientSecret=$ORCID_SECRET,orcid_email=$ORCID_EMAIL,orcid_emailPassword=$ORCID_EMAILPASSWORD --config '{"specPattern":["plugins/generic/orcidProfile/cypress/tests/functional/*.cy.js"]}'

after_failure:
  - cat error.log
  - sudo apt-get install sharutils
  - tar cz cypress/screenshots | uuencode /dev/stdout
