Skip to content

Commit 4968834

Browse files
Merge pull request #26 from JelsinPalomino/ci/codestyle
[code-quality] Implementamos un actions que integra tests, linters y …
2 parents 86a8482 + c33f0eb commit 4968834

File tree

2 files changed

+101
-32
lines changed

2 files changed

+101
-32
lines changed

.github/workflows/codestyle.yaml

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Build
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [published]
7+
push:
8+
branches:
9+
- main
10+
- ci
11+
pull_request:
12+
branches:
13+
- "*"
14+
15+
env:
16+
PROJECT_NAME: sisedeinversiones
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
# python-version: [3.9, "3.10", "3.11"]
25+
python-version: ["3.11"]
26+
27+
steps:
28+
- uses: actions/checkout@v1
29+
with:
30+
fetch-depth: 9
31+
submodules: false
32+
33+
- name: Use Python ${{ matrix.python-version }}
34+
uses: actions/setup-python@v4
35+
with:
36+
python-version: ${{ matrix.python-version }}
37+
38+
- uses: actions/cache@v1
39+
id: depcache
40+
with:
41+
path: deps
42+
key: requirements-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
43+
44+
- name: Download dependencies
45+
if: steps.depcache.outputs.cache-hit != 'true'
46+
run: |
47+
pip download --dest=deps -r requirements.txt
48+
49+
- name: Install dependencies
50+
run: |
51+
pip install -U --no-index --find-links=deps deps/*
52+
53+
- name: Run tests
54+
run: |
55+
pytest --doctest-modules --junitxml=junit/pytest-results-${{ matrix.python-version }}.xml --cov=$PROJECT_NAME --cov-report=xml tests/
56+
57+
- name: Run linters
58+
run: |
59+
echo "Running linters"
60+
flake8 .
61+
isort --check-only . 2>&1
62+
black --check . 2>&1
63+
64+
- name: Upload pytest test results
65+
uses: actions/upload-artifact@master
66+
with:
67+
name: pytest-results-${{ matrix.python-version }}
68+
path: junit/pytest-results-${{ matrix.python-version }}.xml
69+
if: always()
70+
71+
- name: Install distribution dependencies
72+
run: pip install --upgrade twine setuptools wheel
73+
if: matrix.python-version == 3.10
74+
75+
- name: Create distribution package
76+
run: python setup.py sdist bdist_wheel
77+
if: matrix.python-version == 3.10
78+
79+
- name: Upload distribution package
80+
uses: actions/upload-artifact@master
81+
with:
82+
name: dist-package-${{ matrix.python-version}}
83+
path: dist
84+
if: matrix.python-version == 3.10
85+
86+
publish:
87+
runs-on: ubuntu-latest
88+
needs: build
89+
if: github.event_name == 'release'
90+
permissions:
91+
id-token: write
92+
environment: release
93+
steps:
94+
- name: Download a distribution artifact
95+
uses: actions/download-artifact@v4
96+
with:
97+
name: dist-package-3.10
98+
path: dist
99+
100+
- name: Publish distribution 📦 to PyPI
101+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)