Skip to content

Commit

Permalink
feat/CI (#1)
Browse files Browse the repository at this point in the history
* feat: create CI

* fix: add push trigger

* refactor: rename jobs, add dummy script

* fix: run nbdev_prepare

* fix: add ruff exclude

* style: add empty line at the end
  • Loading branch information
asawczyn authored Feb 28, 2024
1 parent 8b39d11 commit 5834bfd
Show file tree
Hide file tree
Showing 12 changed files with 88 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ on:
branches: [ "main", "master" ]
workflow_dispatch:
jobs:
deploy:
ghp-deploy:
runs-on: ubuntu-latest
steps: [uses: fastai/workflows/quarto-ghp@master]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: CI
name: nbdev-test
on: [workflow_dispatch, pull_request, push]

jobs:
test:
nbdev-test:
runs-on: ubuntu-latest
steps: [uses: fastai/workflows/nbdev-ci@master]
39 changes: 39 additions & 0 deletions .github/workflows/python.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: python-check
on: [ pull_request, push ]

jobs:
python-check:
strategy:
fail-fast: false
matrix:
python-version: [ 3.11 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install deps
run: make install
- name: Check
run: make check

python-test:
needs:
- python-check
strategy:
fail-fast: false
matrix:
python-version: [ 3.11 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install deps
run: make install
- name: Check
run: make test
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
lint_dirs := juddges scripts notebooks dashboards tests
mypy_dirs := juddges scripts dashboards tests

fix:
ruff check $(lint_dirs) --fix
ruff format $(lint_dirs)

check:
ruff check $(lint_dirs)
ruff format $(lint_dirs) --check
mypy --install-types --non-interactive $(mypy_dirs)

test:
coverage run -m pytest
coverage report -mi

all: check test

install:
pip install -r requirements.txt

3 changes: 3 additions & 0 deletions dashboards/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import streamlit as st

st.title("JuDDGES Dashboard")
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: juddges
services:
web:
build: .
command: streamlit run /app/juddges/dashboards/app.py
command: streamlit run /app/dashboards/app.py
volumes:
- ./:/app
- ~/.cache:/root/.cache
Expand Down
3 changes: 0 additions & 3 deletions juddges/dashboards/app.py

This file was deleted.

Empty file added notebooks/.gitkeep
Empty file.
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[tool.ruff]
line-length = 100
extend-include = ["*.ipynb"]
exclude = ["_modidx.py"]

[tool.mypy]
python_version = "3.10"
strict = true
plugins = "numpy.typing.mypy_plugin"
6 changes: 5 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
nbdev==2.3.13
streamlit==1.31.1
streamlit==1.31.1
ruff==0.2.2
coverage==7.4.3
pytest==8.0.2
mypy==1.8.0
2 changes: 2 additions & 0 deletions scripts/run_dummy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# mypy requires .py file in the directory
# file should be deleted later
5 changes: 5 additions & 0 deletions tests/test_judgges.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from juddges import __version__


def test_version() -> None:
assert __version__ == "0.0.1"

0 comments on commit 5834bfd

Please sign in to comment.