Skip to content

Commit

Permalink
Merge pull request #4 from IsaacCheng9/add-ci
Browse files Browse the repository at this point in the history
Add CI pipelines for testing and formatting
  • Loading branch information
IsaacCheng9 authored Feb 4, 2024
2 parents dae5525 + dcd300f commit 79f3386
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Format

on: [push]

jobs:
format:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.12.x]

steps:
- uses: actions/checkout@v3

- name: Run Python code formatting with Black
uses: lgeiger/[email protected]
with:
args: "."

- name: Commit changes made by Black
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Format Python code with Black

- name: Switch to current branch
run: git checkout ${{ env.BRANCH }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
45 changes: 45 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Test

# Controls when the action will run.
on:
# Triggers the workflow on push events but only for the main branch.
push:
# Allows you to run this workflow manually from the Actions tab.
workflow_dispatch:

jobs:
test:
# The type of runner that the job will run on.
runs-on: macos-latest
# Configures the build to use the latest version of Python 3.
strategy:
matrix:
python-version: [3.12.x]

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can
# access it.
- uses: actions/checkout@v3

- name: Switch to current branch
run: git checkout ${{ env.BRANCH }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Install Python dependencies with Poetry
run: |
poetry install
- name: Run unit tests with Pytest
run: poetry run coverage run --source=src/boruvkas_algorithm -m pytest -v

- name: Get code coverage report
run: poetry run coverage report -m
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Boruvka's Algorithm

[![code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Test](https://github.com/IsaacCheng9/boruvkas-algorithm/actions/workflows/test.yml/badge.svg)](https://github.com/IsaacCheng9/boruvkas-algorithm/actions/workflows/test.yml)

An implementation of Boruvka's algorithm to find a minimum spanning tree in a graph.

[Link to narrated video demonstration on YouTube.](https://www.youtube.com/watch?v=n5LNVobuBNU)
Expand Down
1 change: 1 addition & 0 deletions src/boruvkas_algorithm/boruvka.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Implement Boruvka's algorithm for finding the minimum spanning tree of a graph.
"""

from typing import Dict, List, Optional, Tuple


Expand Down

0 comments on commit 79f3386

Please sign in to comment.