Skip to content

Commit

Permalink
Minimal GitHub CI: demo unittest and black check (#142)
Browse files Browse the repository at this point in the history
* setup minimal Gitlab CI: unittest, black

only for the main branch and PRs to the main
pytest are only demo tests

* apply the same behavior for CI for the release-1.0.0 branch as for the main
  • Loading branch information
oplatek authored Nov 5, 2024
1 parent 76a4ddd commit 5c2371c
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 2 deletions.
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

0 comments on commit 5c2371c

Please sign in to comment.