Skip to content

Commit

Permalink
Merge pull request #1129 from tripal/fix-CI
Browse files Browse the repository at this point in the history
Replace Travis CI with GitHub Actions
  • Loading branch information
spficklin committed Nov 4, 2020
2 parents 66e1e7c + 5c520ae commit a95e5a8
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 88 deletions.
136 changes: 136 additions & 0 deletions .github/workflows/phpunit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Run our PHPUnit tests
name: PHPUnit-Tests

# Controls when the action will run.
# Run this workflow every time a new commit is pushed to your repository
on: [push, pull_request]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
run-tests:
# The type of runner 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: PHPUnit Testing of Tripal Core (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: postgres
POSTGRES_PASSWORD: dbpass
POSTGRES_DB: test_db
# 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 represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Repository
uses: actions/checkout@v2
# Sets up the PHP environment for PHP 7.2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
# Install extensions for PHP-PostgreSQL
extensions: mbstring, intl, php-pgsql, php-gd, php-xml
# Increase memory limit to 2G
ini-values: memory_limit=2G
# Enable xdebug for coverage reporting
coverage: xdebug
# Install composer and phpunit globally.
tools: composer, phpunit
# Install Drush 8.x globally
# NOTE: `drush` is not available without the full path.
# I tried adding it to the path but that broke other things.
- name: Install Drush
run: |
composer global require "drush/drush:~8"
/home/runner/.composer/vendor/bin/drush --version
# Install Drupal and Drupal module dependencies for Tripal.
# It also patches Drupal.
- name: Install Drupal
env:
DRUSH: "/home/runner/.composer/vendor/bin/drush"
DRUPAL_ROOT: "/home/runner/work/drupal"
POSTGRES_CONNECTION_STRING: 'pgsql://postgres:dbpass@localhost:5432/test_db'
ACCOUNT_NAME: tripaladmin
ACCOUNT_PASS: somereallysecurepassword
run: |
echo "==> Downloading Drupal"
cd /home/runner/work
$DRUSH dl drupal-7 -y
mv drupal-7* drupal
echo "==> Installing Drupal"
cd $DRUPAL_ROOT
$DRUSH si -y --root=$DRUPAL_ROOT \
--db-url=$POSTGRES_CONNECTION_STRING \
--account-name=$ACCOUNT_NAME \
--account-pass=$ACCOUNT_PASS \
--site-mail=admin@example.com \
--site-name=Tripal3
echo "==> Downloading dependencies"
$DRUSH dl -y views ctools entity redirect date ds field_group field_group_table
echo "==> Enabling Dependencies"
$DRUSH en -y views ctools entity redirect date ds field_group field_group_table
echo "==> Apply Drupal Patch"
cd $DRUPAL_ROOT
wget --no-check-certificate https://drupal.org/files/drupal.pgsql-bytea.27.patch
patch -p1 < drupal.pgsql-bytea.27.patch
# Install Tripal, Chado and prepares the Drupal/Chado databases
# Also patches views.
- name: Install Tripal
env:
DRUSH: "/home/runner/.composer/vendor/bin/drush"
DRUPAL_ROOT: "/home/runner/work/drupal"
POSTGRES_CONNECTION_STRING: 'pgsql://postgres:dbpass@localhost:5432/test_db'
ACCOUNT_NAME: tripaladmin
ACCOUNT_PASS: somereallysecurepassword
run: |
echo "==> Move Tripal into the Drupal modules directory"
ls /home/runner/work/tripal/tripal
cp -R /home/runner/work/tripal/tripal $DRUPAL_ROOT/sites/all/modules
echo "==> Apply Views Patch"
cd $DRUPAL_ROOT/sites/all/modules/views
patch -p1 < ../tripal/tripal_chado_views/views-sql-compliant-three-tier-naming-1971160-30.patch
echo "==> Install Tripal"
cd $DRUPAL_ROOT
$DRUSH en -y tripal tripal_chado tripal_chado_views tripal_ws tripal_ds
echo "==> Install Chado"
$DRUSH eval "module_load_include('inc', 'tripal_chado', 'includes/tripal_chado.install'); tripal_chado_load_drush_submit('Install Chado v1.3');"
$DRUSH trp-run-jobs --username=$ACCOUNT_NAME
echo "==> Prepare Chado"
$DRUSH eval "module_load_include('inc', 'tripal_chado', 'includes/setup/tripal_chado.setup'); tripal_chado_prepare_drush_submit();"
$DRUSH trp-run-jobs --username=$ACCOUNT_NAME
# 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: "/home/runner/.composer/vendor/bin/drush"
DRUPAL_ROOT: "/home/runner/work/drupal"
POSTGRES_CONNECTION_STRING: 'pgsql://postgres:dbpass@localhost:5432/test_db'
ACCOUNT_NAME: tripaladmin
ACCOUNT_PASS: somereallysecurepassword
run: |
cd $DRUPAL_ROOT/sites/all/modules/tripal
composer require --dev mheap/phpunit-github-actions-printer
composer update
cp tests/.travis.env tests/.env
./vendor/bin/phpunit --printer mheap\\GithubActionsReporter\\Printer
86 changes: 0 additions & 86 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![7.x-3.x Build Status](https://travis-ci.org/tripal/tripal.svg?branch=7.x-3.x)](https://travis-ci.org/tripal/tripal)
![PHPUnit Tests](https://github.com/tripal/tripal/workflows/PHPUnit%20Tests/badge.svg)
[![All Contributors](https://img.shields.io/badge/all_contributors-14-orange.svg?style=flat-square)](#contributors)
[![Documentation Status](https://readthedocs.org/projects/tripal/badge/?version=latest)](https://tripal.readthedocs.io/en/latest/?badge=latest)

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "tripal",
"name": "tripal/tripal",
"description": "Tripal is an toolkit to facilitate construction of online genomic, genetic (and other biological) websites.",
"require-dev": {
"doctrine/instantiator": "1.0.*",
Expand Down

0 comments on commit a95e5a8

Please sign in to comment.