Skip to content

Commit aa03711

Browse files
authored
Merge pull request #63 from mercadopago/feature/Actions_CI_and_CD
Actions CI and CD
2 parents 670315d + 9befe6c commit aa03711

File tree

3 files changed

+80
-4
lines changed

3 files changed

+80
-4
lines changed

.github/workflows/cd.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This workflow will install Python dependencies and upload a version in the PyPI
2+
name: CD - Upload PyPI
3+
4+
on:
5+
release:
6+
types: [ released ]
7+
8+
jobs:
9+
upload:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
# Sets up python
16+
- uses: actions/setup-python@v2
17+
with:
18+
python-version: 3.7
19+
20+
# Install dependencies
21+
- name: "Installs dependencies"
22+
run: |
23+
python3 -m pip install --upgrade pip
24+
python3 -m pip install setuptools wheel twine
25+
python3 setup.py install
26+
27+
# Build and upload to PyPI
28+
- name: "Builds and uploads to PyPI"
29+
run: |
30+
python3 setup.py sdist bdist_wheel
31+
python3 -m twine check dist/*
32+
python3 -m twine upload dist/*
33+
env:
34+
TWINE_USERNAME: __token__
35+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

.github/workflows/cd_test_pypi.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflow will install Python dependencies and upload a version in the PyPI test environment
2+
name: CD - Test PyPI
3+
4+
on:
5+
push:
6+
branches: [ master ]
7+
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
# Sets up python
20+
- uses: actions/setup-python@v2
21+
with:
22+
python-version: 3.7
23+
24+
# Install dependencies
25+
- name: "Installs and upgrades pip, installs other dependencies and installs the package from setup.py"
26+
run: |
27+
python3 -m pip install --upgrade pip
28+
python3 -m pip install setuptools wheel twine
29+
python3 setup.py install
30+
31+
# Upload to TestPyPI
32+
- name: Build and Upload to TestPyPI
33+
run: |
34+
python3 setup.py sdist bdist_wheel
35+
python3 -m twine check dist/*
36+
python3 -m twine upload dist/*
37+
env:
38+
TWINE_USERNAME: __token__
39+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
40+
TWINE_REPOSITORY: testpypi

.github/workflows/mercado-pago-package.yml renamed to .github/workflows/ci.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

4-
name: Python package
4+
name: CI - Lint and Tests
55

66
on:
7-
push:
8-
branches:
9-
- 'master'
107
pull_request:
118
branches:
129
- 'master'
@@ -25,19 +22,23 @@ jobs:
2522
uses: actions/setup-python@v2
2623
with:
2724
python-version: ${{ matrix.python-version }}
25+
2826
- name: Install dependencies
2927
run: |
3028
python -m pip install --upgrade pip
3129
python -m pip install requests
30+
3231
- name: Lint with Pylint
3332
run: |
3433
pip install pylint
3534
pylint mercadopago
3635
pylint --rcfile=tests/.pylintrc tests
36+
3737
- name: Lint with Isort
3838
run: |
3939
pip install isort
4040
isort .
41+
4142
- name: Test with unittest
4243
run: |
4344
python -m unittest discover tests/

0 commit comments

Comments
 (0)