Update r.yml #42
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: Debug repo contents | |
| run: | | |
| pwd | |
| echo "=== top level ===" | |
| ls -la | |
| echo "=== notebooks ===" | |
| ls -la notebooks || true | |
| echo "=== analysis/R ===" | |
| ls -la analysis/R || true | |
| echo "=== data files ===" | |
| find data -maxdepth 4 -type f || true | |
| - 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 \ | |
| build-essential gfortran \ | |
| libfontconfig1-dev libfreetype6-dev \ | |
| libharfbuzz-dev libfribidi-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: Create output directory | |
| run: mkdir -p output | |
| - name: Run full analysis pipeline | |
| run: | | |
| set -e | |
| Rscript --vanilla notebooks/01_load_and_clean.R | |
| Rscript --vanilla notebooks/02_exploration.R | |
| Rscript --vanilla notebooks/03_feature_engineering.R | |
| Rscript --vanilla notebooks/04_model_training.R | |
| Rscript --vanilla notebooks/05_evaluation.R | |
| Rscript --vanilla notebooks/09_tables_confusion_matrices.R | |
| - name: Debug list outputs | |
| if: always() | |
| run: | | |
| echo "=== output files ===" | |
| find output -maxdepth 5 -type f | sort || true | |
| - name: Upload outputs as artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: analysis-outputs | |
| path: output/ |