Skip to content

Commit 1ed516e

Browse files
committed
new branch
1 parent f5be54e commit 1ed516e

File tree

1 file changed

+45
-9
lines changed

1 file changed

+45
-9
lines changed

.github/workflows/R-CMD-check.yaml

+45-9
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,22 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11+
determine_check_type:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
run_type: ${{ steps.check_run_type.outputs.run_type }}
15+
steps:
16+
- uses: actions/checkout@v4
17+
- id: check_run_type
18+
run: |
19+
if [[ "${{ github.event.head_commit.message }}" == *"[long-run]"* ]]; then
20+
echo "run_type=comprehensive" >> $GITHUB_OUTPUT
21+
else
22+
echo "run_type=quick" >> $GITHUB_OUTPUT
23+
fi
24+
1125
test:
26+
needs: determine_check_type
1227
runs-on: ${{ matrix.config.os }}
1328
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
1429
strategy:
@@ -33,27 +48,48 @@ jobs:
3348

3449
- uses: r-lib/actions/setup-r-dependencies@v2
3550
with:
36-
extra-packages: any::rcmdcheck
51+
extra-packages: any::testthat, any::devtools, any::rcmdcheck
3752
needs: check
3853

39-
- name: Check package
54+
- name: Run quick check
55+
if: needs.determine_check_type.outputs.run_type == 'quick'
56+
run: |
57+
options(crayon.enabled = TRUE)
58+
devtools::load_all()
59+
testthat::test_dir("tests/testthat", reporter = "summary")
60+
shell: Rscript {0}
61+
62+
- name: Run comprehensive check
63+
if: needs.determine_check_type.outputs.run_type == 'comprehensive'
4064
env:
4165
_R_CHECK_CRAN_INCOMING_: false
4266
run: |
4367
options(crayon.enabled = TRUE)
4468
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
4569
shell: Rscript {0}
4670

71+
- name: Run tests (comprehensive)
72+
if: needs.determine_check_type.outputs.run_type == 'comprehensive'
73+
run: |
74+
options(crayon.enabled = TRUE)
75+
devtools::load_all()
76+
test_results <- testthat::test_dir("tests/testthat", reporter = "summary")
77+
saveRDS(test_results, file = "test_results.rds")
78+
print(test_results)
79+
shell: Rscript {0}
80+
4781
- name: Upload check results
48-
if: failure()
82+
if: failure() && needs.determine_check_type.outputs.run_type == 'comprehensive'
4983
uses: actions/upload-artifact@v3
5084
with:
5185
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
5286
path: check
5387

54-
- name: Test coverage
55-
if: runner.os == 'Linux'
56-
run: |
57-
pak::pkg_install("covr")
58-
covr::codecov(token = "${{secrets.CODECOV_TOKEN}}")
59-
shell: Rscript {0}
88+
- name: Upload test results
89+
uses: actions/upload-artifact@v3
90+
if: needs.determine_check_type.outputs.run_type == 'comprehensive'
91+
with:
92+
name: test-results-${{ matrix.config.os }}
93+
path: |
94+
test_results.rds
95+
tests/testthat/

0 commit comments

Comments
 (0)