Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to GitHub actions #54

Merged
merged 16 commits into from Apr 28, 2021
108 changes: 108 additions & 0 deletions .github/workflows/build-8.x-1.x.yml
@@ -0,0 +1,108 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the 8.x branch
push:
branches: [ 8.x-1.x, main]
pull_request:
branches: [ 8.x-1.x, main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# 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"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ["7.3", "7.4"]
drupal-version: ["8.9.11", "9.1.5"]

services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: drupal
ports:
- 3306:3306
activemq:
image: webcenter/activemq:5.14.3
ports:
- 8161:8161
- 61616:61616
- 61613:61613

# 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 code
uses: actions/checkout@v2
with:
path: build_dir

- name: Checkout islandora_ci
uses: actions/checkout@v2
with:
repository: islandora/islandora_ci
ref: github-actions
path: islandora_ci

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer:v2

- name: Setup Mysql client
run: |
sudo apt-get update
sudo apt-get install -y mysql-client

- name: Set environment variables
run: |
echo "DRUPAL_VERSION=${{ matrix.drupal-version }}" >> $GITHUB_ENV
echo "SCRIPT_DIR=$GITHUB_WORKSPACE/islandora_ci" >> $GITHUB_ENV
echo "DRUPAL_DIR=/opt/drupal" >> $GITHUB_ENV

- name: Cache Composer dependencies
uses: actions/cache@v2
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}

- name: Setup Drupal
run: |
mkdir $DRUPAL_DIR
$SCRIPT_DIR/travis_setup_drupal.sh
cd $DRUPAL_DIR
chmod -R u+w web/sites/default
mkdir -p web/sites/simpletest/browser_output

- name: Setup composer paths
run: |
git -C "$GITHUB_WORKSPACE/build_dir" checkout -b travis-testing
cd $DRUPAL_DIR
composer config repositories.local path "$GITHUB_WORKSPACE/build_dir"
composer config minimum-stability dev
composer require "islandora/jsonld:dev-travis-testing as dev-8.x-1.x" --prefer-source -W

- name: Install modules
run: |
cd $DRUPAL_DIR/web
drush --uri=127.0.0.1:8282 en -y user jsonld

- name: Test scripts
run: $SCRIPT_DIR/travis_scripts.sh

- name: PHPUNIT tests
run: |
cd $DRUPAL_DIR/web
php core/scripts/run-tests.sh --suppress-deprecations --url http://127.0.0.1:8282 --verbose --php `which php` --module jsonld

47 changes: 0 additions & 47 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
@@ -1,5 +1,5 @@
# ![Islandora-JSON-LD](https://cloud.githubusercontent.com/assets/2371345/24964530/f054bddc-1f77-11e7-8b54-d04bb7b2281c.png) JSONLD
[![Build Status][1]](https://travis-ci.com/Islandora/jsonld)
[![Build Status][1]](https://github.com/Islandora/jsonld/actions)
[![Contribution Guidelines][2]](./CONTRIBUTING.md)
[![LICENSE][3]](./LICENSE)

Expand Down Expand Up @@ -40,7 +40,7 @@ an Islandora Foundation [Contributor License Agreement][6] or

[GPLv2](http://www.gnu.org/licenses/gpl-2.0.txt)

[1]: https://travis-ci.org/Islandora/jsonld.png?branch=8.x-1.x
[1]: https://github.com/jsonld/actions/workflows/build-8.x-1.x.yml/badge.svg
[2]: http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg
[3]: https://img.shields.io/badge/license-GPLv2-blue.svg?style=flat-square
[4]: https://github.com/whikloj
Expand Down
1 change: 1 addition & 0 deletions tests/src/Functional/JsonldContextGeneratorTest.php
Expand Up @@ -24,6 +24,7 @@ class JsonldContextGeneratorTest extends BrowserTestBase {
*/
protected static $modules = [
'node',
'user',
'jsonld',
];

Expand Down
10 changes: 4 additions & 6 deletions tests/src/Kernel/JsonldContextGeneratorTest.php
Expand Up @@ -5,15 +5,14 @@
use Drupal\Component\Utility\Random;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\jsonld\ContextGenerator\JsonldContextGenerator;
use Drupal\KernelTests\KernelTestBase;

/**
* Tests the Json-LD context Generator methods and simple integration.
*
* @group jsonld
* @coversDefaultClass \Drupal\jsonld\ContextGenerator\JsonldContextGenerator
*/
class JsonldContextGeneratorTest extends KernelTestBase {
class JsonldContextGeneratorTest extends JsonldKernelTestBase {

/**
* {@inheritdoc}
Expand All @@ -26,6 +25,7 @@ class JsonldContextGeneratorTest extends KernelTestBase {
'rdf_test_namespaces',
'serialization',
'system',
'user',
];

/**
Expand Down Expand Up @@ -94,14 +94,13 @@ public function testGetContext() {
/**
* Tests Exception in case of no rdf type.
*
* @expectedException \Exception
* @covers \Drupal\jsonld\ContextGenerator\JsonldContextGenerator::getContext
*/
public function testGetContextException() {
$this->expectException(\Exception::class);
// This should throw the expected Exception.
$newEntity = $this->createContentType();
$this->theJsonldContextGenerator->getContext('entity_test.' . $newEntity->id());

}

/**
Expand All @@ -121,15 +120,14 @@ public function testGenerateContext() {
/**
* Tests Exception in case of no rdf type.
*
* @expectedException \Exception
* @covers \Drupal\jsonld\ContextGenerator\JsonldContextGenerator::generateContext
*/
public function testGenerateContextException() {
$this->expectException(\Exception::class);
// This should throw the expected Exception.
$newEntity = $this->createContentType();
$rdfMapping = rdf_get_mapping('entity_test', $newEntity->id());
$this->theJsonldContextGenerator->getContext('entity_test.' . $newEntity->id());

}

/**
Expand Down