Skip to content

fix: allow user override of id generator #2486

fix: allow user override of id generator

fix: allow user override of id generator #2486

Workflow file for this run

name: Python CI
on:
push:
branches: [ main ]
pull_request:
paths:
- "python/**"
workflow_dispatch:
concurrency:
group: test-python-${{ github.head_ref }}
cancel-in-progress: true
jobs:
changes:
name: Filter Changes
runs-on: ubuntu-latest
outputs:
diff: ${{ steps.filter.outputs.diff }}
diff_files: ${{ steps.filter.outputs.diff_files }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
list-files: json
filters: |
diff:
- "python/instrumentation/**/*.py"
- "python/instrumentation/**/*.toml"
- "python/instrumentation/**/*.yaml"
- "python/openinference-*/**/*.py"
- "python/openinference-*/**/*.toml"
- "python/openinference-*/**/*.yaml"
find-tox-testenv:
name: Find Tox Testenv
needs: changes
if: ${{ needs.changes.outputs.diff == 'true' }}
runs-on: ubuntu-latest
outputs:
list: ${{ steps.testenv.outputs.list }}
steps:
- name: Convert JSON list to regex
run: >-
echo "list=$(echo '${{ needs.changes.outputs.diff_files }}'
| jq -r '.[]'
| sed -n
-e 's/^python\/instrumentation\/openinference-instrumentation-\([^/]*\)\/.*/\1/p'
-e 's/^python\/openinference-\(instrumentation\)\/.*/\1/p'
-e 's/^python\/openinference-\(semantic-conventions\)\/.*/\1/p'
| sort -u
| sed -e 's/semantic-conventions/semconv/' -e 's/-/_/' -e 's/^/\\b/'
| paste -sd "|" -)"
>> "$GITHUB_OUTPUT"
id: packages
- uses: actions/checkout@v4
with:
sparse-checkout: python
- uses: astral-sh/setup-uv@v5
with:
version: 0.6.3
enable-cache: false
- name: Extract testenv into JSON list
run: >-
echo "list=$(uvx --with tox-uv tox -l
| egrep -e '${{ steps.packages.outputs.list }}'
| jq -R -s -c 'split("\n")[:-1]')"
>> $GITHUB_OUTPUT
working-directory: python
id: testenv
- name: Fail if no testenv is found
if: ${{ steps.testenv.outputs.list == '[]' }}
run: exit 1
run-tox-testenv:
name: ${{ matrix.testenv }}
needs: find-tox-testenv
if: ${{ needs.find-tox-testenv.outputs.list != '[]' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
testenv: ${{ fromJSON(needs.find-tox-testenv.outputs.list) }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: python
- uses: astral-sh/setup-uv@v5
with:
version: 0.6.3
enable-cache: false
- run: uvx --with tox-uv tox run -e ${{ matrix.testenv }}
working-directory: python