Skip to content

Commit 1c495a5

Browse files
committed
Try r-universe
1 parent 3ab7e5d commit 1c495a5

File tree

1 file changed

+168
-1
lines changed

1 file changed

+168
-1
lines changed

dev/tasks/r/github.macos.cran.yml

Lines changed: 168 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
jobs:
2323
macos-cran:
2424
name: "macOS similar to CRAN"
25-
runs-on: macOS-14
25+
runs-on: macOS-latest
2626
strategy:
2727
fail-fast: false
2828

@@ -80,3 +80,170 @@ jobs:
8080
name: test-output
8181
path: arrow-tests/testthat.Rout*
8282
if: always()
83+
84+
85+
# R-universe style build and check (macOS only)
86+
# Adapted from https://github.com/r-universe-org/workflows/blob/v3/.github/workflows/build.yml
87+
r-universe-source:
88+
name: "R-universe: Build source package"
89+
runs-on: ubuntu-latest
90+
timeout-minutes: 90
91+
outputs:
92+
sourcepkg: {{ "${{ steps.build.outputs.sourcepkg }}" }}
93+
package: {{ "${{ steps.build.outputs.package }}" }}
94+
version: {{ "${{ steps.build.outputs.version }}" }}
95+
steps:
96+
{{ macros.github_checkout_arrow()|indent }}
97+
98+
- name: Setup R
99+
uses: r-lib/actions/setup-r@v2
100+
with:
101+
use-public-rspm: true
102+
103+
- name: Build source package
104+
id: build
105+
run: |
106+
cd arrow/r
107+
PACKAGE=$(grep '^Package:' DESCRIPTION | cut -d' ' -f2)
108+
VERSION=$(grep '^Version:' DESCRIPTION | cut -d' ' -f2)
109+
echo "package=${PACKAGE}" >> $GITHUB_OUTPUT
110+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
111+
# sync-cpp copies C++ source, NOTICE.txt, LICENSE.txt, .env into tools/
112+
make clean
113+
make sync-cpp
114+
R CMD build .
115+
SOURCEPKG="${PACKAGE}_${VERSION}.tar.gz"
116+
echo "sourcepkg=${SOURCEPKG}" >> $GITHUB_OUTPUT
117+
118+
- name: Upload source package
119+
uses: actions/upload-artifact@v4
120+
with:
121+
name: package-source
122+
path: arrow/r/{{ "${{ steps.build.outputs.sourcepkg }}" }}
123+
124+
r-universe-macos:
125+
needs: [r-universe-source]
126+
if: {{ "${{ !cancelled() && needs.r-universe-source.outputs.sourcepkg }}" }}
127+
runs-on: macos-{{ "${{ matrix.arch == 'x86_64' && '15-intel' || '15' }}" }}
128+
timeout-minutes: 120
129+
name: "R-universe: R-{{ "${{ matrix.r }}" }} macOS ${{ "${{ matrix.arch }}" }}"
130+
strategy:
131+
fail-fast: false
132+
matrix:
133+
r: [ 'devel', 'release' ]
134+
arch: [ 'x86_64', 'arm64' ]
135+
steps:
136+
# r-universe actions internally download 'package-source' artifact
137+
138+
- name: "Prepare macOS system"
139+
timeout-minutes: 10
140+
uses: r-universe-org/actions/macos-prep@v11
141+
with:
142+
version: {{ "${{ matrix.r }}" }}
143+
fortran: 'true'
144+
145+
- name: Install R-{{ "${{ matrix.r }}" }} for macOS
146+
timeout-minutes: 10
147+
uses: r-universe-org/actions/setup-r@v11
148+
id: install-r
149+
with:
150+
r-version: {{ "${{ matrix.r }}" }}
151+
152+
- name: Install ICU for boost_locale
153+
run: |
154+
# Download and install ICU from R macOS recipes
155+
# ICU is needed for bundled Boost's locale component
156+
ARCH=$(uname -m)
157+
if [ "$ARCH" = "arm64" ]; then
158+
# Try darwin23 first (macOS 14+), then darwin20 (macOS 11+)
159+
ICU_URL="https://mac.r-project.org/bin/darwin23/arm64/icu-71.1-darwin.23-arm64.tar.xz"
160+
FALLBACK_URL="https://mac.r-project.org/bin/darwin20/arm64/icu-71.1-darwin.20-arm64.tar.xz"
161+
else
162+
# x86_64 only available on darwin20
163+
ICU_URL="https://mac.r-project.org/bin/darwin20/x86_64/icu-71.1-darwin.20-x86_64.tar.xz"
164+
FALLBACK_URL=""
165+
fi
166+
echo "Downloading ICU from: $ICU_URL"
167+
curl -fsSL "$ICU_URL" -o /tmp/icu.tar.xz || {
168+
if [ -n "$FALLBACK_URL" ]; then
169+
echo "Failed, trying fallback: $FALLBACK_URL"
170+
curl -fsSL "$FALLBACK_URL" -o /tmp/icu.tar.xz
171+
else
172+
echo "ICU download failed and no fallback available"
173+
exit 1
174+
fi
175+
}
176+
sudo tar -xf /tmp/icu.tar.xz -C /
177+
echo "ICU installed. Checking for headers:"
178+
ls -la /opt/R/${ARCH}/include/unicode/ | head -10 || echo "Headers not in /opt/R/${ARCH}/include/unicode/"
179+
# Verify ucnv.h specifically exists
180+
if [ -f "/opt/R/${ARCH}/include/unicode/ucnv.h" ]; then
181+
echo "✓ Found ucnv.h at /opt/R/${ARCH}/include/unicode/ucnv.h"
182+
else
183+
echo "✗ ucnv.h NOT found - listing what we have:"
184+
find /opt/R/${ARCH} -name "*.h" -path "*unicode*" 2>/dev/null | head -20
185+
fi
186+
187+
- name: "Get dependencies"
188+
id: deps
189+
uses: r-universe-org/actions/macos-deps@v11
190+
timeout-minutes: 60
191+
env:
192+
GITHUB_PAT: {{ "${{ secrets.GITHUB_TOKEN }}" }}
193+
with:
194+
sourcepkg: {{ "${{ needs.r-universe-source.outputs.sourcepkg }}" }}
195+
196+
- name: Install MacOSX 11.3 SDK
197+
run: |
198+
curl -fsSL https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz -o /tmp/MacOSX11.3.sdk.tar.xz
199+
sudo tar -xf /tmp/MacOSX11.3.sdk.tar.xz -C /Library/Developer/CommandLineTools/SDKs/
200+
echo "Installed MacOSX11.3.sdk to /Library/Developer/CommandLineTools/SDKs/"
201+
ls -la /Library/Developer/CommandLineTools/SDKs/
202+
203+
- name: Patch r-universe check.Renviron to build from source
204+
run: |
205+
# Build Arrow C++ from source instead of downloading binaries
206+
# Find the check.Renviron file in the downloaded actions
207+
RENVIRON_FILE=$(find /Users/runner/work -name "check.Renviron" -path "*r-universe-org*" 2>/dev/null | head -1)
208+
echo "Found check.Renviron at: $RENVIRON_FILE"
209+
sed -i '' 's/LIBARROW_BINARY=true/LIBARROW_BINARY=false/g' "$RENVIRON_FILE"
210+
# Add ICU_ROOT to cmake flags so Boost finds our ICU instead of Xcode's incomplete SDK ICU
211+
ARCH=$(uname -m)
212+
echo "EXTRA_CMAKE_FLAGS=-DICU_ROOT=/opt/R/${ARCH}" >> "$RENVIRON_FILE"
213+
# Use MacOSX 11.3 SDK to match older CRAN build environment
214+
echo "SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk" >> "$RENVIRON_FILE"
215+
echo "Patched contents:"
216+
cat "$RENVIRON_FILE"
217+
218+
- name: Build package "{{ "${{ needs.r-universe-source.outputs.package }}" }}"
219+
uses: r-universe-org/actions/macos-build@v11
220+
timeout-minutes: 90
221+
env:
222+
GITHUB_PAT: {{ "${{ secrets.GITHUB_TOKEN }}" }}
223+
with:
224+
sourcepkg: {{ "${{ needs.r-universe-source.outputs.sourcepkg }}" }}
225+
226+
- name: "R CMD check"
227+
uses: r-universe-org/actions/macos-check@v11
228+
id: check
229+
timeout-minutes: 60
230+
env:
231+
GITHUB_PAT: {{ "${{ secrets.GITHUB_TOKEN }}" }}
232+
with:
233+
sourcepkg: {{ "${{ needs.r-universe-source.outputs.sourcepkg }}" }}
234+
235+
- name: "Store binaries"
236+
id: artifact
237+
uses: r-universe-org/actions/store-package@v11
238+
if: {{ "${{ always() && steps.check.outputs.binarypkg }}" }}
239+
with:
240+
name: package-macos-{{ "${{ matrix.r }}" }}-{{ "${{ matrix.arch }}" }}
241+
JOB_STATUS: {{ "${{ job.status }}" }}
242+
DISTRO: macos
243+
FILE: {{ "${{ steps.check.outputs.binarypkg }}" }}
244+
CHECKSTATUS: {{ "${{ steps.check.outputs.checkstatus }}" }}
245+
TARGET: macos
246+
247+
- name: "Summary: macos-${{ "${{ matrix.r }}" }}-${{ "${{ matrix.arch }}" }}: ${{ "${{ steps.deps.outputs.rversion }}" }}: ${{ "${{ steps.check.outputs.checkstatus || 'FAIL' }}" }}"
248+
run: echo "Artifact URL ${{ "${{ steps.artifact.outputs.artifact-url }}" }}"
249+
if: always()

0 commit comments

Comments
 (0)