Integration tests #29
Workflow file for this run
This file contains 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: Integration tests | |
on: | |
pull_request_review: | |
branches: [ main ] | |
types: [submitted] | |
workflow_dispatch: | |
jobs: | |
model-pack-tests: | |
if: github.event.review.state == 'approved' || github.event_name == 'workflow_dispatch' | |
runs-on: [ubuntu-latest] | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
cache: pip | |
- name: create venv and install dependencies | |
run: | | |
rm -r /tmp/kazu-env || true | |
PIP_CACHE_DIR=$(pip cache dir) | |
echo "pip cache dir is "${PIP_CACHE_DIR} | |
python -m venv /tmp/kazu-env | |
. /tmp/kazu-env/bin/activate | |
python -m pip install --upgrade pip | |
pip install --upgrade --upgrade-strategy eager --index-url https://download.pytorch.org/whl/cpu "torch>=2.0.0" | |
pip install -e ."[dev]" --cache-dir $PIP_CACHE_DIR --upgrade --upgrade-strategy eager | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
# TODO: network issue on gradle DL | |
# - name: Setup and execute Gradle 'test' task | |
# uses: gradle/gradle-build-action@v2 | |
# with: | |
# arguments: test | |
# build-root-directory: kazu-jvm/ | |
- name: Build model pack caches and test | |
id: model_pack_cache_build | |
run: | | |
export BASE_KAZU_CONF_PATH=$GITHUB_WORKSPACE"/kazu/conf" | |
# set PYTHONUNBUFFERED so that we see failures in logs before freeze | |
export PYTHONUNBUFFERED=1 | |
# random suffix to prevent clashes with other runs | |
export MODEL_PACK_BUILD_PATH=$GITHUB_WORKSPACE"/temp_model_pack_test_dir_"$RANDOM | |
export KAZU_LOGGING_CONF=$GITHUB_WORKSPACE"/kazu/utils/model_pack_build_logging.conf" | |
export KAZU_MODEL_PACK_BUILD_RESOURCES_PATH=$GITHUB_WORKSPACE"/resources/" | |
mkdir $MODEL_PACK_BUILD_PATH | |
. /tmp/kazu-env/bin/activate | |
python -m kazu.utils.build_and_test_model_packs \ | |
--base_configuration_path $BASE_KAZU_CONF_PATH \ | |
--model_packs_to_build kazu_model_pack_public \ | |
--model_pack_output_path $MODEL_PACK_BUILD_PATH \ | |
--skip_tests \ | |
--logging_config_path $KAZU_LOGGING_CONF \ | |
--debug | |
export KAZU_MODEL_PACK=$(echo $MODEL_PACK_BUILD_PATH/kazu_model_pack_public) | |
# skip server tests on runner due to low shared memory. | |
export SKIP_KAZU_SERVER_TESTS=1 | |
# skip experimental modules | |
export SKIP_KAZU_EXPERIMENTAL_TESTS=1 | |
# separate out hypothesis and non-hypothesis tests | |
# because the hypothesis cache causes memory to grow significantly and | |
# cause the run to fail. | |
pytest -m "not hypothesis" | |
pytest -m "hypothesis" | |
# build sphinx html and run doctests | |
# this needs to be after the model pack build because they depend on the | |
# model pack being present for doctests that load the full pipeline. | |
# We've already built the html docs in the pre-commit and docs | |
# check, but doctest can only be done here. It seems worth it to double | |
# check and build the html target while sphinx is running, just in case | |
# it interacts weirdly with the model pack build somehow. | |
make -C docs html doctest | |
# need to call twice, for NFS bug | |
rm -r /tmp/kazu-env || true | |
rm -r /tmp/kazu-env || true | |
rm -r $MODEL_PACK_BUILD_PATH || true | |
rm -r $MODEL_PACK_BUILD_PATH || true |