Skip to content

Commit

Permalink
Fix CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
ManiMozaffar committed Apr 28, 2024
1 parent 1c3d6cb commit 130c0ee
Show file tree
Hide file tree
Showing 5 changed files with 342 additions and 32 deletions.
35 changes: 23 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ jobs:
with:
node-version: 18

- run: pip install -r src/python-fastui/requirements/all.txt
- run: pip install src/python-fastui
- run: pip install pdm==2.12.4

- run: make install

- run: make lint

- run: npm install

Expand Down Expand Up @@ -69,23 +72,31 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- run: pip install -r src/python-fastui/requirements/test.txt
- run: pip install -r src/python-fastui/requirements/pyproject.txt
- run: pip install -e src/python-fastui
- run: pip install pdm==2.12.4

- run: make install

- run: make testcov

- run: make testcov-report

- run: coverage run -m pytest src
# display coverage and fail if it's below 80%, which shouldn't happen
- run: coverage report --fail-under=80
- run: make typecheck

# ci on demo for 3.11 and 3.12, these ops are intentionally omitted, reason is that it's using 3.11 and 3.12 syntax
- if: matrix.python-version == '3.11' || matrix.python-version == '3.12'
run: make lint-demo

- if: matrix.python-version == '3.11' || matrix.python-version == '3.12'
run: make typecheck-demo

# test demo on 3.11 and 3.12, these tests are intentionally omitted from coverage
- if: matrix.python-version == '3.11' || matrix.python-version == '3.12'
run: pytest demo/tests.py
run: make test-demo

- run: coverage xml
- run: make testcov-xml

- uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
file: ./src/python-fastui/coverage.xml
env_vars: PYTHON,OS

npm-build:
Expand Down
20 changes: 19 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,40 @@ format:
.PHONY: lint
lint:
cd src/python-fastui && pdm run ruff check .

.PHONY: lint-demo
lint-demo:
cd demo && pdm run ruff check .


.PHONY: typecheck
typecheck:
cd src/python-fastui && pdm run pyright fastui

.PHONY: typecheck-demo
typecheck-demo:
cd demo && pdm run pyright src


.PHONY: test
test:
cd src/python-fastui && pdm run coverage run -m pytest tests
cd demo && pdm run coverage run -m pytest tests

.PHONY: test-demo
test-demo:
cd demo && pdm run pytest tests

.PHONY: testcov
testcov: test
cd src/python-fastui && pdm run coverage html

.PHONY: testcov-report
testcov-report:
cd src/python-fastui && pdm run coverage report --fail-under=80

testcov-xml:
cd src/python-fastui && pdm run coverage xml

.PHONY: typescript-models
typescript-models:
fastui generate fastui:FastUI src/npm-fastui/src/models.d.ts
Expand Down
Loading

0 comments on commit 130c0ee

Please sign in to comment.