Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Update version and add release notes to README

on:
pull_request:
types: [opened] # Only executed when a new PR is created

permissions: # Required for the Action to change our version and README files
contents: write
pull-requests: write

jobs:

update_readme:

runs-on: ubuntu-latest

steps:

- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

# Calls a Python script to increase the version number in `__version__.py`
- name: Increase version number
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
python deployment_scripts/update_version_number.py

# Calls a Python script to update the release notes in `README.md`
- name: Update release notes
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_BODY: ${{ github.event.pull_request.body }}
run: |
python deployment_scripts/update_release_notes.py

# Commits the changes the script made to `__version__.py` and `README.md`
- name: Commit changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add __version__.py
git add README.md
git commit -m "Add release notes for PR #${{ github.event.pull_request.number }}" || echo "No changes to commit"
git push
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build and test

on:
push:
branches: ["development"] # Triggered when a commit is pushed to the development branch

jobs:
build:
runs-on: ubuntu-latest # Run this code on a Linux Virtual Machine (VM)

steps: # Steps that are executed for this Action

# Checks out the code into the VM
- name: Checkout repository
uses: actions/checkout@v4

# Installs Python
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

# Installs the dependencies
- name: Install Dependencies
run: pip install -r requirements.txt

# Discovers and runs the tests
- name: Run tests
run: pytest -q
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,8 @@ This exercise illustated the last step of the CI/CD pipeline, which is deliverin
# Release notes

This section should be populated by the *release* Action.

## Release Notes — v1.4.1 — Emergency fix for cheese crust pizza (2025-12-08)

- Patching a bug found when calculating cheese crust pizza delivery cost.
- Slight UI improvements.
2 changes: 1 addition & 1 deletion __version__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

__title__ = 'enpm611-ghactions'
__version__ = '1.4.0'
__version__ = '1.4.1'
__author__ = 'ENPM611'
__url__ = 'https://github.com/enpm611/github-actions'
__description__ = ("Exercise to use GitHub Actions for CI/CD task.")
2 changes: 1 addition & 1 deletion tests/test_delivery.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def fixed_weather():

def test_basic_delivery_normal_mode():
"""Earth is 0.5 lm away; NORMAL speed 10 lm/hr → 0.05 hr."""
assert estimate_delivery_time("Earth", DeliveryMode.NORMAL, 1.0, no_weather) == 0.06 # Fix this! It should be 0.05
assert estimate_delivery_time("Earth", DeliveryMode.NORMAL, 1.0, no_weather) == 0.05 # Fix this! It should be 0.05


def test_turbo_delivery():
Expand Down