github actions #25
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 * *' | |
jobs: | |
full_ci: | |
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 }}'] | |
services: | |
mysql: | |
image: bitnami/mysql:latest | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_USER: ojs-ci | |
MYSQL_PASSWORD: ojs-ci | |
MYSQL_DATABASE: ojs-ci | |
MYSQL_AUTHENTICATION_PLUGIN: caching_sha2_password | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: ojs-ci | |
POSTGRES_PASSWORD: ojs-ci | |
POSTGRES_DB: ojs-ci | |
ports: | |
- 5432:5432 | |
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=5 | |
env: | |
CYPRESS_BASE_URL: http://127.0.0.1:8000 | |
CYPRESS_DBTYPE: ${{matrix.dbs == 'pgsql' && 'PostgreSQL' || 'MySQLi'}} | |
CYPRESS_DBNAME: ojs-ci | |
CYPRESS_DBUSERNAME: ojs-ci | |
CYPRESS_DBPASSWORD: ojs-ci | |
CYPRESS_DBHOST: 127.0.0.1 | |
CYPRESS_FILESDIR: files | |
DBTYPE: ${{matrix.dbs == 'pgsql' && 'PostgreSQL' || 'MySQLi'}} | |
DBUSERNAME: ojs-ci | |
DBPASSWORD: ojs-ci | |
DBNAME: ojs-ci | |
DBHOST: 127.0.0.1 | |
FILESDIR: files | |
steps: | |
- 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 | |
env: | |
update: true | |
- 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: Prepare Tests | |
run: | | |
cd ~/${{matrix.pkp-application}} | |
cp config.TEMPLATE.inc.php config.inc.php | |
sed -i -e "s/enable_cdn = On/enable_cdn = Off/" config.inc.php | |
mkdir --parents files | |
- name: Collect Workflow Telemetry | |
uses: runforesight/workflow-telemetry-action@v1 | |
- 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: Run Server | |
run: | | |
cd ~/${{matrix.pkp-application}} | |
php -S 127.0.0.1:8000 -t . >& access.log & | |
- name: Cypress application setup (${{matrix.dbs}}) | |
run: | | |
cd ~/${{matrix.pkp-application}} | |
npx cypress run --spec "cypress/tests/data/10-ApplicationSetup" | |
- name: Cypress content setup (${{matrix.dbs}}) | |
run: | | |
cd ~/${{matrix.pkp-application}} | |
npx cypress run --spec "cypress/tests/data/60-content" | |
- name: Grab a ready dataset | |
run: | | |
cd ~/${{matrix.pkp-application}} | |
git clone -b main https://github.com/pkp/datasets ~/datasets | |
- name: Cypress integration tests (${{matrix.dbs}}) | |
run: | | |
cd ~/${{matrix.pkp-application}} | |
npx cypress run --spec "lib/pkp/cypress/tests/integration" | |
- name: Prepare tests | |
run: | | |
cd ~/${{matrix.pkp-application}} | |
./lib/pkp/tools/travis/prepare-tests.sh | |
- name: Set extra variables | |
run: | | |
cd ~/${{matrix.pkp-application}} | |
export DBTYPE_SYMBOLIC=${TEST} | |
export APP=${APPLICATION} | |
- name: Run unit tests | |
run: | | |
cd ~/${{matrix.pkp-application}} | |
./lib/pkp/tools/runAllTests.sh -CcPpdR | |
- name: Show failures log | |
if: ${{ failure() }} | |
run: | | |
cd ~/${{ matrix.pkp-application }} | |
cat access.log |