-
-
Notifications
You must be signed in to change notification settings - Fork 130
146 lines (126 loc) · 5.66 KB
/
Copy pathr.yml
File metadata and controls
146 lines (126 loc) · 5.66 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: R Bindings CI
on:
push:
branches: [ main, develop ]
paths:
- 'r/**'
- 'src/**'
- 'include/pdf_oxide_c/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/r.yml'
pull_request:
branches: [ main, develop ]
paths:
- 'r/**'
- 'src/**'
- 'include/pdf_oxide_c/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/r.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name != 'release' }}
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
PDF_OXIDE_INCLUDE_DIR: ${{ github.workspace }}/include
PDF_OXIDE_LIB_DIR: ${{ github.workspace }}/target/release
jobs:
test:
name: R on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1
with:
cache: false
rustflags: ''
- name: Cache Cargo build
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
with:
path: target
key: ${{ runner.os }}-cargo-build-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-release-
- name: Build cdylib (release, shipped binding feature set)
run: cargo build --release --lib --features ocr,rendering,signatures,barcodes,tsa-client,system-fonts
- name: Set up R
uses: r-lib/actions/setup-r@d3c5be51b12e724e68f33216ca3c148b66d5f0b6 # v2
with:
r-version: 'release'
# Pull prebuilt Linux binaries from Posit Public Package Manager.
# Source installs of roxygen2/lintr/etc. were silently failing to
# compile on the runner, leaving them missing for later steps.
use-public-rspm: true
- name: Install R deps
# Fail hard if any package is missing after install (install.packages
# only warns on a failed install). Uses the RSPM binary repo configured
# above (no explicit repos= override, which would force source).
run: |
Rscript -e 'install.packages(c("tinytest", "lintr", "roxygen2", "rcmdcheck"))' \
-e 'pkgs <- c("tinytest","lintr","roxygen2","rcmdcheck")' \
-e 'miss <- pkgs[!pkgs %in% rownames(installed.packages())]' \
-e 'if (length(miss)) { cat("Failed to install:", miss, "\n"); quit(status=1) }'
- name: Generate man/ docs (roxygen2)
run: Rscript -e 'roxygen2::roxygenise("r")'
# NOTE: Air (Posit's Rust-based R formatter) is the 2026 SOTA R formatter
# and a planned follow-up; deferred here pending a SHA-pinned setup action.
- name: Lint (lintr)
run: Rscript -e 'library(lintr); l <- lint_dir("r/R"); print(l); quit(status = if (length(l) > 0) 1L else 0L)'
- name: R CMD check (no manual/vignettes)
shell: bash
run: |
export LD_LIBRARY_PATH="${PDF_OXIDE_LIB_DIR}:${LD_LIBRARY_PATH:-}"
export DYLD_LIBRARY_PATH="${PDF_OXIDE_LIB_DIR}:${DYLD_LIBRARY_PATH:-}"
Rscript -e 'rcmdcheck::rcmdcheck("r", args=c("--no-manual","--no-vignettes"), error_on="warning")'
- name: R CMD INSTALL
run: R CMD INSTALL r/
- name: Run tests (tinytest api-coverage)
shell: bash
run: |
export LD_LIBRARY_PATH="${PDF_OXIDE_LIB_DIR}:${LD_LIBRARY_PATH:-}"
export DYLD_LIBRARY_PATH="${PDF_OXIDE_LIB_DIR}:${DYLD_LIBRARY_PATH:-}"
Rscript -e 'library(tinytest); out <- test_package("pdfoxide"); print(out); if (any(!sapply(out, isTRUE))) quit(status=1)'
- name: Run example (basic_extraction, with assertion)
shell: bash
run: |
set -uo pipefail
export LD_LIBRARY_PATH="${PDF_OXIDE_LIB_DIR}:${LD_LIBRARY_PATH:-}"
export DYLD_LIBRARY_PATH="${PDF_OXIDE_LIB_DIR}:${DYLD_LIBRARY_PATH:-}"
OUT="$(Rscript r/inst/examples/basic_extraction.R)"
echo "$OUT"
echo "$OUT" | grep -q "Hello pdf_oxide" || { echo "::error::example output missing expected text"; exit 1; }
- name: Run example (html_extraction, with assertion)
shell: bash
run: |
set -uo pipefail
export LD_LIBRARY_PATH="${PDF_OXIDE_LIB_DIR}:${LD_LIBRARY_PATH:-}"
export DYLD_LIBRARY_PATH="${PDF_OXIDE_LIB_DIR}:${DYLD_LIBRARY_PATH:-}"
OUT="$(Rscript r/inst/examples/html_extraction.R)"
echo "$OUT"
echo "$OUT" | grep -q "HTML OK" || { echo "::error::html_extraction example did not pass"; exit 1; }
- name: Run example (words_geometry, with assertion)
shell: bash
run: |
set -uo pipefail
export LD_LIBRARY_PATH="${PDF_OXIDE_LIB_DIR}:${LD_LIBRARY_PATH:-}"
export DYLD_LIBRARY_PATH="${PDF_OXIDE_LIB_DIR}:${DYLD_LIBRARY_PATH:-}"
OUT="$(Rscript r/inst/examples/words_geometry.R)"
echo "$OUT"
echo "$OUT" | grep -q "WORDS OK" || { echo "::error::words_geometry example did not pass"; exit 1; }
- name: Run example (tables_extraction, with assertion)
shell: bash
run: |
set -uo pipefail
export LD_LIBRARY_PATH="${PDF_OXIDE_LIB_DIR}:${LD_LIBRARY_PATH:-}"
export DYLD_LIBRARY_PATH="${PDF_OXIDE_LIB_DIR}:${DYLD_LIBRARY_PATH:-}"
OUT="$(Rscript r/inst/examples/tables_extraction.R)"
echo "$OUT"
echo "$OUT" | grep -q "TABLES OK" || { echo "::error::tables_extraction example did not pass"; exit 1; }