Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Contrib Repo Tests workflow on Core PRs #1357

Merged
93 changes: 89 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
name: Test
name: Core Repo Tests

on:
push:
branches-ignore:
- '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: master
NathanielRN marked this conversation as resolved.
Show resolved Hide resolved

jobs:
build:
Expand Down Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is needed...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good, should keep the caches smaller

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not too familiar with the syntax, what is this pointing to? The environment name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I run tox locally, I see a .tox folder gets created, and I see packages being created there.

My guess is that this command caches packages that have the same conditions of python version/matrix/os/files_hash to not have to import the package into it's "tox" environment again. But that's just a guess.

- name: run tox
run: tox -f ${{ matrix.python-version }}-${{ matrix.package }}
misc:
Expand Down Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is needed...

- 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
aabmass marked this conversation as resolved.
Show resolved Hide resolved
- 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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is needed...

- name: run tox
run: tox -f ${{ matrix.python-version }}-${{ matrix.package }}
contrib-misc:
strategy:
fail-fast: false
matrix:
tox-environment: [ "docker-tests"]
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is needed...

- name: run tox
run: tox -e ${{ matrix.tox-environment }}
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
NathanielRN marked this conversation as resolved.
Show resolved Hide resolved
to run tests. `git clone [email protected]: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).

Expand Down
1 change: 1 addition & 0 deletions docs/examples/opentelemetry-example-app/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions eachdist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
Expand Down
2 changes: 0 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ envlist =

; opentelemetry-example-app
py3{5,6,7,8}-test-core-example-app
pypy3-test-core-example-app
Copy link
Contributor Author

@NathanielRN NathanielRN Nov 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note the removal of tests for the Example App on pypy3. The Example App uses grpcio which is not available on pypy packages.


; opentelemetry-exporter-jaeger
py3{5,6,7,8}-test-exporter-jaeger
Expand Down Expand Up @@ -135,7 +134,6 @@ commands =
basepython: python3.8
recreate = True
deps =
-e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-grpc
-c dev-requirements.txt
asgiref
pylint
Expand Down