Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal GitHub CI: demo unittest and black check #142

Merged
merged 5 commits into from
Nov 5, 2024
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
26 changes: 26 additions & 0 deletions .github/workflows/black_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Black Check

on:
push:
branches: [ main, release-1.0.0]
pull_request:
branches: [ main, release-1.0.0]

jobs:

check-black:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Install Black 24.10.0 - check setup.py if version matches
run: |
python -m pip install --upgrade pip
pip install black==24.10.0
- name: Run Black
run: |
black --check . --line-length 120
26 changes: 26 additions & 0 deletions .github/workflows/py311_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Pytest

on:
push:
branches: [ main, release-1.0.0]
pull_request:
branches: [ main, release-1.0.0]

jobs:

build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[test]
- name: Run tests
run: |
pytest
2 changes: 1 addition & 1 deletion factgenie/bin/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,4 +314,4 @@ def run():

if __name__ == "__main__":
app = create_app()
app.run(debug=False)
app.run(debug=False)
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ def run(self):
"wheel>=0.44.0",
# Set exact version of black formatter to avoid merge conflicts due to different setup.
# See also pyproject.toml and setup of line length (to 120 characters)
"black==24.10.0",
"ipdb",
"black==24.10.0",
],
"test": [
"pytest>=8.3.3",
],
"deploy": [
"gunicorn>=23.0.0",
Expand Down
11 changes: 11 additions & 0 deletions tests/test_demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def test_demo_ok():
assert 1 + 1 == 2


# # Uncomment to fail the tests
# def test_demo_ko():
# assert 1 + 1 == 3
#
#
# def test_demo_exception():
# return 1 / 0
Loading