Update to latest cli version #71
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2010 New Relic, Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
--- | |
name: Deploy | |
on: | |
release: | |
types: | |
- published | |
jobs: | |
build-linux-py3-legacy: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
wheel: | |
- cp37-manylinux | |
- cp37-musllinux | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # 3.0.0 | |
- name: Build Wheels | |
uses: pypa/cibuildwheel@8d945475ac4b1aac4ae08b2fd27db9917158b6ce # 2.17.0 | |
env: | |
CIBW_PLATFORM: linux | |
CIBW_BUILD: "${{ matrix.wheel }}*" | |
CIBW_ARCHS_LINUX: x86_64 aarch64 | |
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" | |
CIBW_TEST_REQUIRES: pytest | |
CIBW_TEST_COMMAND: "PYTHONPATH={project}/tests pytest {project}/tests/agent_unittests -vx" | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # 4.3.1 | |
with: | |
name: ${{ github.job }}-${{ matrix.wheel }} | |
path: ./wheelhouse/*.whl | |
retention-days: 1 | |
build-linux-py3: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
wheel: | |
- cp38-manylinux | |
- cp38-musllinux | |
- cp39-manylinux | |
- cp39-musllinux | |
- cp310-manylinux | |
- cp310-musllinux | |
- cp311-manylinux | |
- cp311-musllinux | |
- cp312-manylinux | |
- cp312-musllinux | |
- cp313-manylinux | |
- cp313-musllinux | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # 3.0.0 | |
- name: Build Wheels | |
uses: pypa/cibuildwheel@d4a2945fcc8d13f20a1b99d461b8e844d5fc6e23 # 2.21.1 | |
env: | |
CIBW_PLATFORM: linux | |
CIBW_BUILD: "${{ matrix.wheel }}*" | |
CIBW_ARCHS_LINUX: x86_64 aarch64 | |
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" | |
CIBW_TEST_REQUIRES: pytest | |
CIBW_TEST_COMMAND: "PYTHONPATH={project}/tests pytest {project}/tests/agent_unittests -vx" | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # 4.3.1 | |
with: | |
name: ${{ github.job }}-${{ matrix.wheel }} | |
path: ./wheelhouse/*.whl | |
retention-days: 1 | |
build-sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Install Dependencies | |
run: | | |
pip install -U pip | |
pip install -U setuptools | |
- name: Build Source Package | |
run: | | |
python setup.py sdist | |
- name: Prepare MD5 Hash File | |
run: | | |
tarball="$(python setup.py --fullname).tar.gz" | |
md5_file=${tarball}.md5 | |
openssl md5 -binary dist/${tarball} | xxd -p | tr -d '\n' > dist/${md5_file} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # 4.3.1 | |
with: | |
name: ${{ github.job }}-sdist | |
path: | | |
./dist/*.tar.gz | |
./dist/*.tar.gz.md5 | |
retention-days: 1 | |
deploy: | |
runs-on: ubuntu-latest | |
needs: | |
- build-linux-py3-legacy | |
- build-linux-py3 | |
- build-sdist | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # 5.1.0 | |
with: | |
python-version: "3.x" | |
architecture: x64 | |
- name: Install Dependencies | |
run: | | |
pip install -U pip | |
pip install -U wheel setuptools twine | |
- name: Download Artifacts | |
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # 4.1.4 | |
with: | |
path: ./artifacts/ | |
- name: Unpack Artifacts | |
run: | | |
mkdir -p dist/ | |
mv artifacts/**/*{.whl,.tar.gz,.tar.gz.md5} dist/ | |
- name: Upload Package to S3 | |
run: | | |
tarball="$(python setup.py --fullname).tar.gz" | |
md5_file=${tarball}.md5 | |
aws s3 cp dist/${md5_file} $S3_DST/${md5_file} | |
aws s3 cp dist/${tarball} $S3_DST/${tarball} | |
env: | |
S3_DST: s3://nr-downloads-main/python_agent/release | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: us-west-2 | |
- name: Upload Package to PyPI | |
run: | | |
twine upload --non-interactive dist/*.tar.gz dist/*.whl | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
- name: Create release tags for Lambda and K8s Init Containers | |
uses: dev-hanz-ops/install-gh-cli-action@c78dbed4be2f8d6133a14a9a597ee12fd4ed5c93 # v3 | |
with: | |
gh-cli-version: 2.63.2 | |
run: | | |
gh auth login --with-token <<< $GH_RELEASE_TOKEN | |
echo "newrelic/newrelic-lambda-layers - Releasing New Relic Python Agent ${GITHUB_REF}.0 with tag ${GITHUB_REF}.0_python" | |
gh create release "${GITHUB_REF}.0_python" -t "New Relic Python Agent ${GITHUB_REF}.0" --repo=newrelic/newrelic-lambda-layers | |
echo "newrelic/newrelic-agent-init-container - Releasing New Relic Python Agent ${GITHUB_REF}.0 with tag ${GITHUB_REF}.0_python" | |
gh create release "${GITHUB_REF}.0_python" -t "New Relic Python Agent ${GITHUB_REF}.0" --repo=newrelic/newrelic-agent-init-container | |
env: | |
GH_RELEASE_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }} |