Skip to content

Add error handling prototype #9032

Add error handling prototype

Add error handling prototype #9032

Workflow file for this run

name: Core Repo Tests
on:
push:
branches-ignore:
- 'release/*'
pull_request:
env:
# Set variable to 'main' 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: 6b83f1680f9a10900cb1da4e935252176ee05c21
# 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
# contrib builds are run directly from contrib (since test.yml is executed, which sets CORE_REPO_SHA)
# The solution is to include CORE_REPO_SHA as part of THIS environment so it can be accessed
# from within the contrib build.
CORE_REPO_SHA: ${{ github.sha }}
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
py310: "3.10"
pypy3: pypy-3.7
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, py310, pypy3 ]
package: ["api", "sdk", "semantic", "getting", "shim", "exporter", "protobuf", "propagator"]
os: [ ubuntu-20.04, windows-2019 ]
steps:
- name: Checkout Core Repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v2
- name: Set up Python ${{ env[matrix.python-version] }}
uses: actions/setup-python@v2
with:
python-version: ${{ env[matrix.python-version] }}
architecture: 'x64'
- 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
~/.cache/pip
key: v2-tox-cache-${{ env.RUN_MATRIX_COMBINATION }}-${{ hashFiles('tox.ini', 'dev-requirements.txt') }}-core
# tox fails on windows and Python3.6 when tox dir is reused between builds so we remove it
- name: fix for windows + py3.6
if: ${{ matrix.os == 'windows-2019' && matrix.python-version == 'py36' }}
shell: pwsh
run: Remove-Item .\.tox\ -Force -Recurse -ErrorAction Ignore
- name: run tox
run: tox -f ${{ matrix.python-version }}-${{ matrix.package }} -- --benchmark-json=${{ env.RUN_MATRIX_COMBINATION }}-benchmark.json
- name: Find and merge benchmarks
id: find_and_merge_benchmarks
run: >-
jq -s '.[0].benchmarks = ([.[].benchmarks] | add)
| if .[0].benchmarks == null then null else .[0] end'
$(find . -name '*${{ matrix.package }}*-benchmark.json') > output.json
&& echo "::set-output name=json_plaintext::$(cat output.json)"
- name: Report on benchmark results
if: steps.find_and_merge_benchmarks.outputs.json_plaintext != 'null'
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", "mypy", "mypyinstalled", "tracecontext" ]
name: ${{ matrix.tox-environment }}
runs-on: ubuntu-20.04
steps:
- name: Checkout Core Repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
architecture: 'x64'
- 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
~/.cache/pip
key: v2-tox-cache-${{ matrix.tox-environment }}-${{ hashFiles('tox.ini', 'dev-requirements.txt') }}-core
- name: run tox
run: tox -e ${{ matrix.tox-environment }}
# Contrib unit test suite in order to ensure changes in core do not break anything in contrib.
# We only run contrib unit tests on the oldest supported Python version (3.6) as running the same tests
# on all versions is somewhat redundant.
contrib-build:
env:
# We use these variables to convert between tox and GHA version literals
py36: 3.6
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
matrix:
python-version: [ py36 ]
package: ["instrumentation", "exporter"]
os: [ ubuntu-20.04]
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] }}
architecture: 'x64'
- 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
~/.cache/pip
key: v2-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 }}