Skip to content

Commit b66ce20

Browse files
Merge pull request #18 from ResearchCodingClub/improve_ci_challenge
Clarify CI pull_request challenge
2 parents 7c17aee + d606ef7 commit b66ce20

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

episodes/10-CI.Rmd

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,39 @@ always include both `push` and `pull_request` in your testing workflows.
296296
Can you engineer a situation where a CI job passes on `push` but
297297
fails on `pull_request`?
298298

299-
- Write a new function, commit the changes, and push it to your `main`
300-
branch.
299+
- Write a function to a new file, commit the changes, and push it to your `main`
300+
branch. It can be something as simple as:
301+
302+
```python
303+
# file: message.py
304+
305+
def message():
306+
return "foo"
307+
````
308+
301309
- Switch to a new branch `my_branch` with `git switch -c my_branch`,
302-
and write a test for that function.
310+
and write a test for that function in a new file:
311+
312+
```python
313+
# file: test_message.py
314+
from message import message
315+
316+
def test_message():
317+
assert message() == "foo"
318+
```
319+
303320
- Check that the test passes, and commit it.
304321
- Push `my_branch` to GitHub with `git push -u origin my_branch`,
305322
but don't raise a pull request yet.
306-
- Return to your `main` branch, and modify the function being tested.
323+
- Return to your `main` branch, and modify the function being tested:
324+
325+
```python
326+
# file: message.py
327+
328+
def message():
329+
return "bar"
330+
```
331+
307332
- Push the changes to `main`.
308333
- Now raise a pull request from `my_branch` into `main`.
309334

0 commit comments

Comments
 (0)