Skip to content

Commit

Permalink
Added dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
vermakhushboo committed Feb 15, 2023
1 parent 8339ba6 commit f09655f
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 7 deletions.
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM composer:2.0 as composer

ARG TESTING=false
ENV TESTING=$TESTING

WORKDIR /usr/local/src/

COPY composer.lock /usr/local/src/
COPY composer.json /usr/local/src/

RUN composer install \
--ignore-platform-reqs \
--optimize-autoloader \
--no-plugins \
--no-scripts \
--prefer-dist

FROM php:8.0-cli-alpine

WORKDIR /usr/local/src/

COPY --from=composer /usr/local/src/vendor /usr/local/src/vendor
COPY . /usr/local/src/

CMD [ "tail", "-f", "/dev/null" ]
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@

Utopia VCS is a simple and lite library to integrate version control systems like GitHub, GitLab etc. to receive webhook events like push, new pull request etc. This library is aiming to be as simple and easy to learn and use. This library is maintained by the [Appwrite team](https://appwrite.io).

Although this library is part of the [Utopia Framework](https://github.com/utopia-php/framework) project, it is dependency free and can be used as standalone with any other PHP project or framework.
Although this library is part of the [Utopia Framework](https://github.com/utopia-php/framework) project, it is dependency free and can be used as standalone with any other PHP project or framework.

Run tests using the following command:

`docker compose exec tests ./vendor/bin/phpunit`
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.9'

services:
tests:
build:
context: .
volumes:
- ./src:/usr/local/src/src
- ./tests:/usr/local/src/tests
- ./phpunit.xml:/usr/local/src/phpunit.xml
environment:
- GITHUB_PRIVATE_KEY
- GITHUB_APP_IDENTIFIER
- GITHUB_WEBHOOK_SECRET
5 changes: 1 addition & 4 deletions src/VCS/Adapter/Git/GitHub.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ class GitHub extends Git
/**
* GitHub constructor.
*
* @param user
* @param string $userName The username of account which has installed GitHub app
* @param string $installationId Installation ID of the GitHub App
*/
public function __construct(string $userName, string $installationId, string $privateKey, string $githubAppId)
{
Expand Down Expand Up @@ -115,7 +112,7 @@ public function getUser(): array
}

/**
* List repositories
* List repositories for GitHub App
*
* @return array
* @throws Exception
Expand Down
4 changes: 2 additions & 2 deletions tests/VCS/GitHubTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function setUp(): void
{
$privateKey = App::getEnv("GITHUB_PRIVATE_KEY");
$githubAppId = App::getEnv("GITHUB_APP_IDENTIFIER");
$installationId = "1234";
$installationId = "1234"; //your GitHub App Installation ID here
$this->github = new GitHub("vermakhushboo", $installationId, $privateKey, $githubAppId);
}

Expand All @@ -25,7 +25,7 @@ public function testGetUser(): void

public function testListRepositoriesForGitHubApp(): void
{
$this->github->listRepositoriesForGitHubApp();
$repos = $this->github->listRepositoriesForGitHubApp();
}

public function testGetRepository(): void
Expand Down

0 comments on commit f09655f

Please sign in to comment.