Skip to content

Commit 2bcd970

Browse files
committed
updated the workflows
1 parent 1e89feb commit 2bcd970

4 files changed

Lines changed: 133 additions & 34 deletions

File tree

.github/workflows/ci_cd.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
release:
8+
types: [published]
9+
workflow_dispatch:
10+
11+
jobs:
12+
test:
13+
name: Run Tests Before Publish
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: true
17+
matrix:
18+
python-version: ["3.9", "3.10", "3.11"]
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
cache: 'pip'
29+
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install -r requirements.txt
34+
pip install pytest pytest-cov
35+
36+
- name: Run Tests
37+
run: |
38+
pytest tests/ -v --tb=short
39+
40+
build:
41+
name: Build Package
42+
needs: test
43+
runs-on: ubuntu-latest
44+
45+
steps:
46+
- name: Checkout code
47+
uses: actions/checkout@v4
48+
49+
- name: Set up Python
50+
uses: actions/setup-python@v5
51+
with:
52+
python-version: '3.11'
53+
54+
- name: Install build dependencies
55+
run: |
56+
python -m pip install --upgrade pip
57+
pip install build twine
58+
59+
- name: Build package
60+
run: python -m build
61+
62+
- name: Check package
63+
run: twine check dist/*
64+
65+
- name: Upload build artifacts
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: dist
69+
path: dist/
70+
71+
publish:
72+
name: Publish to PyPI
73+
needs: build
74+
runs-on: ubuntu-latest
75+
permissions:
76+
id-token: write
77+
78+
steps:
79+
- name: Download artifacts
80+
uses: actions/download-artifact@v4
81+
with:
82+
name: dist
83+
path: dist/
84+
85+
- name: Publish to PyPI
86+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/tests.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main, develop, 'feature/**' ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
name: Test (Python ${{ matrix.python-version }})
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
python-version: ["3.9", "3.10", "3.11", "3.12"]
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
cache: 'pip'
27+
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install -r requirements.txt
32+
pip install pytest pytest-cov
33+
34+
- name: Run Tests with Coverage
35+
run: |
36+
pytest tests/ -v --cov=finlearner --cov-report=xml --cov-report=term-missing
37+
38+
- name: Upload coverage reports
39+
uses: codecov/codecov-action@v4
40+
if: matrix.python-version == '3.11'
41+
with:
42+
file: ./coverage.xml
43+
flags: unittests
44+
name: codecov-finlearner
45+
fail_ci_if_error: false

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
</p>
66

77
<p align="center">
8-
<a href="https://github.com/ankitdutta428/finlearner/actions/workflows/ci_cd.yml">
9-
<img src="https://github.com/ankitdutta428/finlearner/actions/workflows/ci_cd.yml/badge.svg" alt="CI/CD">
8+
<a href="https://github.com/ankitdutta428/finlearner/actions/workflows/tests.yml">
9+
<img src="https://github.com/ankitdutta428/finlearner/actions/workflows/tests.yml/badge.svg" alt="Tests">
1010
</a>
1111
<a href="https://pypi.org/project/finlearner/">
1212
<img src="https://img.shields.io/pypi/v/finlearner.svg?color=blue" alt="PyPI version">

0 commit comments

Comments
 (0)