whylabs/whylogs-python

View on GitHub
.github/workflows/test-notebook.yml

Summary

Maintainability
Test Coverage
name: notebook test

on:
  pull_request:
  push:
    branches: [mainline]
    tags:
      - "[0-9]+.[0-9]+.[0-9]+*"

defaults:
  run:
    working-directory: python

env:
  CODECOV_UPLOAD: false
  POETRY_VERSION: "1.4.1"
  PROTOC_VERSION: "3.19.4"
  PYPI_PUBLISH: false
  HEAP_APPID_DEV: "3422045963"

jobs:
  notebook-test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        os: [ubuntu-latest]
        python-version: ["3.9"]

    steps:
      - uses: actions/checkout@v3
      - name: Install Poetry
        uses: abatilo/actions-poetry@v2.0.0
        with:
          poetry-version: ${{ env.POETRY_VERSION }}
      - name: Setup Python with poetry cache
        uses: actions/setup-python@v4
        id: setup-python
        with:
          python-version: ${{ matrix.python-version }}
          cache: poetry
      - run: echo 'notebook-test python ${{ matrix.python-version }} poetry cache hit ${{ steps.setup-python.outputs.cache-hit }}'

      - name: Set up pre-commit cache
        uses: actions/cache@v3
        if: startsWith(runner.os, 'Linux')
        with:
          path: ~/.cache/pre-commit
          key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
          restore-keys: ${{ runner.os }}-pre-commit-

      - name: Install Protoc
        uses: arduino/setup-protoc@v1
        with:
          version: ${{ env.PROTOC_VERSION }}
          repo-token: ${{ secrets.GITHUB_TOKEN }}

      - name: Check Poetry version
        run: |
          POETRY_VERSION_INSTALLED=$(poetry -V)
          echo "The POETRY_VERSION environment variable is set to $POETRY_VERSION."
          echo "The installed Poetry version is $POETRY_VERSION_INSTALLED."
          case $POETRY_VERSION_INSTALLED in
          *$POETRY_VERSION*) echo "Poetry version correct." ;;
          *) echo "Poetry version incorrect." && exit 1 ;;
          esac

      - name: Install dependencies
        run: make telemetry-opt-out install

      - name: Install Graphviz
        run: sudo apt-get install graphviz

      - name: Check virtualenv location
        run: |
          EXPECTED_VIRTUALENV_PATH=${{ github.workspace }}/python/.venv
          INSTALLED_VIRTUALENV_PATH=$(poetry env info --path)
          echo "The virtualenv should be at $EXPECTED_VIRTUALENV_PATH."
          echo "Poetry is using a virtualenv at $INSTALLED_VIRTUALENV_PATH."
          case "$INSTALLED_VIRTUALENV_PATH" in
          "$EXPECTED_VIRTUALENV_PATH") echo "Correct Poetry virtualenv." ;;
          *) echo "Incorrect Poetry virtualenv." && exit 1 ;;
          esac

      - name: Build proto
        run: make proto

      - name: make jupyter-kernel
        run: make jupyter-kernel

      - name: Test-notebooks
        run: make test-notebooks