Files
stefan-jansen--machine-lear…/.github/workflows/full-test.yml
T
2026-07-13 13:26:28 +08:00

199 lines
6.1 KiB
YAML

# ML4T Full Test Suite — Release Gate
#
# Runs ALL 443 notebooks inside Docker. Manual dispatch only.
# Expected runtime: 60-90 minutes.
#
# Use this before releases to verify everything works end-to-end.
# For incremental testing on push/PR, use test.yml instead.
name: Full Test Suite
on:
workflow_dispatch:
inputs:
scope:
description: "Test scope"
type: choice
options:
- all
- chapters-only
- case-studies-only
default: all
env:
ML4T_DATA_PATH: ${{ github.workspace }}/test-data/data
ML4T_OUTPUT_DIR: /tmp/ml4t-test-output
MPLBACKEND: Agg
PLOTLY_RENDERER: json
jobs:
# ---------------------------------------------------------------------------
# All chapter notebooks (Ch01-Ch26)
# ---------------------------------------------------------------------------
chapters:
if: >-
github.event.inputs.scope == 'all' ||
github.event.inputs.scope == 'chapters-only'
timeout-minutes: 120
runs-on: ubuntu-latest
container:
image: ml4t/ml4t:latest
steps:
- name: Install git
run: apt-get update -qq && apt-get install -y -qq git openssh-client >/dev/null
- uses: actions/checkout@v6
- name: Checkout test data
uses: actions/checkout@v6
with:
repository: ml4t/third-edition-test-data
path: test-data
ssh-key: ${{ secrets.TEST_DATA_DEPLOY_KEY }}
lfs: false
- name: Seed intermediates
run: |
mkdir -p $ML4T_OUTPUT_DIR
if [ -d test-data/intermediates ]; then
cp -r test-data/intermediates/* $ML4T_OUTPUT_DIR/
fi
- name: Run ALL chapter notebooks
env:
PYTHONPATH: ${{ github.workspace }}
run: |
python -m pytest tests/test_chapter_notebooks.py \
-v --tb=short \
--timeout=600
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: chapter-results
path: /tmp/ml4t-test-results.jsonl
if-no-files-found: ignore
# ---------------------------------------------------------------------------
# All case study pipelines (9 case studies)
# ---------------------------------------------------------------------------
case-studies:
if: >-
github.event.inputs.scope == 'all' ||
github.event.inputs.scope == 'case-studies-only'
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
case-study:
- etfs
- crypto_perps_funding
- nasdaq100_microstructure
- sp500_equity_option_analytics
- us_firm_characteristics
- fx_pairs
- cme_futures
- sp500_options
- us_equities_panel
runs-on: ubuntu-latest
container:
image: ml4t/ml4t:latest
steps:
- name: Install git
run: apt-get update -qq && apt-get install -y -qq git openssh-client >/dev/null
- uses: actions/checkout@v6
- name: Checkout test data
uses: actions/checkout@v6
with:
repository: ml4t/third-edition-test-data
path: test-data
ssh-key: ${{ secrets.TEST_DATA_DEPLOY_KEY }}
lfs: false
- name: Run pipeline (${{ matrix.case-study }})
env:
PYTHONPATH: ${{ github.workspace }}
run: |
python -m pytest tests/test_case_studies.py \
-v --tb=short \
-k "${{ matrix.case-study }}" \
--timeout=600
# ---------------------------------------------------------------------------
# Py312 notebooks (signatory, gensim, esig, pfhedge, tfcausalimpact, torch CUDA bug)
# ---------------------------------------------------------------------------
py312:
if: github.event.inputs.scope == 'all'
timeout-minutes: 45
runs-on: ubuntu-latest
container:
image: ml4t/ml4t-py312:latest
steps:
- name: Install git
run: apt-get update -qq && apt-get install -y -qq git openssh-client >/dev/null
- uses: actions/checkout@v6
- name: Checkout test data
uses: actions/checkout@v6
with:
repository: ml4t/third-edition-test-data
path: test-data
ssh-key: ${{ secrets.TEST_DATA_DEPLOY_KEY }}
- name: Run py312 notebooks
env:
PYTHONPATH: ${{ github.workspace }}
run: |
python -m pytest tests/test_docker_notebooks.py \
-v --tb=short \
-k "03_sigcwgan or 06_path_signatures or 12_wasserstein \
or 01_word2vec or 02_asset_embeddings or 03_sentiment_evolution \
or 01_timegan or 07_dp_gan \
or 10_shap_nlp_sentiment or 06_conditional_autoencoder \
or 06_fed_announcement_bsts \
or deep_hedging_pfhedge"
# ---------------------------------------------------------------------------
# Summary
# ---------------------------------------------------------------------------
summary:
runs-on: ubuntu-latest
needs: [chapters, case-studies, py312]
if: always()
steps:
- name: Download results
uses: actions/download-artifact@v4
with:
pattern: "*-results"
merge-multiple: true
path: results/
continue-on-error: true
- name: Report
run: |
echo "============================================"
echo "ML4T Full Test Suite — Summary"
echo "============================================"
echo "Chapters: ${{ needs.chapters.result }}"
echo "Case Studies: ${{ needs.case-studies.result }}"
echo "Py312: ${{ needs.py312.result }}"
echo "============================================"
if [[ "${{ needs.chapters.result }}" == "failure" ]] || \
[[ "${{ needs.case-studies.result }}" == "failure" ]] || \
[[ "${{ needs.py312.result }}" == "failure" ]]; then
echo "RESULT: SOME TESTS FAILED"
exit 1
else
echo "RESULT: ALL TESTS PASSED"
fi