Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actions CI and CD #63

Merged
merged 3 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This workflow will install Python dependencies and upload a version in the PyPI
name: CD - Upload PyPI

on:
release:
types: [ released ]

jobs:
upload:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

# Sets up python
- uses: actions/setup-python@v2
with:
python-version: 3.7

# Install dependencies
- name: "Installs dependencies"
run: |
python3 -m pip install --upgrade pip
python3 -m pip install setuptools wheel twine
eltinMeli marked this conversation as resolved.
Show resolved Hide resolved
python3 setup.py install

# Build and upload to PyPI
- name: "Builds and uploads to PyPI"
run: |
python3 setup.py sdist bdist_wheel
python3 -m twine check dist/*
python3 -m twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/cd_test_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will install Python dependencies and upload a version in the PyPI test environment
name: CD - Test PyPI

on:
push:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
rhames07 marked this conversation as resolved.
Show resolved Hide resolved

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

# Sets up python
- uses: actions/setup-python@v2
with:
python-version: 3.7

# Install dependencies
- name: "Installs and upgrades pip, installs other dependencies and installs the package from setup.py"
run: |
python3 -m pip install --upgrade pip
python3 -m pip install setuptools wheel twine
python3 setup.py install

# Upload to TestPyPI
- name: Build and Upload to TestPyPI
run: |
python3 setup.py sdist bdist_wheel
python3 -m twine check dist/*
python3 -m twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
TWINE_REPOSITORY: testpypi
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package
name: CI - Lint and Tests

on:
push:
branches:
- 'master'
pull_request:
branches:
- 'master'
Expand All @@ -25,19 +22,23 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install requests

- name: Lint with Pylint
run: |
pip install pylint
pylint mercadopago
pylint --rcfile=tests/.pylintrc tests

- name: Lint with Isort
run: |
pip install isort
isort .

- name: Test with unittest
run: |
python -m unittest discover tests/