Skip to content

Commit

Permalink
Upgrade tox (#3624)
Browse files Browse the repository at this point in the history
* Upgrade tox

* Remove tox-factor

* Bump tox cache

* Remove exporter-jaeger from matrix

These tests were removed in 2a8d4ed,
but tox-factor just ignored the problem, but tox 4 fails because the env
does not exist.

* Ignore py37 getting-started

The py37 env was removed in 4a2cb86
and now tox 4 fails instead of ignore it like tox-factor.

* Ignore pypy3 for some packages

* Github actions exclude does not accept arrays

* Contrib tests still running on tox 3

* Revert "Contrib tests still running on tox 3"

This reverts commit fdcd75d.

* Update contrib SHA

* Remove excludes

* Revert "Remove excludes"

This reverts commit 1cf7b42.

* WIP

* More WIP

---------

Co-authored-by: Diego Hurtado <[email protected]>
  • Loading branch information
iurisilvio and ocelotl authored Feb 14, 2024
1 parent 12f4490 commit 55bf100
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
python-version: ${{ env[matrix.python-version] }}
architecture: 'x64'
- name: Install tox
run: pip install tox==3.27.1 -U tox-factor
run: pip install tox
- name: Cache tox environment
# Preserves .tox directory between runs for faster installs
uses: actions/cache@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/public-api-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
python-version: '3.10'

- name: Install tox
run: pip install tox==3.27.1 -U tox-factor
run: pip install tox

- name: Public API Check
run: tox -e public-symbols-check
27 changes: 17 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: d167ef7b43941a74378d625fea74628dd7572efa
CONTRIB_REPO_SHA: 1a984d3ba18d4080c58485b7d807dba241179d41
# This is needed because we do not clone the core repo in contrib builds anymore.
# When running contrib builds as part of core builds, we use actions/checkout@v2 which
# does not set an environment variable (simply just runs tox), which is different when
Expand Down Expand Up @@ -42,9 +42,6 @@ jobs:
- "getting-started"
- "opentracing-shim"
- "opencensus-shim"
- "exporter-jaeger-combined"
- "exporter-jaeger-proto-grpc"
- "exporter-jaeger-thrift"
- "exporter-opencensus"
- "exporter-otlp-proto-common"
- "exporter-otlp-combined"
Expand All @@ -58,6 +55,16 @@ jobs:
- "propagator-b3"
- "propagator-jaeger"
os: [ubuntu-20.04, windows-2019]
exclude:
- python-version: pypy3
package: "opencensus-shim"
- python-version: pypy3
package: "exporter-opencensus"
- python-version: pypy3
package: "exporter-otlp-combined"
- python-version: pypy3
package: "exporter-otlp-proto-grpc"

steps:
- name: Checkout Core Repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v2
Expand All @@ -67,15 +74,15 @@ jobs:
python-version: ${{ env[matrix.python-version] }}
architecture: 'x64'
- name: Install tox
run: pip install tox==3.27.1 -U tox-factor
run: pip install tox
- name: Cache tox environment
# Preserves .tox directory between runs for faster installs
uses: actions/cache@v2
with:
path: |
.tox
~/.cache/pip
key: v3-tox-cache-${{ env.RUN_MATRIX_COMBINATION }}-${{ hashFiles('tox.ini',
key: v4-tox-cache-${{ env.RUN_MATRIX_COMBINATION }}-${{ hashFiles('tox.ini',
'dev-requirements.txt') }}-core
- name: Windows does not let git check out files with long names
if: ${{ matrix.os == 'windows-2019'}}
Expand All @@ -100,15 +107,15 @@ jobs:
python-version: '3.10'
architecture: 'x64'
- name: Install tox
run: pip install tox==3.27.1
run: pip install tox
- name: Cache tox environment
# Preserves .tox directory between runs for faster installs
uses: actions/cache@v2
with:
path: |
.tox
~/.cache/pip
key: v3-tox-cache-${{ matrix.tox-environment }}-${{ hashFiles('tox.ini', 'dev-requirements.txt')
key: v4-tox-cache-${{ matrix.tox-environment }}-${{ hashFiles('tox.ini', 'dev-requirements.txt')
}}-core
- name: run tox
run: tox -e ${{ matrix.tox-environment }}
Expand Down Expand Up @@ -169,7 +176,7 @@ jobs:
- "tornado"
- "tortoiseorm"
- "urllib"
- "urllib3"
- "urllib3v"
- "wsgi"
- "prometheus-remote-write"
- "richconsole"
Expand All @@ -191,7 +198,7 @@ jobs:
python-version: ${{ env[matrix.python-version] }}
architecture: 'x64'
- name: Install tox
run: pip install tox==3.27.1 -U tox-factor
run: pip install tox
- name: Cache tox environment
# Preserves .tox directory between runs for faster installs
uses: actions/cache@v2
Expand Down
6 changes: 2 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,12 @@ during their normal contribution hours.

This project uses [tox](https://tox.readthedocs.io) to automate
some aspects of development, including testing against multiple Python versions.
To install `tox`, run[^1]:
To install `tox`, run:

```console
$ pip install tox==3.27.1
$ pip install tox
```

[^1]: Right now we are experiencing issues with `tox==4.x.y`, so we recommend you use this version.

You can run `tox` with the following arguments:

- `tox` to run all existing tox commands, including unit tests for all packages
Expand Down
27 changes: 16 additions & 11 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ envlist =

; docs/getting-started
py3{8,9,10,11}-opentelemetry-getting-started
pypy3-opentelemetry-getting-started

py3{8,9,10,11}-opentelemetry-opentracing-shim
pypy3-opentelemetry-opentracing-shim
Expand All @@ -31,6 +32,7 @@ envlist =
; exporter-opencensus intentionally excluded from pypy3

py3{8,9,10,11}-proto{3,4}-opentelemetry-exporter-otlp-proto-common
pypy3-proto{3,4}-opentelemetry-exporter-otlp-proto-common

; opentelemetry-exporter-otlp
py3{8,9,10,11}-opentelemetry-exporter-otlp-combined
Expand Down Expand Up @@ -90,8 +92,8 @@ deps =
setenv =
; override CONTRIB_REPO_SHA via env variable when testing other branches/commits than main
; i.e: CONTRIB_REPO_SHA=dde62cebffe519c35875af6d06fae053b3be65ec tox -e <env to test>
CONTRIB_REPO_SHA={env:CONTRIB_REPO_SHA:"main"}
CONTRIB_REPO="git+https://github.com/open-telemetry/opentelemetry-python-contrib.git@{env:CONTRIB_REPO_SHA}"
CONTRIB_REPO_SHA={env:CONTRIB_REPO_SHA:main}
CONTRIB_REPO=git+https://github.com/open-telemetry/opentelemetry-python-contrib.git@{env:CONTRIB_REPO_SHA}
mypy: MYPYPATH={toxinidir}/opentelemetry-api/src/:{toxinidir}/tests/opentelemetry-test-utils/src/

changedir =
Expand Down Expand Up @@ -127,11 +129,11 @@ commands_pre =
protobuf: pip install {toxinidir}/opentelemetry-proto

getting-started: pip install -r requirements.txt
getting-started: pip install -e "{env:CONTRIB_REPO}#egg=opentelemetry-util-http&subdirectory=util/opentelemetry-util-http"
getting-started: pip install -e "{env:CONTRIB_REPO}#egg=opentelemetry-instrumentation&subdirectory=opentelemetry-instrumentation"
getting-started: pip install -e "{env:CONTRIB_REPO}#egg=opentelemetry-instrumentation-requests&subdirectory=instrumentation/opentelemetry-instrumentation-requests"
getting-started: pip install -e "{env:CONTRIB_REPO}#egg=opentelemetry-instrumentation-wsgi&subdirectory=instrumentation/opentelemetry-instrumentation-wsgi"
getting-started: pip install -e "{env:CONTRIB_REPO}#egg=opentelemetry-instrumentation-flask&subdirectory=instrumentation/opentelemetry-instrumentation-flask"
getting-started: pip install -e {env:CONTRIB_REPO}\#egg=opentelemetry-util-http&subdirectory=util/opentelemetry-util-http
getting-started: pip install -e {env:CONTRIB_REPO}\#egg=opentelemetry-instrumentation&subdirectory=opentelemetry-instrumentation
getting-started: pip install -e {env:CONTRIB_REPO}\#egg=opentelemetry-instrumentation-requests&subdirectory=instrumentation/opentelemetry-instrumentation-requests
getting-started: pip install -e {env:CONTRIB_REPO}\#egg=opentelemetry-instrumentation-wsgi&subdirectory=instrumentation/opentelemetry-instrumentation-wsgi
getting-started: pip install -e {env:CONTRIB_REPO}\#egg=opentelemetry-instrumentation-flask&subdirectory=instrumentation/opentelemetry-instrumentation-flask

opencensus: pip install {toxinidir}/exporter/opentelemetry-exporter-opencensus

Expand Down Expand Up @@ -255,14 +257,17 @@ deps =
requests~=2.7
markupsafe~=2.1

allowlist_externals =
{toxinidir}/scripts/tracecontext-integration-test.sh

commands_pre =
pip install -e {toxinidir}/opentelemetry-api \
-e {toxinidir}/opentelemetry-semantic-conventions \
-e {toxinidir}/opentelemetry-sdk \
-e "{env:CONTRIB_REPO}#egg=opentelemetry-util-http&subdirectory=util/opentelemetry-util-http" \
-e "{env:CONTRIB_REPO}#egg=opentelemetry-instrumentation&subdirectory=opentelemetry-instrumentation" \
-e "{env:CONTRIB_REPO}#egg=opentelemetry-instrumentation-requests&subdirectory=instrumentation/opentelemetry-instrumentation-requests" \
-e "{env:CONTRIB_REPO}#egg=opentelemetry-instrumentation-wsgi&subdirectory=instrumentation/opentelemetry-instrumentation-wsgi"
-e {env:CONTRIB_REPO}\#egg=opentelemetry-util-http&subdirectory=util/opentelemetry-util-http \
-e {env:CONTRIB_REPO}\#egg=opentelemetry-instrumentation&subdirectory=opentelemetry-instrumentation \
-e {env:CONTRIB_REPO}\#egg=opentelemetry-instrumentation-requests&subdirectory=instrumentation/opentelemetry-instrumentation-requests \
-e {env:CONTRIB_REPO}\#egg=opentelemetry-instrumentation-wsgi&subdirectory=instrumentation/opentelemetry-instrumentation-wsgi

commands =
{toxinidir}/scripts/tracecontext-integration-test.sh
Expand Down

0 comments on commit 55bf100

Please sign in to comment.