-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from stixes/tests-running-in-github
Tests running in GitHub
- Loading branch information
Showing
8 changed files
with
110 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Run Unit Test via Pytest | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.10"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'pip' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Lint with Ruff | ||
run: | | ||
pip install ruff | ||
ruff -- --format=github --target-version=py310 . | ||
continue-on-error: true | ||
- name: Test with pytest | ||
run: | | ||
coverage run -m pytest -v -s | ||
- name: Generate Coverage Report | ||
run: | | ||
coverage report -m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Detect OS for venv differences | ||
OS=$(shell uname -s) | ||
|
||
ifeq ($(OS),Linux) | ||
VENV=.venv/bin | ||
else ifeq ($(OS),Darwin) | ||
VENV=.venv/bin | ||
else | ||
VENV=.venv/Scripts | ||
endif | ||
|
||
# Do the normal QA, similar to the GH action | ||
all: requirements lint test | ||
|
||
# Lint using ruff. Will not break build | ||
lint: | ||
-${VENV}/ruff -- --format=github --target-version=py310 . | ||
|
||
# Run pytests with proper output | ||
test: | ||
${VENV}/pytest -v -s | ||
|
||
# Run hellsnake :D | ||
run: requirements | ||
${VENV}/python hell_snake.py | ||
|
||
# Use make init to initialize venv | ||
init: requirements | ||
.venv: | ||
python -m venv .venv | ||
|
||
# Install/Update requirements | ||
.PHONY: requirements | ||
requirements: .venv | ||
${VENV}/pip install -r requirements.txt | ||
|
||
# Clean the venv | ||
clean: | ||
ifeq ($(OS),Linux) | ||
rm -rf .venv | ||
else ifeq ($(OS),Darwin) | ||
rm -rf .venv | ||
else | ||
rm -r .venv | ||
endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters