Skip to content

Fix the stubgen helper function to attach stubs to the correct class in modules with multiple classes #895

Fix the stubgen helper function to attach stubs to the correct class in modules with multiple classes

Fix the stubgen helper function to attach stubs to the correct class in modules with multiple classes #895

Workflow file for this run

---
name: Test code
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_call:
inputs:
repo-name:
description: The name of the repository to use to gate Codecov uploads.
required: true
type: string
# Cancel running jobs for the same workflow and branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
# IMPORTANT: Any new jobs need to be added to the check-tests-passed job to ensure they correctly gate code changes
jobs:
# Basic testing & linting
test-general:
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] # when updating this, make sure to update all workflows that use this strategy
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Install dependencies
run: python -m pip install tox tox-gh-actions
- name: Run tox
run: tox -v
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: artifact_${{ matrix.platform }}_${{ matrix.python-version }}_tests_and_linting
path: |
.results_*/**
.coverage*
# Quick testing with coverage (no linting)
test-fast:
runs-on: ${{ matrix.os_name }}-latest
env:
REPO_NAME: tektronix/${{ inputs.repo-name || 'tm_devices' }}
pytest_report_title: Test Results (${{ matrix.os_name }})
strategy:
fail-fast: false
matrix:
os_name: [ubuntu, windows, macos]
steps:
- uses: actions/checkout@v4
- if: ${{ inputs.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
- if: ${{ inputs.node-version }}
name: Install non-python documentation dependencies
run: |
npm install -g @mermaid-js/mermaid-cli
sudo apt install --no-install-recommends --assume-yes graphviz
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: x # any version
check-latest: true
- name: Install tox
run: python -m pip install tox
- name: Test
run: tox -ve tests
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: artifact_${{ matrix.os_name }}_tests
path: |
.results_*/**
.coverage*
- name: Upload coverage to Codecov
uses: codecov/[email protected]
if: ${{ github.repository == env.REPO_NAME && !cancelled() }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./.coverage_tests.xml
name: codecov-${{ matrix.os_name }}
fail_ci_if_error: true
verbose: true
create-job-summary:
name: Test Results
if: ${{ !cancelled() }}
needs: test-fast
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Generate Summary
uses: phoenix-actions/test-reporting@v15
with:
name: Test Results
only-summary: false
output-to: step-summary
path: artifacts/**/.results_tests/results.xml
reporter: java-junit
fail-on-error: false
max-annotations: 0
# Check that all jobs passed
check-tests-passed:
if: ${{ !cancelled() }}
needs: [test-general, test-fast, create-job-summary]
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}