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

chore: adding ci-cd (pre-commit and test) #3

Merged
merged 1 commit into from
Aug 29, 2023
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
44 changes: 44 additions & 0 deletions .github/workflows/pre-commit-and-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: pre-commit and tests

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Run pre-commit
uses: pre-commit/[email protected]

tests:
needs: pre-commit
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pipenv
pipenv install --dev --system

- name: Check for test files
run: |
if [ -n "$(find . -name 'test_*.py')" ]; then
echo "Test files found. Running tests..."
pytest
else
echo "No test files found. Skipping tests."
fi
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ fastapi = "~= 0.101"
uvicorn = {extras = ["standard"], version = "~= 0.23"}

[dev-packages]
pytest = "*"

[requires]
python_version = "3.11"
Loading