diff --git a/.github/workflows/main_build.yml b/.github/workflows/main_build.yml index af1df835c..ffc626338 100644 --- a/.github/workflows/main_build.yml +++ b/.github/workflows/main_build.yml @@ -78,7 +78,7 @@ jobs: - name: Set up and run contract tests with pytest run: | - bash contract-tests/set-up-contract-tests.sh + bash scripts/set-up-contract-tests.sh pip install pytest pytest contract-tests/tests diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index 9470e7f99..f36730062 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -39,7 +39,7 @@ jobs: - name: Set up and run contract tests with pytest run: | - bash contract-tests/set-up-contract-tests.sh + bash scripts/set-up-contract-tests.sh pip install pytest pytest contract-tests/tests diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0c88b42da..f9d4a0e02 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,21 +6,10 @@ documentation, we greatly value feedback and contributions from our community. Please read through this document before submitting any issues or pull requests to ensure we have all the necessary information to effectively respond to your bug report or contribution. -## Build a Wheel file locally -**First time setup** +## Build and install distro locally +From `aws-otel-python-instrumentation` dir, execute: ```sh -pip install --upgrade pip setuptools wheel packaging build -mkdir -p ./dist -``` -**Updating the wheel file** -```sh -rm -rf ./dist/* -cd ./aws-opentelemetry-distro -python3 -m build --outdir ../dist -cd ../dist -pkg_version=$(grep '__version__' ../aws-opentelemetry-distro/src/amazon/opentelemetry/distro/version.py | awk -F '"' '{print $2}') -pip install aws_opentelemetry_distro-${pkg_version}-py3-none-any.whl --force-reinstall -cd .. +./scripts/build_and_install_distro.sh ``` ## Test a sample App diff --git a/contract-tests/README.md b/contract-tests/README.md index f3f087dae..7e6ff49b2 100644 --- a/contract-tests/README.md +++ b/contract-tests/README.md @@ -32,11 +32,11 @@ The steps to add a new test for a library or framework are: Pre-requirements: * Have `docker` installed and running - verify by running the `docker` command. -* Ensure the `aws_opentelemetry_distro` wheel file exists in to `aws-otel-python-instrumentation/dist` folder -From `aws-otel-python-instrumentation` dir, execute: - -``` -./contract-tests/set-up-contract-tests.sh +Steps: +* From `aws-otel-python-instrumentation` dir, execute: +```sh +./scripts/build_and_install_distro.sh +./scripts/set-up-contract-tests.sh pytest contract-tests/tests ``` \ No newline at end of file diff --git a/scripts/build_and_install_distro.sh b/scripts/build_and_install_distro.sh new file mode 100755 index 000000000..328387270 --- /dev/null +++ b/scripts/build_and_install_distro.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Check script is running in contract-tests +current_path=`pwd` +current_dir="${current_path##*/}" +if [ "$current_dir" != "aws-otel-python-instrumentation" ]; then + echo "Please run from aws-otel-python-instrumentation dir" + exit +fi + +# Setup - update dependencies and create/empty dist dir +pip install --upgrade pip setuptools wheel packaging build +mkdir dist +rm -rf dist/aws_opentelemetry_distro* + +# Build distro +cd aws-opentelemetry-distro +python3 -m build --outdir ../dist + +# Install distro +cd ../dist +DISTRO=(aws_opentelemetry_distro-*-py3-none-any.whl) +pip install $DISTRO --force-reinstall +cd .. \ No newline at end of file diff --git a/contract-tests/set-up-contract-tests.sh b/scripts/set-up-contract-tests.sh similarity index 100% rename from contract-tests/set-up-contract-tests.sh rename to scripts/set-up-contract-tests.sh