Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shem8 committed Jul 17, 2024
1 parent 509f91c commit 38123b9
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 21 deletions.
3 changes: 2 additions & 1 deletion steps/03_run_both_servers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ githubActions:
- cmd: docker compose up -d
- cmd: sleep 5
- cmd: curl localhost:8001
- cmd: curl localhost:8000

trigger:
type: github_pr_lifecycle_status
Expand Down Expand Up @@ -62,7 +63,7 @@ trigger:
- actionId: github_pr_reject
params:
person: lucca
message: "Weird, I tried to run the node server using `docker compose up` but couldn't find anything on port 8001, are you sure it works for you?"
message: "Weird, I tried to run the servers using `docker compose up` but couldn't find anything on port 8000 or 8001, are you sure it works for you?"
github_pr_merged:
do:
- actionId: finish_step
43 changes: 37 additions & 6 deletions steps/04_migrate_endpoints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,42 @@ startFlow:
- text: We can do it easily by giving copilot the code we want to migrate and ask them for help.
- text: Add the Python code you want to migrate [to the chat](https://code.visualstudio.com/docs/copilot/getting-started-chat#_add-chat-context) and ask Copilot to translate it to Node.js.
- text: Once the migration is complete, commit the changes and open a PR. Ness will be thrilled with our progress.
- actionId: ready_message
params:
person: lucca

githubActions:
commands:
- cmd: docker compose up -d
- cmd: sleep 5
- cmd: |
curl -X POST -H "Content-Type: application/json" -d '{"text": "New task"}' http://localhost:8001/tasks
- cmd: |
curl localhost:8001/tasks | grep "New task"
trigger:
type: user_ready_response
type: github_pr_lifecycle_status
flowNode:
do:
- actionId: finish_step
switch:
key: "${eventType}"
cases:
github_pr_opened:
do:
- actionId: github_pr_comment
params:
person: lucca
message: "Got it! Let me review the changes and get back to you."
github_pr_workflow_complete_success:
do:
- actionId: bot_message
params:
person: lucca
messages:
- text: "Good job, you can now merge the PR."
- actionId: github_pr_approve
params:
person: lucca
message: "Good job, you can now merge the PR."
github_pr_workflow_complete_failure:
do:
- actionId: github_pr_reject
params:
person: lucca
message: "I'm sorry, but I can't approve this PR, I found some issues when testing the endpoints."
65 changes: 51 additions & 14 deletions steps/05_update_readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,56 @@ startFlow:
chat](https://code.visualstudio.com/docs/copilot/getting-started-chat#_stay-in-the-flow-with-inline-chat)
to ask Copilot for updates. Once you're done, commit the changes
and open a final PR. Ness will likely throw a party with all this progress.
- actionId: ready_message
params:
person: lucca

trigger:
type: user_ready_response
type: github_pr_lifecycle_status
flowNode:
do:
- actionId: bot_message
params:
person: lucca
messages:
- text: Congratulations, you've successfully migrated the Python server to Node
using GitHub Copilot! We've upgraded our tech stack and now have
a Node server handling our tasks. Ness is going to be thrilled.
Great job!
- actionId: finish_step
switch:
key: "${eventType}"
cases:
github_pr_workflow_complete_success:
if:
conditions:
- conditionId: github_does_file_contain
params:
fileName: readme.md
regex: 8001
- conditionId: github_does_file_contain
params:
fileName: readme.md
regex: node
flags: i
then:
do:
- actionId: github_pr_approve
params:
person: lucca
message: "Nice work! Now you can merge it."
- actionId: bot_message
params:
person: lucca
messages:
- text: "Nice work! Now you can merge it."
else:
do:
- actionId: github_pr_reject
params:
person: lucca
message: "Are you sure you changed the readme file and explained that the node server is running on port 8001?"
- actionId: bot_message
params:
person: lucca
messages:
- text: "Are you sure you changed the readme file and explained that the node server is running on port 8001?"

github_pr_merged:
do:
- actionId: bot_message
params:
person: lucca
messages:
- text: Congratulations, you've successfully migrated the Python server to Node
using GitHub Copilot! We've upgraded our tech stack and now have
a Node server handling our tasks. Ness is going to be thrilled.
Great job!
- actionId: finish_step

0 comments on commit 38123b9

Please sign in to comment.