From 17e18fd3d9de66a9cb4f72f9fad33019baefb953 Mon Sep 17 00:00:00 2001 From: eltinMeli Date: Mon, 26 Sep 2022 19:16:48 -0300 Subject: [PATCH 1/3] Update and workflows CI and CD --- .github/workflows/cd.yml | 34 ++++++++++++++++ .github/workflows/cd_test_pypi.yml | 40 +++++++++++++++++++ .../{mercado-pago-package.yml => ci.yml} | 9 +++-- 3 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/cd.yml create mode 100644 .github/workflows/cd_test_pypi.yml rename .github/workflows/{mercado-pago-package.yml => ci.yml} (94%) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..25c47f9 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,34 @@ +# This workflow will install Python dependencies and upload a version in the PyPI +name: CD + +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 + + # 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 }} \ No newline at end of file diff --git a/.github/workflows/cd_test_pypi.yml b/.github/workflows/cd_test_pypi.yml new file mode 100644 index 0000000..6ea2175 --- /dev/null +++ b/.github/workflows/cd_test_pypi.yml @@ -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: + +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 \ No newline at end of file diff --git a/.github/workflows/mercado-pago-package.yml b/.github/workflows/ci.yml similarity index 94% rename from .github/workflows/mercado-pago-package.yml rename to .github/workflows/ci.yml index c737f0b..0f7552b 100644 --- a/.github/workflows/mercado-pago-package.yml +++ b/.github/workflows/ci.yml @@ -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 on: - push: - branches: - - 'master' pull_request: branches: - 'master' @@ -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/ From 1e02a2bec1ad8857825ad1aaa3cc8d93fb216b5e Mon Sep 17 00:00:00 2001 From: eltinMeli Date: Mon, 26 Sep 2022 19:19:22 -0300 Subject: [PATCH 2/3] Rename workflows --- .github/workflows/cd.yml | 2 +- .github/workflows/ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 25c47f9..e3d76e5 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,5 +1,5 @@ # This workflow will install Python dependencies and upload a version in the PyPI -name: CD +name: CD - Upload PyPI on: release: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f7552b..114b492 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,7 @@ # 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: CI +name: CI - Lint and Tests on: pull_request: From 9befe6c1e3fae1cb7a568b8040d6a629e7492327 Mon Sep 17 00:00:00 2001 From: eltinMeli Date: Tue, 27 Sep 2022 10:12:54 -0300 Subject: [PATCH 3/3] Add setup_install --- .github/workflows/cd.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index e3d76e5..409053b 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -22,6 +22,7 @@ jobs: run: | python3 -m pip install --upgrade pip python3 -m pip install setuptools wheel twine + python3 setup.py install # Build and upload to PyPI - name: "Builds and uploads to PyPI"