-
Notifications
You must be signed in to change notification settings - Fork 99
53 lines (45 loc) · 1.7 KB
/
test-specific-commit.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: R-Package-Test for Specific Commit or Branch
on:
workflow_dispatch:
inputs:
repo_name:
description: 'Repository name (e.g., person/repo) to run the workflow for'
required: true
branch:
description: 'Branch name to run the workflow for (leave empty if using commit SHA)'
required: false
default: ''
commit_sha:
description: 'Commit SHA to run the workflow for (leave empty if using branch)'
required: false
default: ''
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: ${{ github.event.inputs.repo_name }} # Use the input for repository name
ref: ${{ github.event.inputs.commit_sha || github.event.inputs.branch }} # Use commit SHA if provided, else branch
fetch-depth: 0 # Fetch all history to ensure the commit is found
- name: Set up R
uses: r-lib/actions/setup-r@v2
- name: Install system dependencies
run: sudo apt-get install -y libharfbuzz-dev libfribidi-dev libfreetype6-dev libcurl4-openssl-dev
- name: Cache R packages
uses: actions/cache@v3
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-r-${{ hashFiles('**/DESCRIPTION') }}
restore-keys: |
${{ runner.os }}-r-
- name: Install R package dependencies
run: |
R -e "install.packages('devtools'); devtools::install_deps(dependencies = TRUE)"
R -e "install.packages('remotes')"
R -e "install.packages('callr')"
- name: Run tests
run: |
R -e "devtools::test()"
R -e "testthat::test_dir('tests/testthat', reporter = 'check')"