#pkp/pk-lib/9214 GA Support: upggrade bugfix #41
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: integration-test | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: '0 1 1 * *' | |
env: | |
DBUSERNAME: ojs-ci | |
DBPASSWORD: ojs-ci | |
DBNAME: ojs-ci | |
DBHOST: 127.0.0.1 | |
FILESDIR: files | |
APPLICATION: ojs | |
CYPRESS_BASE_URL: http://127.0.0.1:8000 | |
CYPRESS_DBNAME: ojs-ci | |
CYPRESS_DBUSERNAME: ojs-ci | |
CYPRESS_DBPASSWORD: ojs-ci | |
CYPRESS_DBHOST: 127.0.0.1 | |
CYPRESS_FILESDIR: files | |
PRODUCTION: true | |
jobs: | |
install: | |
name: ${{matrix.pkp-application}}(BRANCH=${{matrix.pkp-branch}} ;PHP=${{matrix.php-versions}}; DB=${{matrix.dbs}}) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php-versions: ['8.1','8.2'] | |
dbs: ['pgsql', 'mysql'] | |
pkp-application: ['ojs'] | |
pkp-branch: ['${{ github.head_ref || github.ref_name }}'] | |
env: | |
DBTYPE: ${{matrix.dbs == 'pgsql' && 'PostgreSQL' || 'MySQLi'}} | |
CYPRESS_DBTYPE: ${{matrix.dbs=='pgsql' && 'PostgreSQL' || 'MySQLi'}} | |
TEST: ${{matrix.dbs}} | |
steps: | |
- name: Install database ${{matrix.dbs}} | |
if: ${{matrix.dbs == 'pgsql'}} | |
run: | | |
sudo apt install postgresql postgresql-contrib | |
sudo dpkg-reconfigure locales | |
sudo sed -i 's\peer\trust\g' /etc/postgresql/14/main/pg_hba.conf | |
- name: Install mysql | |
if: ${{matrix.dbs == 'mysql'}} | |
run: | | |
sudo apt install -q -y mysql-server mysql-client | |
sudo service mysql start | |
- name: Install PKP Application | |
run: | | |
git clone -b ${{matrix.pkp-branch}} https://github.com/${{github.repository}} ~/${{matrix.pkp-application}} | |
cd ~/${{matrix.pkp-application}} | |
git submodule update --init --recursive | |
- name: Setup PHP, extensions and composer | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{matrix.php-versions}} | |
extensions: bcmath, bz2, common, cli, curl, fpm, gd, intl, mbstring, mysql,mysqlnd, mysqli, opcache, pdo_mysql, pgsql, json,soap, xml, zip | |
coverage: xdebug | |
env: | |
update: true | |
- name: Install Composer Dependencies | |
run: | | |
cd ~/${{matrix.pkp-application}} | |
lib/pkp/tools/travis/install-composer-dependencies.sh | |
npm i g -npm && npm i @vue/cli-service && npm i cypress && npm install && npm run build | |
- name: "Validate and lint" | |
if: ${{env.PRODUCTION == 'true'}} | |
run: | | |
mkdir -p $HOME/bin | |
cd ~/${{matrix.pkp-application}} && npm install | |
./lib/pkp/tools/travis/install-linter.sh | |
./lib/pkp/tools/travis/validate-xml.sh | |
./lib/pkp/tools/buildjs.sh -n | |
./lib/pkp/tools/checkHelp.sh | |
./lib/pkp/tools/travis/validate-json.sh | |
npm run lint | |
- name: Start databases server | |
run: | | |
cd ~/${{matrix.pkp-application}} | |
./lib/pkp/tools/travis/prepare-webserver.sh | |
./lib/pkp/tools/travis/prepare-tests.sh | |
- name: Run Server | |
run: | | |
php -S 127.0.0.1:8000 -t . >& access.log & | |
- name: Run Integration tests | |
if: ${{env.PRODUCTION == 'true'}} | |
run: | | |
cd ~/${{matrix.pkp-application}} | |
npx cypress run --headless --browser chrome --config '{"specPattern":["cypress/tests/data/**/*.cy.js"]}' | |
npx cypress run --headless --browser chrome --config '{"specPattern":["lib/pkp/cypress/tests/integration/**/*.cy.js"]}' | |
- name: Run unit tests | |
run: | | |
cd ~/${{matrix.pkp-application}} | |
./lib/pkp/tools/travis/dump-database.sh | |
./lib/pkp/tools/runAllTests.sh -CcPpdR | |
- name: Show failures log | |
if: ${{ failure() }} | |
run: | | |
cd ~/${{ matrix.pkp-application }} | |
cat access.log |