Skip to content

Commit b5c766a

Browse files
authored
Add Contrib Repo Tests workflow on Core PRs (open-telemetry#1357)
1 parent c60aa69 commit b5c766a

File tree

5 files changed

+94
-10
lines changed

5 files changed

+94
-10
lines changed

.github/workflows/test.yml

Lines changed: 89 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
name: Test
1+
name: Core Repo Tests
22

33
on:
44
push:
55
branches-ignore:
66
- 'release/*'
77
pull_request:
88
env:
9-
CONTRIB_REPO_SHA: 5c9e043d6921550d82668788e3758a733fb11cb8
9+
# Set variable to 'master' if your change will not affect Contrib.
10+
# Otherwise, set variable to the commit of your branch on
11+
# opentelemetry-python-contrib which is compatible with these Core repo
12+
# changes.
13+
CONTRIB_REPO_SHA: master
1014

1115
jobs:
1216
build:
@@ -62,7 +66,7 @@ jobs:
6266
uses: actions/cache@v2
6367
with:
6468
path: .tox
65-
key: tox-cache-${{ matrix.python-version }}-${{ matrix.package }}-${{ matrix.os }}-${{ hashFiles('tox.ini', 'dev-requirements.txt') }}
69+
key: tox-cache-${{ matrix.python-version }}-${{ matrix.package }}-${{ matrix.os }}-${{ hashFiles('tox.ini', 'dev-requirements.txt') }}-core
6670
- name: run tox
6771
run: tox -f ${{ matrix.python-version }}-${{ matrix.package }}
6872
misc:
@@ -92,6 +96,87 @@ jobs:
9296
uses: actions/cache@v2
9397
with:
9498
path: .tox
95-
key: tox-cache-${{ matrix.tox-environment }}-${{ hashFiles('tox.ini', 'dev-requirements.txt') }}
99+
key: tox-cache-${{ matrix.tox-environment }}-${{ hashFiles('tox.ini', 'dev-requirements.txt') }}-core
100+
- name: run tox
101+
run: tox -e ${{ matrix.tox-environment }}
102+
contrib-build:
103+
env:
104+
# We use these variables to convert between tox and GHA version literals
105+
py35: 3.5
106+
py36: 3.6
107+
py37: 3.7
108+
py38: 3.8
109+
pypy3: pypy3
110+
runs-on: ${{ matrix.os }}
111+
strategy:
112+
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
113+
matrix:
114+
python-version: [ py35, py36, py37, py38, pypy3 ]
115+
package: ["instrumentation", "exporter"]
116+
os: [ ubuntu-latest ]
117+
include:
118+
# py35-instrumentation segfaults on 18.04 so we instead run on 20.04
119+
- python-version: py35
120+
package: instrumentation
121+
os: ubuntu-20.04
122+
exclude:
123+
- os: ubuntu-latest
124+
python-version: py35
125+
package: instrumentation
126+
steps:
127+
- name: Checkout Contrib Repo @ SHA - ${{ env.CONTRIB_REPO_SHA }}
128+
uses: actions/checkout@v2
129+
with:
130+
repository: open-telemetry/opentelemetry-python-contrib
131+
ref: ${{ env.CONTRIB_REPO_SHA }}
132+
- name: Checkout Core Repo @ SHA ${{ github.sha }}
133+
uses: actions/checkout@v2
134+
with:
135+
repository: open-telemetry/opentelemetry-python
136+
path: opentelemetry-python-core
137+
- name: Set up Python ${{ env[matrix.python-version] }}
138+
uses: actions/setup-python@v2
139+
with:
140+
python-version: ${{ env[matrix.python-version] }}
141+
- name: Install tox
142+
run: pip install -U tox-factor
143+
- name: Cache tox environment
144+
# Preserves .tox directory between runs for faster installs
145+
uses: actions/cache@v2
146+
with:
147+
path: .tox
148+
key: tox-cache-${{ matrix.python-version }}-${{ matrix.package }}-${{ matrix.os }}-${{ hashFiles('tox.ini', 'dev-requirements.txt') }}-contrib
149+
- name: run tox
150+
run: tox -f ${{ matrix.python-version }}-${{ matrix.package }}
151+
contrib-misc:
152+
strategy:
153+
fail-fast: false
154+
matrix:
155+
tox-environment: [ "docker-tests"]
156+
name: ${{ matrix.tox-environment }}
157+
runs-on: ubuntu-latest
158+
steps:
159+
- name: Checkout Contrib Repo @ SHA - ${{ env.CONTRIB_REPO_SHA }}
160+
uses: actions/checkout@v2
161+
with:
162+
repository: open-telemetry/opentelemetry-python-contrib
163+
ref: ${{ env.CONTRIB_REPO_SHA }}
164+
- name: Checkout Core Repo @ SHA ${{ github.sha }}
165+
uses: actions/checkout@v2
166+
with:
167+
repository: open-telemetry/opentelemetry-python
168+
path: opentelemetry-python-core
169+
- name: Set up Python 3.8
170+
uses: actions/setup-python@v2
171+
with:
172+
python-version: 3.8
173+
- name: Install tox
174+
run: pip install -U tox
175+
- name: Cache tox environment
176+
# Preserves .tox directory between runs for faster installs
177+
uses: actions/cache@v2
178+
with:
179+
path: .tox
180+
key: tox-cache-${{ matrix.tox-environment }}-${{ hashFiles('tox.ini', 'dev-requirements.txt') }}-contrib
96181
- name: run tox
97182
run: tox -e ${{ matrix.tox-environment }}

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ To quickly get up and running, you can use the `scripts/eachdist.py` tool that
4242
ships with this project. First create a virtualenv and activate it.
4343
Then run `python scripts/eachdist.py develop` to install all required packages
4444
as well as the project's packages themselves (in `--editable` mode).
45+
46+
Further, you'll want to clone the Contrib repo locally to resolve paths needed
47+
to run tests. `git clone git@github.com:open-telemetry/opentelemetry-python-contrib.git opentelemetry-python-contrib`.
48+
4549
You can then run `scripts/eachdist.py test` to test everything or
4650
`scripts/eachdist.py lint` to lint everything (fixing anything that is auto-fixable).
4751

docs/examples/opentelemetry-example-app/setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ install_requires =
4545
opentelemetry-sdk == 0.16.dev0
4646
opentelemetry-instrumentation-requests == 0.15.b0
4747
opentelemetry-instrumentation-flask == 0.15.b0
48+
opentelemetry-instrumentation-grpc == 0.15.b0
4849
flask
4950
requests
5051
protobuf>=3.13.0

eachdist.ini

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ sortfirst=
1010
opentelemetry-instrumentation
1111
opentelemetry-proto
1212
tests/util
13-
instrumentation/opentelemetry-instrumentation-wsgi
14-
instrumentation/opentelemetry-instrumentation-dbapi
15-
instrumentation/opentelemetry-instrumentation-asgi
16-
instrumentation/opentelemetry-instrumentation-botocore
1713
instrumentation/*
1814
exporter/*
1915
ext/*

tox.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ envlist =
2626

2727
; opentelemetry-example-app
2828
py3{5,6,7,8}-test-core-example-app
29-
pypy3-test-core-example-app
3029

3130
; opentelemetry-exporter-jaeger
3231
py3{5,6,7,8}-test-exporter-jaeger
@@ -135,7 +134,6 @@ commands =
135134
basepython: python3.8
136135
recreate = True
137136
deps =
138-
-e {toxinidir}/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-grpc
139137
-c dev-requirements.txt
140138
asgiref
141139
pylint

0 commit comments

Comments
 (0)