Skip to content

Commit

Permalink
Add Contrib Repo Tests workflow on Core PRs (open-telemetry#1357)
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanielRN authored Nov 19, 2020
1 parent c60aa69 commit b5c766a
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 10 deletions.
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

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
- 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
- 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"]
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 }}
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
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

; 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

0 comments on commit b5c766a

Please sign in to comment.