Homework 5

Due: Friday, March 10 at 11:59 pm

Part 1 - Continuous Integration

Following the lectures, setup GitHub actions (or other CI/CD service) to run your installation, build, lint, and test procedures. The specific requirements are:

Part 2 - Badges

Add CI status and code coverage badges to your project’s README.md.

Part 3 - Branch protection

You may have noticed GitHub alerting you to protect your main branch:

This is a good idea in general as we don’t want to accidentally push to our main branch without a pull request, so let’s set that up. You can either click Add rule or navigate to settings, Branches -> Add rule.

From here, let’s setup a rule requiring any changes to our main branch to have:

This is quite straightforward to do. First, set the pattern to match the name (for me and the default, this is main).

Next, click the box for Require a pull request before merging. You do not need to specify reviewers. This ensures that any change to main goes through a PR

Next, click Require status checks to pass before merging. This will ensure that if any CI fails, you’ll see a big red checkbox to override in order to merge (a good indication that you’ll probably want to fix the status checks). The vast majority of projects like to keep their main branch working, and will fix problems in PRs before allowing them to get merged in (as opposed to merging the PR and doing fixes later).

Scroll to the bottom and click Create, and you should see that your main branch is now protected by this rule.

Part 4 - Dependabot

As the final piece of the puzzle, add the .github/dependabot.yml workflow from lecture. This will ensure the actions in our CI pipelines themselves stay up to date.

version: 2
updates:
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "weekly"