Skip to content

Commit b31e04f

Browse files
committed
Try r-universe
1 parent fe6ac09 commit b31e04f

File tree

1 file changed

+114
-1
lines changed

1 file changed

+114
-1
lines changed

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

Lines changed: 114 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,116 @@ 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: "Get dependencies"
153+
id: deps
154+
uses: r-universe-org/actions/macos-deps@v11
155+
timeout-minutes: 60
156+
env:
157+
GITHUB_PAT: {{ "${{ secrets.GITHUB_TOKEN }}" }}
158+
with:
159+
sourcepkg: {{ "${{ needs.r-universe-source.outputs.sourcepkg }}" }}
160+
161+
- name: Build package "{{ "${{ needs.r-universe-source.outputs.package }}" }}"
162+
uses: r-universe-org/actions/macos-build@v11
163+
timeout-minutes: 90
164+
env:
165+
GITHUB_PAT: {{ "${{ secrets.GITHUB_TOKEN }}" }}
166+
# Override r-universe default to build from source instead of using binaries
167+
LIBARROW_BINARY: "false"
168+
MY_UNIVERSE: ""
169+
with:
170+
sourcepkg: {{ "${{ needs.r-universe-source.outputs.sourcepkg }}" }}
171+
172+
- name: "R CMD check"
173+
uses: r-universe-org/actions/macos-check@v11
174+
id: check
175+
timeout-minutes: 60
176+
env:
177+
GITHUB_PAT: {{ "${{ secrets.GITHUB_TOKEN }}" }}
178+
with:
179+
sourcepkg: {{ "${{ needs.r-universe-source.outputs.sourcepkg }}" }}
180+
181+
- name: "Store binaries"
182+
id: artifact
183+
uses: r-universe-org/actions/store-package@v11
184+
if: {{ "${{ always() && steps.check.outputs.binarypkg }}" }}
185+
with:
186+
name: package-macos-{{ "${{ matrix.r }}" }}-{{ "${{ matrix.arch }}" }}
187+
JOB_STATUS: {{ "${{ job.status }}" }}
188+
DISTRO: macos
189+
FILE: {{ "${{ steps.check.outputs.binarypkg }}" }}
190+
CHECKSTATUS: {{ "${{ steps.check.outputs.checkstatus }}" }}
191+
TARGET: macos
192+
193+
- name: "Summary: macos-${{ "${{ matrix.r }}" }}-${{ "${{ matrix.arch }}" }}: ${{ "${{ steps.deps.outputs.rversion }}" }}: ${{ "${{ steps.check.outputs.checkstatus || 'FAIL' }}" }}"
194+
run: echo "Artifact URL ${{ "${{ steps.artifact.outputs.artifact-url }}" }}"
195+
if: always()

0 commit comments

Comments
 (0)