|
9 | 9 | CORE_REPO_SHA: 955c92e91b5cd4bcfb43c39efcef086b040471d2
|
10 | 10 |
|
11 | 11 | jobs:
|
| 12 | + build: |
| 13 | + env: |
| 14 | + # We use these variables to convert between tox and GHA version literals |
| 15 | + py37: 3.7 |
| 16 | + py38: 3.8 |
| 17 | + py39: 3.9 |
| 18 | + py310: "3.10" |
| 19 | + py311: "3.11" |
| 20 | + pypy3: "pypy3.7" |
| 21 | + RUN_MATRIX_COMBINATION: ${{ matrix.python-version }}-${{ matrix.package }}-${{ matrix.os }} |
| 22 | + runs-on: ${{ matrix.os }} |
| 23 | + strategy: |
| 24 | + fail-fast: false # ensures the entire test matrix is run, even if one permutation fails |
| 25 | + matrix: |
| 26 | + python-version: [ py37, py38, py39, py310, py311, pypy3 ] |
| 27 | + package: ["instrumentation", "distro", "exporter", "sdkextension", "propagator", "resource"] |
| 28 | + os: [ ubuntu-20.04 ] |
| 29 | + steps: |
| 30 | + - name: Checkout Contrib Repo @ SHA - ${{ github.sha }} |
| 31 | + uses: actions/checkout@v2 |
| 32 | + - name: Set up Python ${{ env[matrix.python-version] }} |
| 33 | + uses: actions/setup-python@v4 |
| 34 | + with: |
| 35 | + python-version: ${{ env[matrix.python-version] }} |
| 36 | + - name: Install tox |
| 37 | + run: pip install tox==3.27.1 tox-factor |
| 38 | + - name: Cache tox environment |
| 39 | + # Preserves .tox directory between runs for faster installs |
| 40 | + uses: actions/cache@v1 |
| 41 | + with: |
| 42 | + path: | |
| 43 | + .tox |
| 44 | + ~/.cache/pip |
| 45 | + key: v7-build-tox-cache-${{ env.RUN_MATRIX_COMBINATION }}-${{ hashFiles('tox.ini', 'gen-requirements.txt', 'dev-requirements.txt') }} |
| 46 | + - name: run tox |
| 47 | + run: tox -f ${{ matrix.python-version }}-${{ matrix.package }} -- --benchmark-json=${{ env.RUN_MATRIX_COMBINATION }}-benchmark.json |
| 48 | + # - name: Find and merge ${{ matrix.package }} benchmarks |
| 49 | + # # TODO: Add at least one benchmark to every package type to remove this (#249) |
| 50 | + # if: matrix.package == 'sdkextension' || matrix.package == 'propagator' |
| 51 | + # run: >- |
| 52 | + # mkdir -p benchmarks; |
| 53 | + # jq -s '.[0].benchmarks = ([.[].benchmarks] | add) |
| 54 | + # | if .[0].benchmarks == null then null else .[0] end' |
| 55 | + # **/**/tests/*${{ matrix.package }}*-benchmark.json > benchmarks/output_${{ matrix.package }}.json |
| 56 | + # - name: Upload all benchmarks under same key as an artifact |
| 57 | + # if: ${{ success() }} |
| 58 | + # uses: actions/upload-artifact@v2 |
| 59 | + # with: |
| 60 | + # name: benchmarks |
| 61 | + # path: benchmarks/output_${{ matrix.package }}.json |
| 62 | + # combine-benchmarks: |
| 63 | + # runs-on: ubuntu-latest |
| 64 | + # needs: build |
| 65 | + # if: ${{ always() }} |
| 66 | + # name: Combine benchmarks from previous build job |
| 67 | + # steps: |
| 68 | + # - name: Checkout Contrib Repo @ SHA - ${{ github.sha }} |
| 69 | + # uses: actions/checkout@v2 |
| 70 | + # - name: Download all benchmarks as artifact using key |
| 71 | + # uses: actions/download-artifact@v2 |
| 72 | + # with: |
| 73 | + # name: benchmarks |
| 74 | + # path: benchmarks |
| 75 | + # - name: Find and merge all benchmarks |
| 76 | + # run: >- |
| 77 | + # jq -s '.[0].benchmarks = ([.[].benchmarks] | add) |
| 78 | + # | if .[0].benchmarks == null then null else .[0] end' |
| 79 | + # benchmarks/output_*.json > output.json; |
| 80 | + # - name: Report on benchmark results |
| 81 | + # uses: benchmark-action/github-action-benchmark@v1 |
| 82 | + # with: |
| 83 | + # name: OpenTelemetry Python Benchmarks - Python ${{ env[matrix.python-version ]}} - ${{ matrix.package }} |
| 84 | + # tool: pytest |
| 85 | + # output-file-path: output.json |
| 86 | + # github-token: ${{ secrets.GITHUB_TOKEN }} |
| 87 | + # max-items-in-chart: 100 |
| 88 | + # # Alert with a commit comment on possible performance regression |
| 89 | + # alert-threshold: 200% |
| 90 | + # fail-on-alert: true |
| 91 | + # # Make a commit on `gh-pages` with benchmarks from previous step |
| 92 | + # auto-push: ${{ github.ref == 'refs/heads/main' }} |
| 93 | + # gh-pages-branch: gh-pages |
| 94 | + # benchmark-data-dir-path: benchmarks |
12 | 95 | misc:
|
13 | 96 | strategy:
|
14 | 97 | fail-fast: false
|
|
24 | 107 | with:
|
25 | 108 | python-version: "3.10"
|
26 | 109 | - name: Install tox
|
27 |
| - run: pip install tox |
| 110 | + run: pip install tox==3.27.1 |
28 | 111 | - name: Install libsnappy-dev
|
29 | 112 | if: ${{ matrix.tox-environment == 'lint' }}
|
30 | 113 | run: sudo apt-get install -y libsnappy-dev
|
|
0 commit comments