Skip to content

Commit 10e7dc1

Browse files
committed
ci: Format with air, check detritus, better handling of extra-packages
1 parent b9cb799 commit 10e7dc1

File tree

4 files changed

+21
-57
lines changed

4 files changed

+21
-57
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ jobs:
250250
fail-fast: false
251251
matrix: ${{fromJson(needs.rcc-smoke.outputs.versions-matrix)}}
252252

253+
timeout-minutes: 240
254+
253255
steps:
254256
- uses: actions/checkout@v4
255257
with:
@@ -289,6 +291,7 @@ jobs:
289291
results: ${{ runner.os }}-r${{ matrix.r }}
290292

291293
- uses: ./.github/workflows/covr
294+
timeout-minutes: 240
292295
if: ${{ matrix.covr }}
293296
with:
294297
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/covr/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: "Actions to run covr for an R package"
2+
description: "Run covr to check code coverage for an R package and upload results to Codecov."
23
inputs:
34
token:
45
description: codecov token

.github/workflows/install/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ runs:
9595
- id: get-extra
9696
run: |
9797
set -x
98-
packages=$( ( grep Config/gha/extra-packages DESCRIPTION || true ) | cut -d " " -f 2)
98+
packages=$( ( grep Config/gha/extra-packages DESCRIPTION || true ) | cut -d " " -f 2-)
9999
echo packages=$packages >> $GITHUB_OUTPUT
100100
shell: bash
101101

@@ -106,7 +106,7 @@ runs:
106106
pak-version: stable
107107
needs: ${{ inputs.needs }}
108108
packages: ${{ inputs.packages }}
109-
extra-packages: ${{ inputs.extra-packages }} ${{ ( matrix.covr && 'covr xml2' ) || '' }} ${{ steps.get-extra.outputs.packages }}
109+
extra-packages: ${{ inputs.extra-packages }} ${{ ( matrix.covr && 'r-lib/covr#611 xml2' ) || '' }} ${{ steps.get-extra.outputs.packages }}
110110
cache-version: ${{ inputs.cache-version }}
111111

112112
- name: Add pkg.lock to .gitignore

.github/workflows/style/action.yml

Lines changed: 15 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3,69 +3,29 @@ name: "Action to auto-style a package"
33
runs:
44
using: "composite"
55
steps:
6-
- name: Check styler options
6+
- name: Check air.toml
77
id: check
88
run: |
99
set -x
10-
scope=$( ( grep Config/autostyle/scope DESCRIPTION || true ) | cut -d " " -f 2)
11-
strict=$( ( grep Config/autostyle/strict DESCRIPTION || true ) | cut -d " " -f 2)
12-
rmd=$( ( grep Config/autostyle/rmd DESCRIPTION || true ) | cut -d " " -f 2)
13-
echo scope=$scope >> $GITHUB_OUTPUT
14-
echo strict=$strict >> $GITHUB_OUTPUT
15-
echo rmd=$rmd >> $GITHUB_OUTPUT
10+
if [ -f air.toml ]; then
11+
echo enabled=true >> $GITHUB_OUTPUT
12+
else
13+
echo enabled=false >> $GITHUB_OUTPUT
14+
fi
1615
shell: bash
1716

18-
- uses: actions/cache@v4
19-
if: ${{ steps.check.outputs.scope }}
20-
with:
21-
path: |
22-
~/.cache/R/R.cache
23-
key: ${{ runner.os }}-2-${{ github.run_id }}-
24-
restore-keys: |
25-
${{ runner.os }}-2-
17+
- name: Install air
18+
if: ${{ steps.check.outputs.enabled == 'true' }}
19+
uses: posit-dev/setup-air@v1
2620

27-
- name: Imprint run ID
28-
if: ${{ steps.check.outputs.scope }}
21+
- name: Run air
22+
if: ${{ steps.check.outputs.enabled == 'true' }}
2923
run: |
30-
mkdir -p ~/.cache/R/R.cache/styler
31-
touch ~/.cache/R/R.cache/${{ github.run_id }}
24+
air format .
3225
shell: bash
3326

34-
- name: Show cache
35-
if: ${{ steps.check.outputs.scope }}
27+
- name: Check Git status
28+
if: ${{ steps.check.outputs.enabled == 'true' }}
3629
run: |
37-
ls -l ~/.cache/R/R.cache
38-
ls -l ~/.cache/R/R.cache/styler
39-
shell: bash
40-
41-
- name: Enable styler cache
42-
if: ${{ steps.check.outputs.scope }}
43-
run: |
44-
styler::cache_activate(verbose = TRUE)
45-
shell: Rscript {0}
46-
47-
- name: Run styler
48-
if: ${{ steps.check.outputs.scope }}
49-
run: |
50-
strict <- as.logical("${{ steps.check.outputs.strict }}")
51-
if (is.na(strict)) {
52-
strict <- FALSE
53-
}
54-
rmd <- as.logical("${{ steps.check.outputs.rmd }}")
55-
if (is.na(rmd)) {
56-
rmd <- TRUE
57-
}
58-
styler::style_pkg(
59-
scope = "${{ steps.check.outputs.scope }}",
60-
strict = strict,
61-
filetype = c("R", "Rprofile", if (rmd) c("Rmd", "Rmarkdown", "Rnw", "Qmd"))
62-
)
63-
shell: Rscript {0}
64-
65-
- name: Show cache again
66-
if: ${{ steps.check.outputs.scope }}
67-
run: |
68-
ls -l ~/.cache/R/R.cache
69-
ls -l ~/.cache/R/R.cache/styler
70-
gdu -s --inodes ~/.cache/R/R.cache/styler/* || du -s --inodes ~/.cache/R/R.cache/styler/*
30+
git status
7131
shell: bash

0 commit comments

Comments
 (0)