Skip to content

Commit 0621ced

Browse files
authored
Add CI action (#5)
1 parent a1c8655 commit 0621ced

File tree

4 files changed

+77
-4
lines changed

4 files changed

+77
-4
lines changed

.github/workflows/main.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
- name: Install poetry
18+
run: pipx install poetry
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: '3.8'
24+
cache: 'poetry'
25+
26+
- name: Install dependencies
27+
run: poetry install
28+
29+
- name: Check formatting
30+
run: |
31+
source $(poetry env info --path)/bin/activate
32+
make format-check
33+
34+
test:
35+
runs-on: ubuntu-latest
36+
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v3
40+
41+
- name: Install poetry
42+
run: pipx install poetry
43+
44+
- name: Set up Python
45+
uses: actions/setup-python@v4
46+
with:
47+
python-version: '3.8'
48+
cache: 'poetry'
49+
50+
- name: Install dependencies
51+
run: poetry install
52+
53+
- name: Run main
54+
run: make run
55+
56+
- name: Test
57+
run: |
58+
source $(poetry env info --path)/bin/activate
59+
make test

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
all: format-check test
2+
3+
SRCS := $(shell find . -name '*.py')
4+
15
.PHONY: run
26
run:
37
./main.py
@@ -6,6 +10,15 @@ run:
610
test:
711
pytest test_*.py
812

13+
.PHONY: format
14+
format:
15+
@yapf -i $(SRCS)
16+
17+
.PHONY: format-check
18+
format-check:
19+
@yapf --diff $(SRCS) \
20+
|| (echo "Some files require formatting. Run 'make format' to fix." && exit 1)
21+
922
ifndef VERBOSE
1023
.SILENT:
1124
endif

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Bootstrap for Python katas
22

3-
[![Run on Replit](https://replit.com/badge/github/Coding-Cuddles/bootstrap-python-kata)](https://replit.com/new/github/Coding-Cuddles/bootstrap-python-kata)
3+
[![CI](https://github.com/Coding-Cuddles/bootstrap-python-kata/actions/workflows/main.yml/badge.svg)](https://github.com/Coding-Cuddles/bootstrap-python-kata/actions/workflows/main.yml)
4+
[![Replit](https://replit.com/badge?caption=Try%20with%20Replit&variant=small)](https://replit.com/new/github/Coding-Cuddles/bootstrap-python-kata)
45

56
## Overview
67

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[tool.poetry]
22
name = "bootstrap-python-kata"
33
version = "1.0.0"
4-
description = "Bootstrap repository for clean code katas in Python"
5-
authors = ["Yury Bayda <yury@bayda.pro>"]
4+
description = "Bootstrap for Python katas"
5+
authors = ["Codding Cuddles"]
66

77
[tool.poetry.dependencies]
88
python = ">=3.8.0"
@@ -13,4 +13,4 @@ replit-python-lsp-server = {extras = ["yapf", "rope", "pyflakes"], version = "^1
1313

1414
[build-system]
1515
requires = ["poetry-core>=1.0.0"]
16-
build-backend = "poetry.core.masonry.api"
16+
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)