Skip to content

Merge pull request #67 from UofS-Pulse-Binfo/dependabot/composer/guzz… #27

Merge pull request #67 from UofS-Pulse-Binfo/dependabot/composer/guzz…

Merge pull request #67 from UofS-Pulse-Binfo/dependabot/composer/guzz… #27

Workflow file for this run

name: Run PHPUnit Tests
# Controls when the workflow will run.
# Run this workflow every time a new commit is pushed to your repository
on: [push, pull_request]
jobs:
# This key is the name of the job.
run-tests:
# The type of system that the job will run on.
runs-on: ubuntu-latest
# Matrix Build for this job.
strategy:
matrix:
php-versions: ['7.1', '7.2']
# Name the matrix build so we can tell them apart.
name: PHP Unit Testing of ND Genotypes Module (PHP ${{ matrix.php-versions }})
# Service containers to run with `run-tests`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
env:
POSTGRES_USER: tripaladmin
POSTGRES_PASSWORD: somesupersecurepassword
POSTGRES_DB: testdb
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
# 1) Checkout the repository and setup workspace.
- uses: actions/checkout@v2
# 2) Setup PHP according to the version passed in.
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, php-pgsql, php-gd, php-xml
ini-values: memory_limit=2G
coverage: xdebug
tools: composer, phpunit
# 3) Install Drush/Drupal/Tripal
- name: Setup Drush, Drupal 7.x, Tripal 3.x
id: tripalsetup
uses: tripal/setup-tripal-action@7.x-3.x-1.0
with:
postgres_user: tripaladmin
postgres_pass: somesupersecurepassword
postgres_db: testdb
tripal_version: 7.x-3.x
# LIBRARIES:
# 4-a) Install D3 Libraries
- name: Install D3 Libraries
id: installd3
env:
DRUSH: ${{ steps.tripalsetup.outputs.drush_path }}
DRUPAL_ROOT: ${{ steps.tripalsetup.outputs.drupal_root }}
run: |
cd $DRUPAL_ROOT/sites/all/libraries
wget https://github.com/d3/d3/releases/download/v3.5.14/d3.zip && unzip d3.zip
mkdir d3 && mv d3.js d3/ && mv d3.min.js d3/
# DEPENDENCIES:
# 5-a) Install Libraries Dependencies
- name: Install Libraries Dependencies
id: installlibraries
env:
DRUSH: ${{ steps.tripalsetup.outputs.drush_path }}
DRUPAL_ROOT: ${{ steps.tripalsetup.outputs.drupal_root }}
run: |
cd $DRUPAL_ROOT
$DRUSH en libraries -y
# 5-b) Install Tripal Download API Dependencies
- name: Install Tripal Download API Dependencies
id: installtripaldownloadapi
env:
DRUSH: ${{ steps.tripalsetup.outputs.drush_path }}
DRUPAL_ROOT: ${{ steps.tripalsetup.outputs.drupal_root }}
run: |
cd $DRUPAL_ROOT/sites/all/modules
git clone https://github.com/tripal/trpdownload_api.git
cd $DRUPAL_ROOT
$DRUSH en -y trpdownload_api
# 5-c) Install Tripal D3 Dependencies
- name: Install Tripal D3 Dependencies
id: installtripald3
env:
DRUSH: ${{ steps.tripalsetup.outputs.drush_path }}
DRUPAL_ROOT: ${{ steps.tripalsetup.outputs.drupal_root }}
run: |
cd $DRUPAL_ROOT/sites/all/modules
git clone https://github.com/tripal/tripald3.git
cd $DRUPAL_ROOT
$DRUSH en -y tripald3
# 6) Install ND Genotypes
- name: Install ND Genotypes
id: installndgenotypes
env:
DRUSH: ${{ steps.tripalsetup.outputs.drush_path }}
DRUPAL_ROOT: ${{ steps.tripalsetup.outputs.drupal_root }}
run: |
mkdir -p $DRUPAL_ROOT/sites/all/modules/nd_genotypes
cp -R * $DRUPAL_ROOT/sites/all/modules/nd_genotypes
cd $DRUPAL_ROOT
$DRUSH en -y nd_genotypes
# 7) Runs the PHPUnit tests.
# https://github.com/mheap/phpunit-github-actions-printer is used
# to report PHPUnit fails in a meaningful way to github in PRs.
- name: PHPUnit Tests
env:
DRUSH: ${{ steps.tripalsetup.outputs.drush_path }}
DRUPAL_ROOT: ${{ steps.tripalsetup.outputs.drupal_root }}
run: |
cd $DRUPAL_ROOT/sites/all/modules/nd_genotypes
drush php-script tests/createTables.drush.php
composer require --dev mheap/phpunit-github-actions-printer --quiet
composer update --quiet
./vendor/bin/phpunit --printer mheap\\GithubActionsReporter\\Printer