Skip to content

Commit 089bc7b

Browse files
committed
Try r-universe
1 parent fe6ac09 commit 089bc7b

File tree

1 file changed

+170
-1
lines changed

1 file changed

+170
-1
lines changed

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

Lines changed: 170 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,172 @@ 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+
197+
198+
- name: Install MacOSX 11.3 SDK
199+
run: |
200+
curl -fsSL https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz -o /tmp/MacOSX11.3.sdk.tar.xz
201+
sudo tar -xf /tmp/MacOSX11.3.sdk.tar.xz -C /Library/Developer/CommandLineTools/SDKs/
202+
echo "Installed MacOSX11.3.sdk to /Library/Developer/CommandLineTools/SDKs/"
203+
ls -la /Library/Developer/CommandLineTools/SDKs/
204+
205+
- name: Patch r-universe check.Renviron to build from source
206+
run: |
207+
# Build Arrow C++ from source instead of downloading binaries
208+
# Find the check.Renviron file in the downloaded actions
209+
RENVIRON_FILE=$(find /Users/runner/work -name "check.Renviron" -path "*r-universe-org*" 2>/dev/null | head -1)
210+
echo "Found check.Renviron at: $RENVIRON_FILE"
211+
sed -i '' 's/LIBARROW_BINARY=true/LIBARROW_BINARY=false/g' "$RENVIRON_FILE"
212+
# Add ICU_ROOT to cmake flags so Boost finds our ICU instead of Xcode's incomplete SDK ICU
213+
ARCH=$(uname -m)
214+
echo "EXTRA_CMAKE_FLAGS=-DICU_ROOT=/opt/R/${ARCH}" >> "$RENVIRON_FILE"
215+
# Use MacOSX 11.3 SDK to match older CRAN build environment
216+
echo "SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk" >> "$RENVIRON_FILE"
217+
echo "Patched contents:"
218+
cat "$RENVIRON_FILE"
219+
220+
- name: Build package "{{ "${{ needs.r-universe-source.outputs.package }}" }}"
221+
uses: r-universe-org/actions/macos-build@v11
222+
timeout-minutes: 90
223+
env:
224+
GITHUB_PAT: {{ "${{ secrets.GITHUB_TOKEN }}" }}
225+
with:
226+
sourcepkg: {{ "${{ needs.r-universe-source.outputs.sourcepkg }}" }}
227+
228+
- name: "R CMD check"
229+
uses: r-universe-org/actions/macos-check@v11
230+
id: check
231+
timeout-minutes: 60
232+
env:
233+
GITHUB_PAT: {{ "${{ secrets.GITHUB_TOKEN }}" }}
234+
with:
235+
sourcepkg: {{ "${{ needs.r-universe-source.outputs.sourcepkg }}" }}
236+
237+
- name: "Store binaries"
238+
id: artifact
239+
uses: r-universe-org/actions/store-package@v11
240+
if: {{ "${{ always() && steps.check.outputs.binarypkg }}" }}
241+
with:
242+
name: package-macos-{{ "${{ matrix.r }}" }}-{{ "${{ matrix.arch }}" }}
243+
JOB_STATUS: {{ "${{ job.status }}" }}
244+
DISTRO: macos
245+
FILE: {{ "${{ steps.check.outputs.binarypkg }}" }}
246+
CHECKSTATUS: {{ "${{ steps.check.outputs.checkstatus }}" }}
247+
TARGET: macos
248+
249+
- name: "Summary: macos-${{ "${{ matrix.r }}" }}-${{ "${{ matrix.arch }}" }}: ${{ "${{ steps.deps.outputs.rversion }}" }}: ${{ "${{ steps.check.outputs.checkstatus || 'FAIL' }}" }}"
250+
run: echo "Artifact URL ${{ "${{ steps.artifact.outputs.artifact-url }}" }}"
251+
if: always()

0 commit comments

Comments
 (0)