|
4 | 4 | push: |
5 | 5 | branches: [main, master] |
6 | 6 | pull_request: |
7 | | - branches: [main, master] |
8 | 7 |
|
9 | | -name: test-coverage |
| 8 | +name: test-coverage.yaml |
| 9 | + |
| 10 | +permissions: read-all |
10 | 11 |
|
11 | 12 | jobs: |
12 | 13 | test-coverage: |
13 | 14 | runs-on: ubuntu-latest |
14 | | - # accidentally committed an infinite loop that ran |
15 | | - # for 6 hours in #208, so set a reasonable conservative upper bound. |
16 | | - timeout-minutes: 40 |
17 | 15 | env: |
18 | 16 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
19 | 17 |
|
20 | 18 | steps: |
21 | | - - uses: actions/checkout@v3 |
| 19 | + - uses: actions/checkout@v4 |
22 | 20 |
|
23 | 21 | - uses: r-lib/actions/setup-r@v2 |
24 | 22 | with: |
25 | 23 | use-public-rspm: true |
26 | 24 |
|
27 | 25 | - uses: r-lib/actions/setup-r-dependencies@v2 |
28 | 26 | with: |
29 | | - extra-packages: any::covr |
| 27 | + extra-packages: any::covr, any::xml2 |
30 | 28 | needs: coverage |
31 | 29 |
|
32 | 30 | - name: Test coverage |
33 | 31 | run: | |
34 | | - covr::codecov( |
| 32 | + cov <- covr::package_coverage( |
35 | 33 | quiet = FALSE, |
36 | 34 | clean = FALSE, |
37 | | - install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package") |
| 35 | + install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") |
38 | 36 | ) |
| 37 | + print(cov) |
| 38 | + covr::to_cobertura(cov) |
39 | 39 | shell: Rscript {0} |
40 | 40 |
|
| 41 | + - uses: codecov/codecov-action@v5 |
| 42 | + with: |
| 43 | + # Fail if error if not on PR, or if on PR and token is given |
| 44 | + fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }} |
| 45 | + files: ./cobertura.xml |
| 46 | + plugins: noop |
| 47 | + disable_search: true |
| 48 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 49 | + |
41 | 50 | - name: Show testthat output |
42 | 51 | if: always() |
43 | 52 | run: | |
44 | 53 | ## -------------------------------------------------------------------- |
45 | | - find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true |
| 54 | + find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true |
46 | 55 | shell: bash |
47 | 56 |
|
48 | 57 | - name: Upload test results |
49 | 58 | if: failure() |
50 | | - uses: actions/upload-artifact@v3 |
| 59 | + uses: actions/upload-artifact@v4 |
51 | 60 | with: |
52 | 61 | name: coverage-test-failures |
53 | 62 | path: ${{ runner.temp }}/package |
| 63 | + |
0 commit comments