Fix CI diagnostics and harden R pipeline execution #40
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: Reproducible R Pipeline | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| permissions: | |
| contents: read | |
| jobs: | |
| pipeline: | |
| name: Run full analysis pipeline | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up R | |
| uses: r-lib/actions/setup-r@v2 | |
| with: | |
| r-version: "4.3.2" | |
| use-public-rspm: true | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev | |
| - name: Restore R environment with renv | |
| run: | | |
| Rscript -e 'install.packages("renv", repos = "https://cloud.r-project.org")' | |
| Rscript -e 'renv::restore(prompt = FALSE)' | |
| - name: Run full analysis pipeline | |
| run: | | |
| Rscript notebooks/01_load_and_clean.R | |
| Rscript notebooks/02_exploration.R | |
| Rscript notebooks/03_feature_engineering.R | |
| Rscript notebooks/04_model_training.R | |
| Rscript notebooks/05_evaluation.R | |
| Rscript notebooks/09_tables_confusion_matrices.R | |
| - name: List output directory | |
| run: | | |
| ls -la output || true | |
| - name: Verify outputs | |
| run: | | |
| # Figures 1–4 from EDA | |
| test -f output/Figure_1_Correlation_Matrix_Diabetes.png | |
| test -f output/Figure_2_Correlation_Matrix_Heart_Failure.png | |
| test -f output/Figure_3_Age_Distribution_Diabetes.png | |
| test -f output/Figure_4_Age_Distribution_Heart_Failure.png | |
| # Models saved to output (ensure 04_model_training.R saves here) | |
| test -f output/logistic_model.rds | |
| test -f output/random_forest_model.rds | |
| # Pooled OOF evaluation artifacts | |
| test -f output/oof_predictions_logit.csv | |
| test -f output/oof_predictions_rf.csv | |
| test -f output/chosen_thresholds_youden.csv | |
| test -f output/confusion_matrix_logit_oof_youden.csv | |
| test -f output/confusion_matrix_rf_oof_youden.csv | |
| test -f output/performance_metrics_oof_youden.csv | |
| # Full caret printed confusion reports | |
| test -f output/logistic_regression_confusion_report_oof_youden.txt | |
| test -f output/random_forest_confusion_report_oof_youden.txt | |
| # ROC plots | |
| test -f output/roc_logit_oof.png | |
| test -f output/roc_rf_oof.png | |
| # Journal-style confusion matrix tables (Tables 5–6) | |
| test -f output/Table_5_Logistic_Regression_Confusion_Matrix_OOF_Youden.csv | |
| test -f output/Table_6_Random_Forest_Confusion_Matrix_OOF_Youden.csv | |
| test -f output/Table_5_Logistic_Regression_Confusion_Matrix_OOF_Youden.txt | |
| test -f output/Table_6_Random_Forest_Confusion_Matrix_OOF_Youden.txt | |
| test -f output/Table_Confusion_Matrix_Summary_Youden_OOF.csv | |
| - name: Upload outputs as artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: analysis-outputs | |
| path: output/ |