Enroll without nautobot #2731
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: code tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "python/**" | |
| - ".github/workflows/code-test.yaml" | |
| pull_request: | |
| paths: | |
| - "python/**" | |
| - ".github/workflows/code-test.yaml" | |
| workflow_dispatch: | |
| merge_group: | |
| types: [checks_requested] | |
| # limit rapid succession from pushes | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| jobs: | |
| discover: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| projects: ${{ steps.set-projects.outputs.projects }} | |
| steps: | |
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - name: Find all projects with pyproject.toml | |
| id: set-projects | |
| run: | | |
| # grabs all paths with pyproject.toml, snips the 2nd dir, grabs only unique ones, makes a JSON list | |
| projects=$(find python -mindepth 2 ! -wholename 'python/understack-tests/*' -name pyproject.toml | awk -F/ '{print $2}' | sort -u | jq -R -s -c 'split("\n")[:-1]') | |
| echo "projects=$projects" >> "$GITHUB_OUTPUT" | |
| uv: | |
| needs: [discover] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| project: ${{ fromJson(needs.discover.outputs.projects) }} | |
| defaults: | |
| run: | |
| working-directory: ./python/${{ matrix.project }} | |
| steps: | |
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7 | |
| - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6 | |
| with: | |
| python-version-file: python/${{ matrix.project }}/pyproject.toml | |
| - run: uv sync | |
| - run: uv build --wheel | |
| - run: | | |
| set -e | |
| if [ -e .stestr.conf ]; then | |
| uv run stestr run | |
| else | |
| uv run pytest --cov --cov-report xml:coverage.xml | |
| fi | |
| - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 | |
| with: | |
| name: coverage-${{ matrix.project }} | |
| path: python/${{ matrix.project }}/coverage.xml | |
| retention-days: 1 | |
| coverage-upload: | |
| needs: [uv] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6 | |
| with: | |
| pattern: coverage-* | |
| merge-multiple: true | |
| - run: | | |
| npx cobertura-merge-globby -o output.xml --files=python/**/coverage.xml | |
| - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 | |
| with: | |
| name: coverage.xml | |
| path: coverage.xml | |
| retention-days: 1 |