Skip to content

Commit 2173546

Browse files
authored
Merge pull request #16 from AKKI0511/codex/create-ci-workflow-with-caching-and-checks
Add CI workflow
2 parents cf482cc + 8f8ddda commit 2173546

File tree

5 files changed

+69
-1
lines changed

5 files changed

+69
-1
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[flake8]
22
max-line-length = 88
3-
extend-ignore = E203, W503
3+
extend-ignore = E203, W503, F401, F841, E402

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.11'
18+
cache: 'pip'
19+
cache-dependency-path: |
20+
requirements.txt
21+
setup.py
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -r requirements.txt
27+
pip install -e .
28+
29+
- name: Lint with flake8
30+
run: flake8
31+
32+
- name: Check formatting with black
33+
run: black --check .
34+
35+
- name: Run tests
36+
run: pytest

.pre-commit-config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 24.3.0
4+
hooks:
5+
- id: black
6+
language_version: python3.11
7+
args: ["--check"]
8+
- repo: https://github.com/pycqa/flake8
9+
rev: 6.1.0
10+
hooks:
11+
- id: flake8
12+
language_version: python3.11
13+
- repo: local
14+
hooks:
15+
- id: pytest
16+
name: pytest
17+
entry: pytest
18+
language: system
19+
types: [python]
20+
pass_filenames: false

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,17 @@ pip install -r requirements.txt
100100
python setup.py develop
101101
```
102102

103+
## Development
104+
105+
Install pre-commit hooks to run the same checks as the CI pipeline:
106+
107+
```bash
108+
pre-commit install
109+
pre-commit run --all-files
110+
```
111+
112+
The hooks will run `black --check`, `flake8`, and `pytest` before every commit.
113+
103114
## Data Caching
104115

105116
The `DataLoader` caches downloaded OHLCV data in parquet format to reduce

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ python-dotenv
1212
pytest
1313
black
1414
flake8
15+
pre-commit
1516
PyYAML
1617
tqdm
1718
optuna

0 commit comments

Comments
 (0)