diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml new file mode 100644 index 00000000..fb06634d --- /dev/null +++ b/.github/workflows/publishing.yml @@ -0,0 +1,127 @@ +name: Publishing + +on: + push: + tags: + - '*' + +jobs: + + tests: + name: Run tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.9 + - run: pip install tox + - run: tox + env: + TOXENV: 3.9 + + linters: + name: Run linters + runs-on: ubuntu-latest + strategy: + matrix: + toxenv: [flake8, pydocstyle, mypy, pylint] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.9 + - run: pip install tox + - run: tox + env: + TOXENV: ${{ matrix.toxenv }} + + build-sdist: + name: Build source tarball + needs: [tests, linters] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.9 + - run: python setup.py sdist + - uses: actions/upload-artifact@v2 + with: + path: ./dist/* + + build-wheels: + name: Build wheels + needs: [tests, linters] + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.9 + - run: pip install cibuildwheel==1.8.0 + - name: Install Visual C++ for Python 2.7 on Windows + if: runner.os == 'Windows' + run: | + choco install vcpython27 -f -y + - run: cibuildwheel --output-dir wheelhouse + - uses: actions/upload-artifact@v2 + with: + path: ./wheelhouse/*.whl + + build-wheels-linux-aarch64: + name: Build wheels (ubuntu-latest-aarch64) + needs: [tests, linters] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - uses: actions/setup-python@v2 + with: + python-version: 3.9 + - run: pip install cibuildwheel==1.8.0 + - run: cibuildwheel --archs aarch64 --output-dir wheelhouse + - uses: actions/upload-artifact@v2 + with: + path: ./wheelhouse/*.whl + + publish: + name: Publish on PyPI + needs: [build-sdist, build-wheels, build-wheels-linux-aarch64] + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v2 + with: + name: artifact + path: dist + - uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + + publish-docs: + name: Publish docs + needs: [publish] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.9 + - run: pip install -r requirements-doc.txt + - run: pip install awscli + - run: pip install -e . + - run: (cd docs && make clean html) + - run: | + aws s3 sync docs/_build/html s3://python-dependency-injector-docs --delete + aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} --path "/*" > /dev/null + echo "Cache invalidation triggered" + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} diff --git a/.github/workflows/tests-and-linters.yml b/.github/workflows/tests-and-linters.yml new file mode 100644 index 00000000..bda10818 --- /dev/null +++ b/.github/workflows/tests-and-linters.yml @@ -0,0 +1,55 @@ +name: Tests and linters + +on: [push, pull_request, workflow_dispatch] + +jobs: + + test-on-different-versions: + name: Run tests + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, pypy2, pypy3] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - run: pip install tox + - run: tox + env: + TOXENV: ${{ matrix.python-version }} + + test-coverage: + name: Run tests with coverage + runs-on: ubuntu-latest + env: + DEPENDENCY_INJECTOR_DEBUG_MODE: 1 + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.9 + - run: pip install tox cython + - run: make cythonize + - run: tox + env: + TOXENV: coveralls + + linters: + name: Run linters + runs-on: ubuntu-latest + strategy: + matrix: + toxenv: [flake8, pydocstyle, mypy, pylint] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.9 + - run: pip install tox + - run: tox + env: + TOXENV: ${{ matrix.toxenv }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 075c6be1..00000000 --- a/.travis.yml +++ /dev/null @@ -1,132 +0,0 @@ -os: linux -dist: xenial -language: python -jobs: - include: - - python: 3.9 - env: TOXENV=coveralls DEPENDENCY_INJECTOR_DEBUG_MODE=1 - install: - - pip install tox - - pip install cython - - make cythonize - script: tox - - python: 3.6 - env: TOXENV=pylint - install: pip install tox - script: tox - - python: 3.6 - env: TOXENV=flake8 - install: pip install tox - script: tox - - python: 3.6 - env: TOXENV=pydocstyle - install: pip install tox - script: tox - - python: 3.6 - env: TOXENV=mypy - install: pip install tox - script: tox - - python: 2.7 - env: TOXENV=py27 - install: pip install tox - script: tox - - python: 3.4 - env: TOXENV=py34 - install: pip install tox - script: tox - - python: 3.5 - env: TOXENV=py35 - install: pip install tox - script: tox - - python: 3.6 - env: TOXENV=py36 - install: pip install tox - script: tox - - python: 3.7 - env: TOXENV=py37 - install: pip install tox - script: tox - - python: 3.8 - env: TOXENV=py38 - install: pip install tox - script: tox - - python: 3.9 - env: TOXENV=py39 - install: pip install tox - script: tox - - python: pypy - env: TOXENV=pypy - install: pip install tox - script: tox - - python: pypy3 - env: TOXENV=pypy3 - install: pip install tox - script: tox - - python: 3.8 - if: tag IS present - env: TWINE_USERNAME=__token__ - install: pip install pip --upgrade - script: python setup.py sdist - after_success: - - python3 -m pip install twine - - python3 -m twine upload dist/* - - services: docker - if: tag IS present - env: TWINE_USERNAME=__token__ - install: python3 -m pip install cibuildwheel==1.6.3 - script: python3 -m cibuildwheel --output-dir wheelhouse - after_success: - - python3 -m pip install --upgrade --upgrade-strategy eager twine - - python3 -m twine upload wheelhouse/*.whl - - services: docker - arch: arm64 - if: tag IS present - env: TWINE_USERNAME=__token__ - install: python3 -m pip install cibuildwheel==1.6.3 - script: python3 -m cibuildwheel --output-dir wheelhouse - after_success: - - python3 -m pip install --upgrade --upgrade-strategy eager twine - - python3 -m twine upload wheelhouse/*.whl - - os: osx - if: tag IS present - language: shell - osx_image: xcode10.2 - env: TWINE_USERNAME=__token__ - install: python3 -m pip install cibuildwheel==1.6.3 - script: python3 -m cibuildwheel --output-dir wheelhouse - after_success: - - python3 -m pip install --upgrade --upgrade-strategy eager twine - - python3 -m twine upload wheelhouse/*.whl - - os: windows - if: tag IS present - language: shell - env: TWINE_USERNAME=__token__ - before_install: - - choco install python --version 3.8.6 - - export PATH="/c/Python38:/c/Python38/Scripts:$PATH" - - ln -s /c/Python38/python.exe /c/Python38/python3.exe - install: - - python3 -m pip install certifi cibuildwheel==1.6.3 - - export SSL_CERT_FILE=`python3 -c "import certifi;print(certifi.where())"` - - echo $SSL_CERT_FILE - script: python -m cibuildwheel --output-dir wheelhouse - after_success: - - python -m pip install --upgrade --upgrade-strategy eager twine - - python -m twine upload wheelhouse/*.whl - - python: 3.8 - if: branch = master - install: - - pip install -r requirements-doc.txt - - pip install awscli - - pip install -e . - script: (cd docs && make clean html) - after_success: - - aws s3 sync docs/_build/html s3://python-dependency-injector-docs --delete - - aws cloudfront create-invalidation --distribution-id ${AWS_CLOUDFRONT_DISTRIBUTION_ID} --path "/*" > /dev/null - - echo "Cache invalidation triggered" -echo "Result: OK" - - python -m twine upload wheelhouse/*.whl -notifications: - slack: - rooms: - secure: CdWDgKnfYW7vvvoH3nS3yg3TcNZiYLRUyEp6ukQ4rQiiuR4+ltuvyGyFJWgP8r7VVJ9yHkB0jebCKWLUMsAEt1my33B6eMDEVefovpkdh2eJjGswmm80brt0EJULpgwPOtB1U47Mwca8L5jDW4KSv9RypUFRgn8eHDoWw6LKf5g= diff --git a/tox.ini b/tox.ini index ddc458ec..da86a4d5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist= - coveralls, pylint, flake8, pydocstyle, py27, py34, py35, py36, py37, py38, pypy, pypy3 + coveralls, pylint, flake8, pydocstyle, 2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, pypy2, pypy3 [testenv] deps= @@ -17,7 +17,7 @@ commands= unit2 discover -s tests/unit -p test_*_py3*.py [testenv:coveralls] -passenv=TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH DEPENDENCY_INJECTOR_DEBUG_MODE +passenv = GITHUB_* COVERALLS_* basepython=python3.9 usedevelop=True deps= @@ -31,7 +31,7 @@ commands= coverage report --rcfile=./.coveragerc coveralls -[testenv:py27] +[testenv:2.7] deps= unittest2 extras= @@ -40,7 +40,7 @@ extras= commands= unit2 discover -s tests/unit -p test_*_py2_py3.py -[testenv:py34] +[testenv:3.4] deps= unittest2 extras= @@ -48,7 +48,7 @@ extras= commands= unit2 discover -s tests/unit -p test_*_py3.py -[testenv:py35] +[testenv:3.5] deps= unittest2 extras= @@ -57,7 +57,7 @@ extras= commands= unit2 discover -s tests/unit -p test_*_py3.py -[testenv:pypy] +[testenv:pypy2] deps= unittest2 extras=