Merge pull request #14 from edmundmiller/pixi #25
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: Render R Markdown | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| render-rmd: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Install pandoc | |
| uses: pandoc/actions/setup@v1 | |
| - name: Run pandoc | |
| run: pandoc --version | |
| - name: Setup R | |
| uses: r-lib/actions/setup-r@v2 | |
| with: | |
| use-public-rspm: true | |
| # Cache R package installations | |
| - name: Cache R packages | |
| uses: actions/cache@v3 | |
| with: | |
| path: /home/runner/work/_temp/Library | |
| key: ${{ runner.os }}-R-${{ hashFiles('**/*.Rmd', '**/*.R') }} | |
| restore-keys: | | |
| ${{ runner.os }}-R- | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev libglpk40 | |
| # Check if QC.Rmd has changed | |
| - name: Check for changes in QC.Rmd | |
| id: check_changes | |
| run: | | |
| git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q "QC.Rmd" && echo "changed=true" || echo "changed=false" | |
| - name: Install necessary R packages | |
| if: steps.check_changes.outputs.changed == 'true' | |
| run: | | |
| R -e 'install.packages("BiocManager")' | |
| R -e 'BiocManager::install("renv")' | |
| R -e 'BiocManager::install(c("Rhtslib", "Rsamtools", "GenomicAlignments", "rtracklayer", "systemfonts"))' | |
| R -e 'BiocManager::install(renv::dependencies(path = "./01_quality_assessment/.")[["Package"]])' | |
| R -e 'BiocManager::install(renv::dependencies(path = "./00_libs/load_data.R")[["Package"]])' | |
| # Add any other package installations you need here | |
| # e.g., Rscript ./install_depedencies.R | |
| - name: Render R Markdown | |
| if: steps.check_changes.outputs.changed == 'true' | |
| run: | | |
| Rscript -e 'rmarkdown::render("QC.Rmd", quiet = TRUE)' | |
| working-directory: ./01_quality_assessment | |
| - name: Upload HTML report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: rendered-report | |
| path: ./01_quality_assessment/QC.html |