From 75020add1e825f1c1974cddedad07f7054edd067 Mon Sep 17 00:00:00 2001 From: Nathaniel Ruiz Nowell Date: Wed, 4 Nov 2020 11:19:37 -0800 Subject: [PATCH 01/11] Add Contrib Repo Tests workflow on Core PRs --- .github/workflows/test.yml | 93 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 89 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2d21961ee5e..49cf2eda34a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Test +name: Core Repo Tests on: push: @@ -6,7 +6,11 @@ on: - 'release/*' pull_request: env: - CONTRIB_REPO_SHA: 5c9e043d6921550d82668788e3758a733fb11cb8 + # Set variable to 'master' if your change will not affect Contrib. + # Otherwise, set variable to the commit of your branch on + # opentelemetry-python-contrib which is compatible with these Core repo + # changes. + CONTRIB_REPO_SHA: 9398616add7071085a9a8448899a7de178b84bbf jobs: build: @@ -62,7 +66,7 @@ jobs: uses: actions/cache@v2 with: path: .tox - key: tox-cache-${{ matrix.python-version }}-${{ matrix.package }}-${{ matrix.os }}-${{ hashFiles('tox.ini', 'dev-requirements.txt') }} + key: tox-cache-${{ matrix.python-version }}-${{ matrix.package }}-${{ matrix.os }}-${{ hashFiles('tox.ini', 'dev-requirements.txt') }}-core - name: run tox run: tox -f ${{ matrix.python-version }}-${{ matrix.package }} misc: @@ -92,6 +96,87 @@ jobs: uses: actions/cache@v2 with: path: .tox - key: tox-cache-${{ matrix.tox-environment }}-${{ hashFiles('tox.ini', 'dev-requirements.txt') }} + key: tox-cache-${{ matrix.tox-environment }}-${{ hashFiles('tox.ini', 'dev-requirements.txt') }}-core + - name: run tox + run: tox -e ${{ matrix.tox-environment }} + contrib-build: + env: + # We use these variables to convert between tox and GHA version literals + py35: 3.5 + py36: 3.6 + py37: 3.7 + py38: 3.8 + pypy3: pypy3 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false # ensures the entire test matrix is run, even if one permutation fails + matrix: + python-version: [ py35, py36, py37, py38, pypy3 ] + package: ["instrumentation", "exporter"] + os: [ ubuntu-latest ] + include: + # py35-instrumentation segfaults on 18.04 so we instead run on 20.04 + - python-version: py35 + package: instrumentation + os: ubuntu-20.04 + exclude: + - os: ubuntu-latest + python-version: py35 + package: instrumentation + steps: + - name: Checkout Contrib Repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v2 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + - name: Checkout Core Repo @ SHA ${{ github.sha }} + uses: actions/checkout@v2 + with: + repository: open-telemetry/opentelemetry-python + path: opentelemetry-python-core + - name: Set up Python ${{ env[matrix.python-version] }} + uses: actions/setup-python@v2 + with: + python-version: ${{ env[matrix.python-version] }} + - name: Install tox + run: pip install -U tox-factor + - name: Cache tox environment + # Preserves .tox directory between runs for faster installs + uses: actions/cache@v2 + with: + path: .tox + key: tox-cache-${{ matrix.python-version }}-${{ matrix.package }}-${{ matrix.os }}-${{ hashFiles('tox.ini', 'dev-requirements.txt') }}-contrib + - name: run tox + run: tox -f ${{ matrix.python-version }}-${{ matrix.package }} + contrib-misc: + strategy: + fail-fast: false + matrix: + tox-environment: [ "docker-tests", "lint" ] + name: ${{ matrix.tox-environment }} + runs-on: ubuntu-latest + steps: + - name: Checkout Contrib Repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v2 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + - name: Checkout Core Repo @ SHA ${{ github.sha }} + uses: actions/checkout@v2 + with: + repository: open-telemetry/opentelemetry-python + path: opentelemetry-python-core + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install tox + run: pip install -U tox + - name: Cache tox environment + # Preserves .tox directory between runs for faster installs + uses: actions/cache@v2 + with: + path: .tox + key: tox-cache-${{ matrix.tox-environment }}-${{ hashFiles('tox.ini', 'dev-requirements.txt') }}-contrib - name: run tox run: tox -e ${{ matrix.tox-environment }} From 0786b9b9b57b8b41d4933b34e2f06f09e3a1941f Mon Sep 17 00:00:00 2001 From: Nathaniel Ruiz Nowell Date: Wed, 4 Nov 2020 11:23:47 -0800 Subject: [PATCH 02/11] Dont check lint for Contrib in Core --- .github/workflows/test.yml | 2 +- eachdist.ini | 4 ---- tox.ini | 4 +++- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 49cf2eda34a..f561d4cf271 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -152,7 +152,7 @@ jobs: strategy: fail-fast: false matrix: - tox-environment: [ "docker-tests", "lint" ] + tox-environment: [ "docker-tests"] name: ${{ matrix.tox-environment }} runs-on: ubuntu-latest steps: diff --git a/eachdist.ini b/eachdist.ini index 1b809374ad9..9cef826d205 100644 --- a/eachdist.ini +++ b/eachdist.ini @@ -10,10 +10,6 @@ sortfirst= opentelemetry-instrumentation opentelemetry-proto tests/util - instrumentation/opentelemetry-instrumentation-wsgi - instrumentation/opentelemetry-instrumentation-dbapi - instrumentation/opentelemetry-instrumentation-asgi - instrumentation/opentelemetry-instrumentation-botocore instrumentation/* exporter/* ext/* diff --git a/tox.ini b/tox.ini index 67790b2be8c..ce725294ef0 100644 --- a/tox.ini +++ b/tox.ini @@ -135,8 +135,10 @@ commands = basepython: python3.8 recreate = True deps = - -e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-grpc + -e {toxinidir}/opentelemetry-api + -e {toxinidir}/opentelemetry-sdk -c dev-requirements.txt + -e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-grpc asgiref pylint flake8 From 64ca5736fdfff0a0b7d69d3d0c99f7c547bae82d Mon Sep 17 00:00:00 2001 From: Nathaniel Ruiz Nowell Date: Fri, 6 Nov 2020 13:14:18 -0800 Subject: [PATCH 03/11] Set to master now that Contrib tests are fixed --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f561d4cf271..b54c1841a1a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ env: # Otherwise, set variable to the commit of your branch on # opentelemetry-python-contrib which is compatible with these Core repo # changes. - CONTRIB_REPO_SHA: 9398616add7071085a9a8448899a7de178b84bbf + CONTRIB_REPO_SHA: master jobs: build: From 2cd668a892a024fe65c53d72607412c61632be1d Mon Sep 17 00:00:00 2001 From: Nathaniel Ruiz Nowell Date: Fri, 6 Nov 2020 13:23:46 -0800 Subject: [PATCH 04/11] Move local deps for docs to commands pre --- tox.ini | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tox.ini b/tox.ini index ce725294ef0..8ab299849a2 100644 --- a/tox.ini +++ b/tox.ini @@ -159,6 +159,10 @@ deps = -c {toxinidir}/dev-requirements.txt -r {toxinidir}/docs-requirements.txt +commands_pre = + pip install -e {toxinidir}/opentelemetry-api \ + -e {toxinidir}/opentelemetry-sdk + changedir = docs commands = From 7942325a0f09efaa2e865af691703af8c7770645 Mon Sep 17 00:00:00 2001 From: Nathaniel Ruiz Nowell Date: Fri, 6 Nov 2020 13:36:58 -0800 Subject: [PATCH 05/11] Move ordered deps into commands pre --- tox.ini | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 8ab299849a2..423a90d3c2b 100644 --- a/tox.ini +++ b/tox.ini @@ -160,8 +160,12 @@ deps = -r {toxinidir}/docs-requirements.txt commands_pre = - pip install -e {toxinidir}/opentelemetry-api \ - -e {toxinidir}/opentelemetry-sdk + pip install -e {toxinidir}/opentelemetry-api \ + -e {toxinidir}/opentelemetry-sdk \ + -e {toxinidir}/opentelemetry-instrumentation \ + -e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-requests \ + -e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-wsgi \ + -e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-flask changedir = docs From 3df1c7173bbd4ceb5a78c8e5a493257378c47574 Mon Sep 17 00:00:00 2001 From: Nathaniel Ruiz Nowell Date: Fri, 6 Nov 2020 13:48:09 -0800 Subject: [PATCH 06/11] Move all deps to commands pre --- tox.ini | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 423a90d3c2b..0d545e1421d 100644 --- a/tox.ini +++ b/tox.ini @@ -160,11 +160,13 @@ deps = -r {toxinidir}/docs-requirements.txt commands_pre = - pip install -e {toxinidir}/opentelemetry-api \ - -e {toxinidir}/opentelemetry-sdk \ + pip install -e {toxinidir}/tests/util \ + -e {toxinidir}/opentelemetry-python-contrib/exporter/opentelemetry-exporter-datadog \ + -e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-grpc \ -e {toxinidir}/opentelemetry-instrumentation \ -e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-requests \ -e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-wsgi \ + -e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-django \ -e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-flask changedir = docs From a9a51e04e045c6987aff952f9878046c6c952df8 Mon Sep 17 00:00:00 2001 From: Nathaniel Ruiz Nowell Date: Fri, 6 Nov 2020 14:11:48 -0800 Subject: [PATCH 07/11] Remove tests util pkg as dep to docs test --- tox.ini | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 0d545e1421d..d90f1dab1a1 100644 --- a/tox.ini +++ b/tox.ini @@ -160,8 +160,7 @@ deps = -r {toxinidir}/docs-requirements.txt commands_pre = - pip install -e {toxinidir}/tests/util \ - -e {toxinidir}/opentelemetry-python-contrib/exporter/opentelemetry-exporter-datadog \ + pip install -e {toxinidir}/opentelemetry-python-contrib/exporter/opentelemetry-exporter-datadog \ -e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-grpc \ -e {toxinidir}/opentelemetry-instrumentation \ -e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-requests \ From 5b9a88335403981d6a03aa365aaa77c45ce11330 Mon Sep 17 00:00:00 2001 From: Nathaniel Ruiz Nowell Date: Tue, 10 Nov 2020 19:40:07 -0800 Subject: [PATCH 08/11] Add a point regarding cloning contrib repo --- CONTRIBUTING.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1cc74de3955..4981eb5547f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,6 +42,10 @@ To quickly get up and running, you can use the `scripts/eachdist.py` tool that ships with this project. First create a virtualenv and activate it. Then run `python scripts/eachdist.py develop` to install all required packages as well as the project's packages themselves (in `--editable` mode). + +Further, you'll want to clone the Contrib repo locally to resolve paths needed +to run tests. `git clone git@github.com:open-telemetry/opentelemetry-python-contrib.git opentelemetry-python-contrib`. + You can then run `scripts/eachdist.py test` to test everything or `scripts/eachdist.py lint` to lint everything (fixing anything that is auto-fixable). From 976a50fde2c27cf6a5db24964e39275e79bc2892 Mon Sep 17 00:00:00 2001 From: Nathaniel Ruiz Nowell Date: Wed, 18 Nov 2020 11:19:54 -0800 Subject: [PATCH 09/11] Simplify lint tox command --- docs/examples/opentelemetry-example-app/setup.cfg | 1 + tox.ini | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/examples/opentelemetry-example-app/setup.cfg b/docs/examples/opentelemetry-example-app/setup.cfg index b8b981d3582..87753ea7202 100644 --- a/docs/examples/opentelemetry-example-app/setup.cfg +++ b/docs/examples/opentelemetry-example-app/setup.cfg @@ -45,6 +45,7 @@ install_requires = opentelemetry-sdk == 0.16.dev0 opentelemetry-instrumentation-requests == 0.15.b0 opentelemetry-instrumentation-flask == 0.15.b0 + opentelemetry-instrumentation-grpc == 0.15.b0 flask requests protobuf>=3.13.0 diff --git a/tox.ini b/tox.ini index d90f1dab1a1..7e4611bb40a 100644 --- a/tox.ini +++ b/tox.ini @@ -135,10 +135,7 @@ commands = basepython: python3.8 recreate = True deps = - -e {toxinidir}/opentelemetry-api - -e {toxinidir}/opentelemetry-sdk -c dev-requirements.txt - -e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-grpc asgiref pylint flake8 From fb841b79219a27b673779a623dc76ab23ccfd5bf Mon Sep 17 00:00:00 2001 From: Nathaniel Ruiz Nowell Date: Wed, 18 Nov 2020 14:17:14 -0800 Subject: [PATCH 10/11] Add docs requirements to docs txt file --- tox.ini | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tox.ini b/tox.ini index 7e4611bb40a..545d61a28e6 100644 --- a/tox.ini +++ b/tox.ini @@ -156,15 +156,6 @@ deps = -c {toxinidir}/dev-requirements.txt -r {toxinidir}/docs-requirements.txt -commands_pre = - pip install -e {toxinidir}/opentelemetry-python-contrib/exporter/opentelemetry-exporter-datadog \ - -e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-grpc \ - -e {toxinidir}/opentelemetry-instrumentation \ - -e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-requests \ - -e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-wsgi \ - -e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-django \ - -e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-flask - changedir = docs commands = From dd7ba786fed2c058f83af438175816da3baab9d5 Mon Sep 17 00:00:00 2001 From: Nathaniel Ruiz Nowell Date: Thu, 19 Nov 2020 12:15:48 -0800 Subject: [PATCH 11/11] Do not test example app on pypy3 because no grpcio --- tox.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/tox.ini b/tox.ini index 545d61a28e6..a42174f3574 100644 --- a/tox.ini +++ b/tox.ini @@ -26,7 +26,6 @@ envlist = ; opentelemetry-example-app py3{5,6,7,8}-test-core-example-app - pypy3-test-core-example-app ; opentelemetry-exporter-jaeger py3{5,6,7,8}-test-exporter-jaeger