Skip to content

Merge pull request #5 from EmilioG999/master #7

Merge pull request #5 from EmilioG999/master

Merge pull request #5 from EmilioG999/master #7

Workflow file for this run

name: R Package Tests
on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master, develop ]
workflow_dispatch:
permissions:
contents: read
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
r-version: ['4.3', 'latest']
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v4
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r-version }}
- name: Install system dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev
- name: Install R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::pak
any::testthat
- name: Install package
run: |
pak::pak("local::.")
shell: Rscript {0}
- name: Run tests
run: |
test_files <- list.files("tests", pattern = "^test.*\\.R$", full.names = TRUE)
if (length(test_files) == 0) {
cat("No test files found\n")
quit(save = "no", status = 0)
}
for (test_file in test_files) {
cat("\n=====================================\n")
cat("Running:", test_file, "\n")
cat("=====================================\n")
tryCatch(
source(test_file),
error = function(e) {
cat("ERROR in", test_file, ":\n")
print(e)
quit(save = "no", status = 1)
}
)
}
cat("\nAll tests completed successfully!\n")
shell: Rscript {0}
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}-r${{ matrix.r-version }}
path: tests/
retention-days: 30