diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index fe75401..a8de427 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -21,13 +21,31 @@ jobs: steps: - uses: actions/checkout@v2 - # Set up and cache R dependencies - - name: Install and cache R dependencies + # Create directories for R libraries if not already present + - name: Create R Library Paths + run: | + mkdir -p /github/home/R/x86_64-pc-linux-gnu-library/4.4 + mkdir -p renv/library + + # Restore cache for R dependencies + - name: Restore R Dependencies Cache + uses: actions/cache@v4 + with: + path: | + /github/home/R/x86_64-pc-linux-gnu-library/4.4 + renv/library + key: ${{ runner.os }}-r-libs-${{ hashFiles('DESCRIPTION') }} + restore-keys: | + ${{ runner.os }}-r-libs- + + # Install R dependencies + - name: Install R Dependencies uses: r-lib/actions/setup-r-dependencies@v2 with: - cache: "always" + cache: false - - name: Debug Paths + # Verify library paths + - name: Debug R Library Paths run: | echo "Checking /github/home/R/x86_64-pc-linux-gnu-library/4.4" ls -R /github/home/R/x86_64-pc-linux-gnu-library/4.4 || echo "Directory does not exist." @@ -38,3 +56,12 @@ jobs: - name: Run Tests run: devtools::test(stop_on_failure = TRUE) shell: Rscript {0} + + # Save R dependencies to cache + - name: Save R Dependencies Cache + uses: actions/cache@v4 + with: + path: | + /github/home/R/x86_64-pc-linux-gnu-library/4.4 + renv/library + key: ${{ runner.os }}-r-libs-${{ hashFiles('DESCRIPTION') }}