Skip to content

Commit 756fa4a

Browse files
committed
feat: include build matrix
1 parent 30f5782 commit 756fa4a

File tree

1 file changed

+97
-39
lines changed

1 file changed

+97
-39
lines changed

.github/workflows/test-release.yaml

Lines changed: 97 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ on:
99
type: string
1010

1111
jobs:
12-
release:
12+
build-src:
1313
runs-on: ubuntu-24.04
1414
permissions:
1515
contents: write
16-
pull-requests: write
16+
outputs:
17+
tarball_name: ${{ steps.releaser.outputs.tarball_name }}
1718

1819
steps:
1920
- name: Checkout repository
@@ -23,6 +24,8 @@ jobs:
2324

2425
- name: Setup R
2526
uses: r-lib/actions/setup-r@v2
27+
with:
28+
r-version: "4.5"
2629

2730
- name: Install the latest version of rv
2831
uses: a2-ai/setup-rv@main
@@ -35,7 +38,7 @@ jobs:
3538
run: |
3639
OUTPUT=$(rv library)
3740
echo "result=$OUTPUT" >> $GITHUB_OUTPUT
38-
echo $GITHUB_OUTPUT
41+
echo "Library path: $OUTPUT"
3942
4043
- name: Run R Releaser build-src
4144
id: releaser
@@ -51,54 +54,109 @@ jobs:
5154
"githubtag": "${{ github.event.inputs.tag }}"
5255
}
5356
54-
- name: echo output
55-
run: |
56-
echo ${{ steps.releaser.outputs.tarball_path }}
57-
echo ${{ steps.releaser.outputs.tarball_name }}
58-
59-
- name: Run R Releaser build-bin
60-
id: releaser-bin
61-
uses: A2-ai/r-releaser/build-bin@build-binary
62-
with:
63-
library: ${{ steps.library.outputs.result }}
64-
src_tarball_path: ${{ steps.releaser.outputs.tarball_path }}
65-
66-
- name: echo output
57+
- name: Echo source outputs
6758
run: |
68-
echo ${{ steps.releaser-bin.outputs.binary_path }}
69-
echo ${{ steps.releaser-bin.outputs.binary_name }}
70-
71-
# - name: create PACKAGE db
72-
# run: |
73-
# mkdir -p /tmp/repo/src/contrib
74-
# cp ${{steps.releaser.outputs.tarball_path}} /tmp/repo/src/contrib
75-
# cd /tmp/repo/src/contrib
76-
# Rscript -e 'tools::write_PACKAGES(validate = TRUE)'
59+
echo "${{ steps.releaser.outputs.tarball_path }}"
60+
echo "${{ steps.releaser.outputs.tarball_name }}"
7761
7862
- name: Upload src tarball to release
7963
uses: svenstaro/upload-release-action@v2
8064
with:
8165
repo_token: ${{ secrets.GITHUB_TOKEN }}
8266
file: ${{ steps.releaser.outputs.tarball_path }}
83-
# asset_name: src/contrib/${{ steps.releaser.outputs.tarball_name }}
8467
asset_name: ${{ steps.releaser.outputs.tarball_name }}
85-
8668
tag: ${{ github.event.inputs.tag }}
8769
overwrite: true
88-
# - name: Upload binaries to release
89-
# uses: svenstaro/upload-release-action@v2
90-
# with:
91-
# repo_token: ${{ secrets.GITHUB_TOKEN }}
92-
# file: /tmp/repo/src/contrib/PACKAGES
93-
# asset_name: src/contrib/PACKAGES
94-
# tag: ${{ github.event.inputs.tag }}
95-
96-
- name: Upload binaries to release
70+
71+
- name: Upload src tarball as artifact
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: source-tarball
75+
path: ${{ steps.releaser.outputs.tarball_path }}
76+
if-no-files-found: error
77+
78+
build-bin:
79+
name: build-bin (${{ matrix.platform }}, R ${{ matrix.r_version }})
80+
needs: build-src
81+
strategy:
82+
fail-fast: false
83+
matrix:
84+
include:
85+
- runner: '["ubuntu-22.04"]'
86+
r_version: "4.4"
87+
platform: "ubuntu-22.04-x86_64"
88+
- runner: '["ubuntu-22.04"]'
89+
r_version: "4.5"
90+
platform: "ubuntu-22.04-x86_64"
91+
- runner: '["ubuntu-24.04"]'
92+
r_version: "4.4"
93+
platform: "ubuntu-24.04-x86_64"
94+
- runner: '["ubuntu-24.04"]'
95+
r_version: "4.5"
96+
platform: "ubuntu-24.04-x86_64"
97+
# - runner: '["self-hosted", "macOS", "ARM64"]'
98+
# r_version: "4.4"
99+
# platform: "macos-arm64-selfhosted"
100+
# - runner: '["self-hosted", "macOS", "ARM64"]'
101+
# r_version: "4.5"
102+
# platform: "macos-arm64-selfhosted"
103+
runs-on: ${{ fromJson(matrix.runner) }}
104+
permissions:
105+
contents: write
106+
steps:
107+
- name: Checkout repository
108+
uses: actions/checkout@v4
109+
with:
110+
fetch-depth: 0
111+
112+
- name: Setup R (${{ matrix.r_version }})
113+
uses: r-lib/actions/setup-r@v2
114+
with:
115+
r-version: ${{ matrix.r_version }}
116+
117+
- name: Install the latest version of rv
118+
uses: a2-ai/setup-rv@main
119+
120+
- name: sync
121+
run: rv sync
122+
123+
- name: get library path
124+
id: library
125+
run: |
126+
OUTPUT=$(rv library)
127+
echo "result=$OUTPUT" >> $GITHUB_OUTPUT
128+
echo "Library path: $OUTPUT"
129+
130+
- name: Download source tarball artifact
131+
uses: actions/download-artifact@v4
132+
with:
133+
name: source-tarball
134+
path: dist-src
135+
136+
- name: Verify source tarball path
137+
id: src-tarball
138+
run: |
139+
SRC_PATH="$GITHUB_WORKSPACE/dist-src/${{ needs.build-src.outputs.tarball_name }}"
140+
test -f "$SRC_PATH"
141+
echo "path=$SRC_PATH" >> $GITHUB_OUTPUT
142+
143+
- name: Run R Releaser build-bin (${{ matrix.platform }}, R ${{ matrix.r_version }})
144+
id: releaser-bin
145+
uses: A2-ai/r-releaser/build-bin@build-binary
146+
with:
147+
library: ${{ steps.library.outputs.result }}
148+
src_tarball_path: ${{ steps.src-tarball.outputs.path }}
149+
150+
- name: Echo binary outputs
151+
run: |
152+
echo "${{ steps.releaser-bin.outputs.binary_path }}"
153+
echo "${{ steps.releaser-bin.outputs.binary_name }}"
154+
155+
- name: Upload binary to release (${{ matrix.platform }}, R ${{ matrix.r_version }})
97156
uses: svenstaro/upload-release-action@v2
98157
with:
99158
repo_token: ${{ secrets.GITHUB_TOKEN }}
100159
file: ${{ steps.releaser-bin.outputs.binary_path }}
101-
asset_name: ${{ steps.releaser-bin.outputs.binary_name }}
160+
asset_name: ${{ matrix.platform }}-r${{ matrix.r_version }}-${{ steps.releaser-bin.outputs.binary_name }}
102161
tag: ${{ github.event.inputs.tag }}
103-
overwrite: true
104-
162+
overwrite: true

0 commit comments

Comments
 (0)