Refactor analyzer tests by moving tests from AnalyzerTest to Analyzer… #4110
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: CI # For unit tests and build | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| env: | |
| USE_PYTHON_VERSION: "3.11" | |
| PROTO_DIR: "proto" | |
| jobs: | |
| # Build meridian "core" and "mmm-proto-schema" distributions. | |
| build-distributions: | |
| name: Build distributions | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build meridian core distribution | |
| uses: ./.github/actions/build | |
| with: | |
| python_version: ${{ env.USE_PYTHON_VERSION }} | |
| artifact_name: meridian-core-package-distribution | |
| - name: Build mmm-proto-schema distribution | |
| uses: ./.github/actions/build | |
| with: | |
| python_version: ${{ env.USE_PYTHON_VERSION }} | |
| working_directory: ./proto | |
| output_path: ./proto/dist | |
| artifact_name: mmm-proto-package-distribution | |
| # Include for sanity checking that version increment parsing and checking logic works. | |
| check-version: | |
| name: Version check | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Check meridian version | |
| - uses: ./.github/actions/install-meridian | |
| with: | |
| python_version: ${{ inputs.python_version }} | |
| extras: '' | |
| - name: Get meridian version | |
| id: get_meridian_version | |
| shell: bash | |
| run: | | |
| VERSION=$(python -c "import meridian; print(meridian.__version__)") | |
| echo "value=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Check meridian version | |
| id: meridian_version_check | |
| uses: ./.github/actions/version-check | |
| with: | |
| python_version: ${{ env.USE_PYTHON_VERSION }} | |
| semver_prefix: v | |
| current_version: ${{ steps.get_meridian_version.outputs.value}} | |
| # Check mmm-proto-schema version | |
| - name: Get mmm-proto-schema version | |
| id: get_proto_version | |
| uses: ./.github/actions/get-proto-version | |
| with: | |
| python_version: ${{ env.USE_PYTHON_VERSION }} | |
| - name: Check mmm-proto-schema version | |
| uses: ./.github/actions/version-check | |
| with: | |
| python_version: ${{ env.USE_PYTHON_VERSION }} | |
| semver_prefix: proto-v | |
| current_version: ${{ steps.get_proto_version.outputs.value}} | |
| pytest: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| strategy: | |
| max-parallel: 8 | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| meridian-backend: ["tensorflow", "jax"] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.python-version }}-${{ matrix.meridian-backend }} | |
| cancel-in-progress: true | |
| name: pytest (python-${{ matrix.python-version }}, backend-${{ matrix.meridian-backend }}) | |
| steps: | |
| - uses: actions/checkout@v4 | |
| if: ${{ !contains(github.event.head_commit.message, '#skip-pytest') }} | |
| - uses: ./.github/actions/install-meridian | |
| if: ${{ !contains(github.event.head_commit.message, '#skip-pytest') }} | |
| with: | |
| python_version: ${{ matrix.python-version }} | |
| # Run tests (in parallel) | |
| - name: Run core tests | |
| if: ${{ !contains(github.event.head_commit.message, '#skip-pytest') }} | |
| run: pytest -vv --ignore=schema | |
| env: | |
| MERIDIAN_BACKEND: ${{ matrix.meridian-backend }} | |
| pytest-schema: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| name: pytest-schema | |
| steps: | |
| - uses: actions/checkout@v4 | |
| if: ${{ !contains(github.event.head_commit.message, '#skip-pytest') }} | |
| - uses: actions/setup-python@v5 | |
| if: ${{ !contains(github.event.head_commit.message, '#skip-pytest') }} | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| cache-dependency-path: '**/pyproject.toml' | |
| - name: Install proto dependencies and test tools | |
| if: ${{ !contains(github.event.head_commit.message, '#skip-pytest') }} | |
| run: | | |
| pip install semver | |
| pip install -e proto --config-settings editable_mode=strict | |
| pip install -e . --config-settings editable_mode=strict | |
| pip install pytest pytest-xdist | |
| - name: Run schema tests | |
| if: ${{ !contains(github.event.head_commit.message, '#skip-pytest') }} | |
| run: pytest -vv -n auto schema |