Skip to content

Commit

Permalink
fix: migrate to common prism setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Harrison committed Apr 30, 2020
1 parent efdd358 commit 12a66df
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 89 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@ composer.phar
.editorconfig
test.php
.idea/
test/prism_linux_amd64
test/prism/*
!test/prim
*.code-workspace
.vscode
prism*
prism
temp.php
example*.php
TODO.txt
Expand Down
26 changes: 9 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
language: php

before_script:
- if [ -n "$GIT_HUB_TOKEN" ]; then composer config -g github-oauth.github.com "$GIT_HUB_TOKEN"; fi;
- composer install
- if [ "$dependencies" = "lowest" ]; then composer update --prefer-lowest --prefer-stable -n; fi;
- "./test/prism.sh &"
- sleep 60
services:
- docker

script:
- "vendor/bin/phpunit test --filter test*"
- make test-docker

after_success:
- bash <(curl -s https://codecov.io/bash)

php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4

env:
- dependencies=lowest
- dependencies=highest
- version=5.6
- version=7.0
- version=7.1
- version=7.2
- version=7.3
- version=7.4

notifications:
slack:
Expand Down
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ARG version=latest
FROM php:$version

RUN apt-get update \
&& apt-get install -y zip

RUN curl -s https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer

COPY prism/prism/nginx/cert.crt /usr/local/share/ca-certificates/cert.crt
RUN update-ca-certificates

WORKDIR /app
COPY . .

RUN make install
19 changes: 17 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
.PHONY: clean install ci-install test bundle
.PHONY: clean install ci-install test test-integ test-docker bundle

clean:
@rm -rf vendor composer.lock sendgrid-php.zip

install: clean
ifdef GIT_HUB_TOKEN
composer config -g github-oauth.github.com $(GIT_HUB_TOKEN)
endif

composer install

ifeq ($(dependencies), lowest)
composer update --prefer-lowest --prefer-stable -n
endif

ci-install: clean
composer install --no-dev

test: install
test:
vendor/bin/phpunit test/unit --filter test*

test-integ: test
vendor/bin/phpunit test --filter test*

test-docker:
curl -s https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/prism/prism.sh | dependencies=lowest bash
curl -s https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/prism/prism.sh | dependencies=highest bash

bundle: ci-install
zip -r sendgrid-php.zip . -x \*.git\* \*composer.json\* \*scripts\* \*test\* \*.travis.yml\* \*prism\*
5 changes: 2 additions & 3 deletions test/BaseTestClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ class BaseTestClass extends TestCase
*/
public static function setUpBeforeClass()
{
self::$apiKey = "SENDGRID_API_KEY";
$host = ['host' => 'http://localhost:4010'];
self::$sg = new SendGrid(self::$apiKey, $host);
self::$apiKey = 'SENDGRID_API_KEY';
self::$sg = new SendGrid(self::$apiKey);
}

/**
Expand Down
63 changes: 0 additions & 63 deletions test/prism.sh

This file was deleted.

0 comments on commit 12a66df

Please sign in to comment.