Skip to content
Merged
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
6 changes: 3 additions & 3 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[bumpversion]
current_version = 1.0.7
commit = False
tag = False
current_version = 1.0.9
commit = True
tag = True

[bumpversion:file:setup.py]
2 changes: 1 addition & 1 deletion .github/workflows/python-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
paths-ignore:
- 'README.md'
- 'docs/**'

# todo: 2 jobs (lint / test)
jobs:
lint:

Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ on:
permissions:
id-token: write

# todo:
# - remove test/lint (already in feature pipelines)
# - 3jobs: bump/package/publish
# -
# -
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -30,18 +35,27 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt

# lint and unit tests
- name: Run unit tests
run: python -m unittest discover -s tests -p 'test_*.py'

- name: Run Ruff
run: ruff check --output-format=github src


# version increment
- name: Set up Git user for bump2version commit
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"

- name: Bump version and push tag
run: |
pip install --upgrade bump2version
bump2version patch --allow-dirty


# build package
- name: Build Python package
run: python setup.py sdist bdist_wheel

Expand Down
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,52 @@ Use Ruff instead of flake8 (linter), black (formatter) and isort (import sorter)

- **mypy** (static type annotations)
- `mypy --exclude venv .`

## Pipelines (Workflows)

- The overall automation process, defined in a YAML file, that runs on certain triggers (like push, pull request, etc.).
- e.g. `python-linting.yml` file defines a pipeline (workflow).

### Hierarchy in Github

**In GitHub Actions, there are no native "stages"** like in Azure DevOps or GitLab CI.
The highest hierarchy in a workflow is:

- **Workflow** (the whole YAML file, sometimes called a pipeline)
- **Jobs** (can run in parallel or in sequence using `needs`)
- **Steps** (run sequentially within a job)

If you want to mimic "stages," you use multiple jobs and control their order with the `needs:` keyword. But officially, **jobs** are the top-level execution units inside a workflow.

### **Runner**

- **Definition:** A server (virtual machine or container) that executes your workflow jobs.
- **Example:** `runs-on: ubuntu-latest` tells GitHub to use an Ubuntu runner.

---

### **Job**

- **Definition:**
- A set of steps that run sequentially on the same runner.
- Multiple jobs in one pipeline (workflow) can run in parallel (unless you specify dependencies between them).
- Each job can specify its own runner using the runs-on key.
- By default, jobs run on separate runners (virtual machines or containers), which allows them to run in parallel and in isolated environments.
- **Example:** Your `lint` job runs all the steps (checkout, setup Python, install, test, lint).

---

### **Action**

- **Definition:** A reusable unit of code that performs a specific task in a workflow step.
- **Example:** `actions/checkout@v2` is an action that checks out your code.

---

| Term | GitHub Actions Example | Description |
|----------|-------------------------------|-----------------------------------------------|
| Runner | `runs-on: ubuntu-latest` | Where jobs run |
| Action | `actions/checkout@v2` | Reusable step/task |
| Pipeline | `.github/workflows/*.yml` | The whole workflow process |
| Stage | (Not native, use jobs) | Logical phase (build/test/deploy) |
| Job | `jobs: lint:` | Group of steps on one runner |
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="velosaurus_calc",
version="1.0.7",
version="1.0.9",
description="Most awesome math package ever.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
7 changes: 4 additions & 3 deletions src/velosaurus_calc/calculator.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
def add_floats(a: float, b: float) -> float:
return a + b
res = a + b
return res


def subtract_floats(a: float, b: float) -> float:
return a + b
return a - b


if __name__ == "__main__":
print(sum(2, 4))
print(add_floats(2, 4))