Skip to content

Commit ec3011e

Browse files
authored
Improve build process by moving to script (#63)
In this commit, we are moving the build and install distro steps to a script to make it easier to run. As well, we are moving `set-up-contract-tests.sh` to the scripts folder for consistency. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent 12c070b commit ec3011e

File tree

6 files changed

+33
-21
lines changed

6 files changed

+33
-21
lines changed

.github/workflows/main_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878

7979
- name: Set up and run contract tests with pytest
8080
run: |
81-
bash contract-tests/set-up-contract-tests.sh
81+
bash scripts/set-up-contract-tests.sh
8282
pip install pytest
8383
pytest contract-tests/tests
8484

.github/workflows/pr_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939

4040
- name: Set up and run contract tests with pytest
4141
run: |
42-
bash contract-tests/set-up-contract-tests.sh
42+
bash scripts/set-up-contract-tests.sh
4343
pip install pytest
4444
pytest contract-tests/tests
4545

CONTRIBUTING.md

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,10 @@ documentation, we greatly value feedback and contributions from our community.
66
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
77
information to effectively respond to your bug report or contribution.
88

9-
## Build a Wheel file locally
10-
**First time setup**
9+
## Build and install distro locally
10+
From `aws-otel-python-instrumentation` dir, execute:
1111
```sh
12-
pip install --upgrade pip setuptools wheel packaging build
13-
mkdir -p ./dist
14-
```
15-
**Updating the wheel file**
16-
```sh
17-
rm -rf ./dist/*
18-
cd ./aws-opentelemetry-distro
19-
python3 -m build --outdir ../dist
20-
cd ../dist
21-
pkg_version=$(grep '__version__' ../aws-opentelemetry-distro/src/amazon/opentelemetry/distro/version.py | awk -F '"' '{print $2}')
22-
pip install aws_opentelemetry_distro-${pkg_version}-py3-none-any.whl --force-reinstall
23-
cd ..
12+
./scripts/build_and_install_distro.sh
2413
```
2514

2615
## Test a sample App

contract-tests/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ The steps to add a new test for a library or framework are:
3232

3333
Pre-requirements:
3434
* Have `docker` installed and running - verify by running the `docker` command.
35-
* Ensure the `aws_opentelemetry_distro` wheel file exists in to `aws-otel-python-instrumentation/dist` folder
3635

37-
From `aws-otel-python-instrumentation` dir, execute:
38-
39-
```
40-
./contract-tests/set-up-contract-tests.sh
36+
Steps:
37+
* From `aws-otel-python-instrumentation` dir, execute:
38+
```sh
39+
./scripts/build_and_install_distro.sh
40+
./scripts/set-up-contract-tests.sh
4141
pytest contract-tests/tests
4242
```

scripts/build_and_install_distro.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
# Check script is running in contract-tests
3+
current_path=`pwd`
4+
current_dir="${current_path##*/}"
5+
if [ "$current_dir" != "aws-otel-python-instrumentation" ]; then
6+
echo "Please run from aws-otel-python-instrumentation dir"
7+
exit
8+
fi
9+
10+
# Setup - update dependencies and create/empty dist dir
11+
pip install --upgrade pip setuptools wheel packaging build
12+
mkdir dist
13+
rm -rf dist/aws_opentelemetry_distro*
14+
15+
# Build distro
16+
cd aws-opentelemetry-distro
17+
python3 -m build --outdir ../dist
18+
19+
# Install distro
20+
cd ../dist
21+
DISTRO=(aws_opentelemetry_distro-*-py3-none-any.whl)
22+
pip install $DISTRO --force-reinstall
23+
cd ..

0 commit comments

Comments
 (0)