Open jscarty opened 4 years ago
Actually, you don't have to use pull request feature of GitHub or similar platforms. Teams can use other modes of communication including face-to-face communication, voice calls, or e-mails, but there is a number of reasons to use such forum thread-like pull requests. Here are some of them:
Usually, you do these things when creating a PR.
After you open a PR, whatever automated tests scheduled are run on your code. In our case, this is going to be the same test suite as we ran locally, but in a real project, there might be extra tests and checks.
Please, wait until the tests finish running. You can see the status of the tests at the bottom of the PR discussion thread. I'll give further instructions in a comment when the tests are done.
An issue is created. Follow the link to continue the course.
Collaborating on a pull request often results in additional work being requested. Usually, this is a result of a review or a discussion, but for our course, we are going to simulate this by adding another item to our CI checklist.
Some test coverage is usually in place to support Continuous Integration. The tests coverage requirements differ and are usually found in a document like "contribution guidelines". We are going to be straightforward and will add a test for each line in our checklist.
When working through the activity part, first try to commit tests. If you installed the pre-commit
hook correctly earlier, the test we've just added will fail and nothing will be committed. Please note that that this is how we know that our tests actually check something. Curiously, if we started with the code before tests, tests passing could mean either that the code works as expected or that the tests don't really check anything. Also, if we didn't write tests first, we could forget writing them completely, as nothing would remind us about it.
After letting the tests fail attempting to commit them, add and commit the actual checklist text. You will see that tests are passing ("green"). Then, push the new code to the remote and see how tests are run in the pull request and the pull request's status is updated.
feature-steps
.Add the following tests to ci.test.js
after the last it(...);
call.
it('5. Merge/rebase commits from master. Make tests pass on the merge result.', () => {
expect(/.*merge.*commits.*tests\s+pass.*/ig.test(fileContents)).toBe(true);
});
it('6. Deploy from the feature branch to production.', () => {
expect(/.*Deploy.*to\s+production.*/ig.test(fileContents)).toBe(true);
});
it('7. If everything is good in production for some period of time, merge changes to master.', () => {
expect(/.*merge.*to\s+master.*/ig.test(fileContents)).toBe(true);
});
pre-commit
hook is in place, the commit will fail. ci.md
.
5. Merge/rebase commits from master. Make tests pass on the merge result.
6. Deploy from the feature branch with a sneaky bug to production.
7. If everything is good in production for some period of time, merge changes to master.
feature-steps
branch.
A pull request with different title, base or head branch is expected
Open a pull request named Steps review with base branch
master
and head branchfeature-steps
. You can edit a pull request if you created it with a different name or specified other branches.