Skip to content

Commit

Permalink
Merge pull request #508 from zendesk/RED-1950-docker
Browse files Browse the repository at this point in the history
CI
  • Loading branch information
ecoologic authored Oct 6, 2023
2 parents 6b48e30 + da65685 commit 6091d39
Show file tree
Hide file tree
Showing 18 changed files with 1,474 additions and 385 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Build Docker image
run: docker build . --file Dockerfile --tag zendesk_api_client_php-app

- name: Run Composer install
run: docker run --rm --volume "$(pwd):/app" zendesk_api_client_php-app composer install

- name: Run tests
run: docker run --rm --volume "$(pwd):/app" zendesk_api_client_php-app vendor/bin/phpunit --testsuite "Zendesk API Unit Test Suites"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
vendor
phpunit.xml
tmp/**
7 changes: 6 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@

### Test suite

```sh
# TODO: Update CONTRIBUTING
docker-compose up
docker run -it --rm -v $(pwd):/app zendesk_api_client_php-app bash
```

The test suite is run via phpunit. Note that these are all live tests that must be run targeted at a real Zendesk instance. Credentials can be provided by setting the environment variables in phpunit.xml; a sample is provided at phpunit.xml.dist.

To run the unit tests: `vendor/bin/phpunit --testsuite "Zendesk API Unit Test Suites"`
Expand Down Expand Up @@ -157,4 +163,3 @@ Use `Zendesk\API\Traits\Utility\InstantiatorTrait` when you want a resource to b
``` php
$this->client->tickets()->comments()->findAll();
```

12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM php:7.4-cli

# OS requirements for PHP
RUN apt-get update && apt-get install -y git unzip

# PHP requirements
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
WORKDIR /app
COPY composer.json composer.lock /app/
RUN composer install

COPY . /app
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ This is the second version of our PHP API client. The previous version of the AP
This client **only** supports Zendesk's API v2. Please see our [API documentation](http://developer.zendesk.com) for more information.

## Requirements

* TODO: Update README
* PHP 5.5+

## Installation
Expand Down Expand Up @@ -99,13 +101,13 @@ $attachment = $client->attachments()->upload([
Attaching files to comments

``` php
$ticket = $client->tickets()->create([
'subject' => 'The quick brown fox jumps over the lazy dog',
'comment' => [
$ticket = $client->tickets()->create([
'subject' => 'The quick brown fox jumps over the lazy dog',
'comment' => [
'body' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, ' .
'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
'uploads' => [$attachment->upload->token]
]
'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
'uploads' => [$attachment->upload->token]
]
]);
```

Expand Down Expand Up @@ -135,8 +137,8 @@ The allowed options are

### Retrying Requests

Add the `RetryHandler` middleware on the `HandlerStack` of your `GuzzleHttp\Client` instance. By default `Zendesk\Api\HttpClient`
retries:
Add the `RetryHandler` middleware on the `HandlerStack` of your `GuzzleHttp\Client` instance. By default `Zendesk\Api\HttpClient`
retries:
* timeout requests
* those that throw `Psr\Http\Message\RequestInterface\ConnectException:class`
* and those that throw `Psr\Http\Message\RequestInterface\RequestException:class` that are identified as ssl issue.
Expand Down
Loading

0 comments on commit 6091d39

Please sign in to comment.