Skip to content

Commit 08b8ff5

Browse files
committed
feature #91 Playground request data (Nyholm)
This PR was squashed before being merged into the master branch. Discussion ---------- Playground request data Here is a big PR that prepare us to run functional tests on CI. Blocked by #90 Commits ------- 4640255 minor bab279b Updated webhook_examples
2 parents 73cb80f + 4640255 commit 08b8ff5

15 files changed

+539
-506
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ SYMFONY_DOCS_SECRET=''
2323
SYMFONY_SECRET=''
2424

2525
###> knplabs/github-api ###
26-
GITHUB_TOKEN=XXX
26+
#GITHUB_TOKEN=XXX
2727
###< knplabs/github-api ###

.github/workflows/ci.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ on:
88

99
jobs:
1010

11-
build:
12-
name: Build
11+
test:
12+
name: Test
1313
runs-on: ubuntu-latest
1414
strategy:
1515
fail-fast: false
@@ -24,14 +24,30 @@ jobs:
2424
- name: Checkout code
2525
uses: actions/checkout@v2
2626

27+
- name: Get composer cache directory
28+
id: composer-cache
29+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
30+
31+
- name: Cache dependencies
32+
uses: actions/cache@v2
33+
with:
34+
path: ${{ steps.composer-cache.outputs.dir }}
35+
key: composer-${{ runner.os }}-7.4-${{ hashFiles('composer.*') }}
36+
restore-keys: |
37+
composer-${{ runner.os }}-7.4-
38+
composer-${{ runner.os }}-
39+
composer-
40+
2741
- name: Download dependencies
2842
run: |
2943
composer install --no-interaction --optimize-autoloader
3044
./vendor/bin/simple-phpunit install
3145
3246
- name: Run tests
3347
env:
34-
SYMFONY_REQUIRE: 4.4.*
3548
GITHUB_TOKEN: ${{ secrets.CARSONTEST_GITHUB_TOKEN }}
3649
run: |
37-
./vendor/bin/simple-phpunit
50+
if [ ! -z $GITHUB_TOKEN ]; then
51+
./vendor/bin/simple-phpunit --testsuite Functional
52+
fi
53+
./vendor/bin/simple-phpunit --testsuite Unit

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.PHONY: build coverage help test
2+
3+
help:
4+
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
5+
6+
build: test ## Runs test targets
7+
8+
test: vendor/autoload.php ## Runs tests with phpunit
9+
vendor/bin/simple-phpunit --testsuite Unit
10+
11+
vendor/autoload.php:
12+
composer install --no-interaction

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
The Carson Issue Butler
22
=======================
33

4+
![CI](https://github.com/carsonbot/carsonbot/workflows/CI/badge.svg)
5+
46
Carson is a bot that currently runs on the [symfony/symfony](https://github.com/symfony/symfony)
57
repository. His job is to help automate different issue and pull request
68
workflows.

config/packages/github_api.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ services:
33
arguments:
44
- '@Github\HttpClient\Builder'
55
calls:
6-
- ['authenticate', ['%env(GITHUB_TOKEN)%', 'http_token']]
6+
- ['authenticate', ['%env(GITHUB_TOKEN)%', 'access_token_header']]
77

88
Github\HttpClient\Builder:
99
arguments:

config/services.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ parameters:
2222
secret: '%env(SYMFONY_DOCS_SECRET)%'
2323

2424
# used in a functional test
25-
weaverryan/symfony:
25+
carsonbot-playground/symfony:
2626
subscribers:
2727
- 'App\Subscriber\StatusChangeByCommentSubscriber'
2828
- 'App\Subscriber\StatusChangeOnPushSubscriber'

phpunit.xml.dist

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@
1616
</php>
1717

1818
<testsuites>
19-
<testsuite name="Project Test Suite">
19+
<testsuite name="Unit">
2020
<directory>tests</directory>
21+
<exclude>tests/Controller</exclude>
22+
</testsuite>
23+
24+
<testsuite name="Functional">
25+
<directory>tests/Controller</directory>
2126
</testsuite>
2227
</testsuites>
2328

src/Event/GitHubEvent.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
use Symfony\Contracts\EventDispatcher\Event;
77

88
/**
9-
* GitHubEvent.
10-
*
119
* @author Jules Pietri <jules@heahprod.com>
1210
*/
1311
class GitHubEvent extends Event

tests/Controller/WebhookControllerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ public function setup()
2222

2323
// the labels need to be off this issue for one test to pass
2424
$statusApi->setIssueStatus(
25-
5,
25+
2,
2626
null,
27-
$repository->getRepository('weaverryan/symfony')
27+
$repository->getRepository('carsonbot-playground/symfony')
2828
);
2929
}
3030

@@ -61,17 +61,17 @@ public function getTests()
6161
'On pull request opened with target branch' => [
6262
'pull_request',
6363
'pull_request.opened_target_branch.json',
64-
['pull_request' => 5, 'status_change' => 'needs_review', 'pr_labels' => ['Bug'], 'milestone' => '4.4'],
64+
['pull_request' => 3, 'status_change' => 'needs_review', 'pr_labels' => ['Bug'], 'milestone' => '4.4'],
6565
],
6666
'On issue labeled bug' => [
6767
'issues',
6868
'issues.labeled.bug.json',
69-
['issue' => 5, 'status_change' => 'needs_review'],
69+
['issue' => 2, 'status_change' => 'needs_review'],
7070
],
7171
'On issue labeled "feature"' => [
7272
'issues',
7373
'issues.labeled.feature.json',
74-
['issue' => 5, 'status_change' => null],
74+
['issue' => 2, 'status_change' => null],
7575
],
7676
];
7777
}

tests/webhook_examples/issue_comment.created.json

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"action":"created",
33
"issue":{
4-
"url":"https://api.github.com/repos/weaverryan/symfony/issues/1",
5-
"labels_url":"https://api.github.com/repos/weaverryan/symfony/issues/1/labels{/name}",
6-
"comments_url":"https://api.github.com/repos/weaverryan/symfony/issues/1/comments",
7-
"events_url":"https://api.github.com/repos/weaverryan/symfony/issues/1/events",
8-
"html_url":"https://github.com/weaverryan/symfony/issues/1",
4+
"url":"https://api.github.com/repos/carsonbot-playground/symfony/issues/1",
5+
"labels_url":"https://api.github.com/repos/carsonbot-playground/symfony/issues/1/labels{/name}",
6+
"comments_url":"https://api.github.com/repos/carsonbot-playground/symfony/issues/1/comments",
7+
"events_url":"https://api.github.com/repos/carsonbot-playground/symfony/issues/1/events",
8+
"html_url":"https://github.com/carsonbot-playground/symfony/issues/1",
99
"id":91596173,
1010
"number":1,
1111
"title":"Testing first issue",
@@ -42,9 +42,9 @@
4242
"body":"zzz"
4343
},
4444
"comment":{
45-
"url":"https://api.github.com/repos/weaverryan/symfony/issues/comments/116273361",
46-
"html_url":"https://github.com/weaverryan/symfony/issues/1#issuecomment-116273361",
47-
"issue_url":"https://api.github.com/repos/weaverryan/symfony/issues/1",
45+
"url":"https://api.github.com/repos/carsonbot-playground/symfony/issues/comments/116273361",
46+
"html_url":"https://github.com/carsonbot-playground/symfony/issues/1#issuecomment-116273361",
47+
"issue_url":"https://api.github.com/repos/carsonbot-playground/symfony/issues/1",
4848
"id":116273361,
4949
"user":{
5050
"login":"weaverryan",
@@ -72,7 +72,7 @@
7272
"repository":{
7373
"id":21151556,
7474
"name":"symfony",
75-
"full_name":"weaverryan/symfony",
75+
"full_name":"carsonbot-playground/symfony",
7676
"owner":{
7777
"login":"weaverryan",
7878
"id":121003,
@@ -93,52 +93,52 @@
9393
"site_admin":false
9494
},
9595
"private":false,
96-
"html_url":"https://github.com/weaverryan/symfony",
96+
"html_url":"https://github.com/carsonbot-playground/symfony",
9797
"description":"The Symfony PHP framework",
9898
"fork":true,
99-
"url":"https://api.github.com/repos/weaverryan/symfony",
100-
"forks_url":"https://api.github.com/repos/weaverryan/symfony/forks",
101-
"keys_url":"https://api.github.com/repos/weaverryan/symfony/keys{/key_id}",
102-
"collaborators_url":"https://api.github.com/repos/weaverryan/symfony/collaborators{/collaborator}",
103-
"teams_url":"https://api.github.com/repos/weaverryan/symfony/teams",
104-
"hooks_url":"https://api.github.com/repos/weaverryan/symfony/hooks",
105-
"issue_events_url":"https://api.github.com/repos/weaverryan/symfony/issues/events{/number}",
106-
"events_url":"https://api.github.com/repos/weaverryan/symfony/events",
107-
"assignees_url":"https://api.github.com/repos/weaverryan/symfony/assignees{/user}",
108-
"branches_url":"https://api.github.com/repos/weaverryan/symfony/branches{/branch}",
109-
"tags_url":"https://api.github.com/repos/weaverryan/symfony/tags",
110-
"blobs_url":"https://api.github.com/repos/weaverryan/symfony/git/blobs{/sha}",
111-
"git_tags_url":"https://api.github.com/repos/weaverryan/symfony/git/tags{/sha}",
112-
"git_refs_url":"https://api.github.com/repos/weaverryan/symfony/git/refs{/sha}",
113-
"trees_url":"https://api.github.com/repos/weaverryan/symfony/git/trees{/sha}",
114-
"statuses_url":"https://api.github.com/repos/weaverryan/symfony/statuses/{sha}",
115-
"languages_url":"https://api.github.com/repos/weaverryan/symfony/languages",
116-
"stargazers_url":"https://api.github.com/repos/weaverryan/symfony/stargazers",
117-
"contributors_url":"https://api.github.com/repos/weaverryan/symfony/contributors",
118-
"subscribers_url":"https://api.github.com/repos/weaverryan/symfony/subscribers",
119-
"subscription_url":"https://api.github.com/repos/weaverryan/symfony/subscription",
120-
"commits_url":"https://api.github.com/repos/weaverryan/symfony/commits{/sha}",
121-
"git_commits_url":"https://api.github.com/repos/weaverryan/symfony/git/commits{/sha}",
122-
"comments_url":"https://api.github.com/repos/weaverryan/symfony/comments{/number}",
123-
"issue_comment_url":"https://api.github.com/repos/weaverryan/symfony/issues/comments{/number}",
124-
"contents_url":"https://api.github.com/repos/weaverryan/symfony/contents/{+path}",
125-
"compare_url":"https://api.github.com/repos/weaverryan/symfony/compare/{base}...{head}",
126-
"merges_url":"https://api.github.com/repos/weaverryan/symfony/merges",
127-
"archive_url":"https://api.github.com/repos/weaverryan/symfony/{archive_format}{/ref}",
128-
"downloads_url":"https://api.github.com/repos/weaverryan/symfony/downloads",
129-
"issues_url":"https://api.github.com/repos/weaverryan/symfony/issues{/number}",
130-
"pulls_url":"https://api.github.com/repos/weaverryan/symfony/pulls{/number}",
131-
"milestones_url":"https://api.github.com/repos/weaverryan/symfony/milestones{/number}",
132-
"notifications_url":"https://api.github.com/repos/weaverryan/symfony/notifications{?since,all,participating}",
133-
"labels_url":"https://api.github.com/repos/weaverryan/symfony/labels{/name}",
134-
"releases_url":"https://api.github.com/repos/weaverryan/symfony/releases{/id}",
99+
"url":"https://api.github.com/repos/carsonbot-playground/symfony",
100+
"forks_url":"https://api.github.com/repos/carsonbot-playground/symfony/forks",
101+
"keys_url":"https://api.github.com/repos/carsonbot-playground/symfony/keys{/key_id}",
102+
"collaborators_url":"https://api.github.com/repos/carsonbot-playground/symfony/collaborators{/collaborator}",
103+
"teams_url":"https://api.github.com/repos/carsonbot-playground/symfony/teams",
104+
"hooks_url":"https://api.github.com/repos/carsonbot-playground/symfony/hooks",
105+
"issue_events_url":"https://api.github.com/repos/carsonbot-playground/symfony/issues/events{/number}",
106+
"events_url":"https://api.github.com/repos/carsonbot-playground/symfony/events",
107+
"assignees_url":"https://api.github.com/repos/carsonbot-playground/symfony/assignees{/user}",
108+
"branches_url":"https://api.github.com/repos/carsonbot-playground/symfony/branches{/branch}",
109+
"tags_url":"https://api.github.com/repos/carsonbot-playground/symfony/tags",
110+
"blobs_url":"https://api.github.com/repos/carsonbot-playground/symfony/git/blobs{/sha}",
111+
"git_tags_url":"https://api.github.com/repos/carsonbot-playground/symfony/git/tags{/sha}",
112+
"git_refs_url":"https://api.github.com/repos/carsonbot-playground/symfony/git/refs{/sha}",
113+
"trees_url":"https://api.github.com/repos/carsonbot-playground/symfony/git/trees{/sha}",
114+
"statuses_url":"https://api.github.com/repos/carsonbot-playground/symfony/statuses/{sha}",
115+
"languages_url":"https://api.github.com/repos/carsonbot-playground/symfony/languages",
116+
"stargazers_url":"https://api.github.com/repos/carsonbot-playground/symfony/stargazers",
117+
"contributors_url":"https://api.github.com/repos/carsonbot-playground/symfony/contributors",
118+
"subscribers_url":"https://api.github.com/repos/carsonbot-playground/symfony/subscribers",
119+
"subscription_url":"https://api.github.com/repos/carsonbot-playground/symfony/subscription",
120+
"commits_url":"https://api.github.com/repos/carsonbot-playground/symfony/commits{/sha}",
121+
"git_commits_url":"https://api.github.com/repos/carsonbot-playground/symfony/git/commits{/sha}",
122+
"comments_url":"https://api.github.com/repos/carsonbot-playground/symfony/comments{/number}",
123+
"issue_comment_url":"https://api.github.com/repos/carsonbot-playground/symfony/issues/comments{/number}",
124+
"contents_url":"https://api.github.com/repos/carsonbot-playground/symfony/contents/{+path}",
125+
"compare_url":"https://api.github.com/repos/carsonbot-playground/symfony/compare/{base}...{head}",
126+
"merges_url":"https://api.github.com/repos/carsonbot-playground/symfony/merges",
127+
"archive_url":"https://api.github.com/repos/carsonbot-playground/symfony/{archive_format}{/ref}",
128+
"downloads_url":"https://api.github.com/repos/carsonbot-playground/symfony/downloads",
129+
"issues_url":"https://api.github.com/repos/carsonbot-playground/symfony/issues{/number}",
130+
"pulls_url":"https://api.github.com/repos/carsonbot-playground/symfony/pulls{/number}",
131+
"milestones_url":"https://api.github.com/repos/carsonbot-playground/symfony/milestones{/number}",
132+
"notifications_url":"https://api.github.com/repos/carsonbot-playground/symfony/notifications{?since,all,participating}",
133+
"labels_url":"https://api.github.com/repos/carsonbot-playground/symfony/labels{/name}",
134+
"releases_url":"https://api.github.com/repos/carsonbot-playground/symfony/releases{/id}",
135135
"created_at":"2014-06-24T04:00:07Z",
136136
"updated_at":"2015-06-28T12:37:42Z",
137137
"pushed_at":"2015-06-27T22:21:05Z",
138-
"git_url":"git://github.com/weaverryan/symfony.git",
139-
"ssh_url":"git@github.com:weaverryan/symfony.git",
140-
"clone_url":"https://github.com/weaverryan/symfony.git",
141-
"svn_url":"https://github.com/weaverryan/symfony",
138+
"git_url":"git://github.com/carsonbot-playground/symfony.git",
139+
"ssh_url":"git@github.com:carsonbot-playground/symfony.git",
140+
"clone_url":"https://github.com/carsonbot-playground/symfony.git",
141+
"svn_url":"https://github.com/carsonbot-playground/symfony",
142142
"homepage":"symfony.com",
143143
"size":55729,
144144
"stargazers_count":0,

0 commit comments

Comments
 (0)