|
| 1 | +# Copyright 2010 New Relic, Inc. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +name: Deploy |
| 16 | + |
| 17 | +on: |
| 18 | + release: |
| 19 | + types: |
| 20 | + - published |
| 21 | + |
| 22 | +jobs: |
| 23 | + deploy-linux: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v2 |
| 28 | + with: |
| 29 | + persist-credentials: false |
| 30 | + fetch-depth: 0 |
| 31 | + |
| 32 | + - name: Setup QEMU |
| 33 | + uses: docker/setup-qemu-action@v1 |
| 34 | + |
| 35 | + - uses: actions/setup-python@v2 |
| 36 | + with: |
| 37 | + python-version: "3.x" |
| 38 | + architecture: x64 |
| 39 | + |
| 40 | + - name: Install Dependencies |
| 41 | + run: | |
| 42 | + pip install -U pip |
| 43 | + pip install -U wheel setuptools twine |
| 44 | +
|
| 45 | + - name: Build Source Package |
| 46 | + run: python setup.py sdist |
| 47 | + |
| 48 | + - name: Build Manylinux Wheels (Python 2) |
| 49 | + |
| 50 | + env: |
| 51 | + CIBW_PLATFORM: linux |
| 52 | + CIBW_BUILD: cp27-manylinux_x86_64 |
| 53 | + CIBW_ARCHS: x86_64 |
| 54 | + CIBW_ENVIRONMENT: "LD_LIBRARY_PATH=/opt/rh/=vtoolset-8/root/usr/lib64:/opt/rh/devtoolset-8/root/usr/lib:/opt/rh/devtoolset-8/root/usr/lib64/dyninst:/opt/rh/devtoolset-8/root/usr/lib/dyninst:/usr/local/lib64:/usr/local/lib" |
| 55 | + CIBW_TEST_REQUIRES: beautifulsoup4 |
| 56 | + CIBW_TEST_COMMAND: "pip install -r {package}/tests/base_requirements.txt && export PYTHONPATH={package}/tests && NEW_RELIC_APDEX_T=1000 pytest -vx {package}/tests/agent_features/ && pytest -vx {package}/tests/agent_unittests/" |
| 57 | + |
| 58 | + - name: Build Manylinux Wheels (Python 3) |
| 59 | + |
| 60 | + env: |
| 61 | + CIBW_PLATFORM: linux |
| 62 | + CIBW_BUILD: cp36-manylinux_aarch64 cp37-manylinux_aarch64 cp38-manylinux_aarch64 cp39-manylinux_aarch64 cp36-manylinux_x86_64 cp37-manylinux_x86_64 cp38-manylinux_x86_64 cp39-manylinux_x86_64 |
| 63 | + CIBW_ARCHS: x86_64 aarch64 |
| 64 | + CIBW_ENVIRONMENT: "LD_LIBRARY_PATH=/opt/rh/devtoolset-8/root/usr/lib64:/opt/rh/devtoolset-8/root/usr/lib:/opt/rh/devtoolset-8/root/usr/lib64/dyninst:/opt/rh/devtoolset-8/root/usr/lib/dyninst:/usr/local/lib64:/usr/local/lib" |
| 65 | + CIBW_TEST_REQUIRES: beautifulsoup4 |
| 66 | + CIBW_TEST_COMMAND: "pip install -r {package}/tests/base_requirements.txt && export PYTHONPATH={package}/tests && NEW_RELIC_APDEX_T=1000 pytest -vx {package}/tests/agent_features/ && pytest -vx {package}/tests/agent_unittests/" |
| 67 | + |
| 68 | + - name: Upload Package to S3 |
| 69 | + run: | |
| 70 | + tarball="$(python setup.py --fullname).tar.gz" |
| 71 | + md5_file=$(mktemp) |
| 72 | + openssl md5 -binary dist/$tarball | xxd -p | tr -d '\n' > $md5_file |
| 73 | + aws s3 cp $md5_file $S3_DST/${tarball}.md5 |
| 74 | + aws s3 cp dist/$tarball $S3_DST/$tarball |
| 75 | + env: |
| 76 | + S3_DST: s3://nr-downloads-main/python_agent/release |
| 77 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 78 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 79 | + AWS_DEFAULT_REGION: us-west-2 |
| 80 | + |
| 81 | + - name: Upload Package to PyPI |
| 82 | + run: | |
| 83 | + twine upload --non-interactive dist/*.tar.gz wheelhouse/*-manylinux*.whl |
| 84 | + env: |
| 85 | + TWINE_USERNAME: __token__ |
| 86 | + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |
0 commit comments