forked from open-telemetry/opentelemetry-python-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (105 loc) · 4.36 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Contrib Repo Tests
on:
push:
branches-ignore:
- 'release/*'
pull_request:
env:
CORE_REPO_SHA: 3b236f5309c36d089c0d9dc6dc6c985bb1668776
jobs:
build:
env:
# We use these variables to convert between tox and GHA version literals
py36: 3.6
py37: 3.7
py38: 3.8
py39: 3.9
pypy3: pypy3
RUN_MATRIX_COMBINATION: ${{ matrix.python-version }}-${{ matrix.package }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
matrix:
python-version: [ py36, py37, py38, py39, pypy3 ]
package: ["instrumentation", "exporter", "sdkextension", "propagator"]
os: [ ubuntu-latest ]
steps:
- name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v2
- name: Checkout Core Repo @ SHA - ${{ env.CORE_REPO_SHA }}
uses: actions/checkout@v2
with:
repository: open-telemetry/opentelemetry-python
ref: ${{ env.CORE_REPO_SHA }}
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: v2-build-tox-cache-${{ env.RUN_MATRIX_COMBINATION }}-${{ hashFiles('tox.ini', 'gen-requirements.txt', 'dev-requirements.txt') }}
- name: run tox
run: tox -f ${{ matrix.python-version }}-${{ matrix.package }} -- --benchmark-json=${{ env.RUN_MATRIX_COMBINATION }}-benchmark.json
- name: Find and merge benchmarks
# TODO: Add at least one benchmark to every package type to remove this (#249)
if: matrix.package == 'sdkextension'
run: >-
jq -s '.[0].benchmarks = ([.[].benchmarks] | add)
| if .[0].benchmarks == null then null else .[0] end'
**/**/tests/*${{ matrix.package }}*-benchmark.json > output.json
- name: Report on benchmark results
# TODO: Add at least one benchmark to every package type to remove this (#249)
if: matrix.package == 'sdkextension'
uses: rhysd/github-action-benchmark@v1
with:
name: OpenTelemetry Python Benchmarks - Python ${{ env[matrix.python-version ]}} - ${{ matrix.package }}
tool: pytest
output-file-path: output.json
github-token: ${{ secrets.GITHUB_TOKEN }}
max-items-in-chart: 100
# Alert with a commit comment on possible performance regression
alert-threshold: 200%
fail-on-alert: true
# Make a commit on `gh-pages` with benchmarks from previous step
auto-push: ${{ github.ref == 'refs/heads/main' }}
gh-pages-branch: gh-pages
benchmark-data-dir-path: benchmarks
misc:
strategy:
fail-fast: false
matrix:
tox-environment: [ "docker-tests", "lint", "docs", "generate" ]
name: ${{ matrix.tox-environment }}
runs-on: ubuntu-latest
steps:
- name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v2
- name: Checkout Core Repo @ SHA ${{ env.CORE_REPO_SHA }}
uses: actions/checkout@v2
with:
repository: open-telemetry/opentelemetry-python
ref: ${{ env.CORE_REPO_SHA }}
path: opentelemetry-python-core
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- 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: v2-misc-tox-cache-${{ matrix.tox-environment }}-${{ hashFiles('tox.ini', 'dev-requirements.txt', 'gen-requirements.txt', 'docs-requirements.txt') }}
- name: run tox
run: tox -e ${{ matrix.tox-environment }}
- name: Ensure generated code is up to date
if: matrix.tox-environment == 'generate'
run: git diff --exit-code || (echo 'Generated code is out of date, please run "tox -e generate" and commit the changes in this PR.' && exit 1)