Created
June 21, 2024 22:34
-
-
Save jrepp/b6e90747194d2dbe7946c98cd8e2759f to your computer and use it in GitHub Desktop.
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
name: api/app tests | |
on: | |
pull_request: | |
paths: | |
- 'api/app/**' | |
jobs: | |
db-setup: | |
runs-on: ubuntu-latest | |
env: | |
SQL_URL: "sqlite:///${{ github.workspace }}/mythica.db" | |
DATABASE_PATH: "${{ github.workspace }}/mythica.db" | |
PYTHONPATH: "${{ github.workspace }}/api/app" | |
ENABLE_STORAGE: false | |
UPLOAD_FOLDER_AUTO_CLEAN: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' # Specify your Python version | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r api/app/requirements.txt | |
pip install -r api/app/tests/requirements.txt | |
- name: Static Code Linting with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Create SQLite database | |
run: | | |
touch $DATABASE_PATH | |
- name: Initialize Database | |
run: | | |
cd api/app | |
mkdir alembic_sqlite/versions | |
alembic -n sqlite revision --autogenerate -m "initial" | |
- name: Create Schema | |
run: | | |
cd api/app | |
alembic -n sqlite upgrade head | |
- name: Run tests | |
run: | | |
cd api/app | |
pytest . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment