-
Notifications
You must be signed in to change notification settings - Fork 36
201 lines (176 loc) · 5.25 KB
/
release-lib.yaml
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
name: release-lib
on:
push:
tags:
- "lib-v*"
pull_request:
branches:
- main
paths:
- .github/workflows/release-lib.yaml
- src/rust/**
- src/Makevars*
- tools/**
- "!tools/lib-sums.tsv"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
LIB_NAME: libr_polars
RPOLARS_FULL_FEATURES: "true"
RPOLARS_PROFILE: release-optimized
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
- os: ubuntu-22.04
target: aarch64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-gnu
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: prep Rust
working-directory: src/rust
run: |
LIB_VERSION="$(cargo metadata --format-version=1 --no-deps | jq --raw-output '.packages[0].version')"
echo "LIB_VERSION=${LIB_VERSION}" >>"$GITHUB_ENV"
- uses: ./.github/actions/setup
with:
rust-nightly: "true"
target: "${{ matrix.target }}"
- name: Set for arm64 Linux
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
echo 'CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc' >>"$GITHUB_ENV"
- name: build lib
env:
NOT_CRAN: "true"
TARGET: ${{ matrix.target }}
RPOLARS_PROFILE: ${{ env.RPOLARS_PROFILE }}
LIBR_POLARS_BUILD: "true"
working-directory: src
run: |
LIB_PATH="$(pwd)/rust/target/${TARGET}/${RPOLARS_PROFILE}/${LIB_NAME}.a"
ARTIFACT_NAME="${LIB_NAME}-${LIB_VERSION}-${TARGET}.tar.gz"
if [[ ${{ runner.os }} == 'Windows' ]]; then
pushd ..
Rscript -e 'install.packages("pkgbuild", repos = "https://cloud.r-project.org")'
Rscript -e 'pkgbuild::compile_dll()' # Linker of Rtools is needed here.
popd
else
make -f Makevars.in "${LIB_PATH}"
fi
tar -czf "../${ARTIFACT_NAME}" -C "rust/target/${TARGET}/${RPOLARS_PROFILE}" "${LIB_NAME}.a"
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >>"$GITHUB_ENV"
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: libs
path: ${{ env.ARTIFACT_NAME }}
test:
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- windows-latest
- ubuntu-latest
r:
- oldrel-1
- release
- devel
exclude:
- os: macos-latest
r: devel
- os: macos-latest
r: oldrel-1
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: libs
path: libs
- name: prep Rust
working-directory: src/rust
run: |
LIB_VERSION="$(cargo metadata --format-version=1 --no-deps | jq --raw-output '.packages[0].version')"
echo "LIB_VERSION=${LIB_VERSION}" >>"$GITHUB_ENV"
if [[ "${{ runner.os }}" == "Windows" ]]; then
echo "LIB_TARGET=x86_64-pc-windows-gnu" >>"$GITHUB_ENV"
else
echo "LIB_TARGET=$(rustc -vV | grep host | cut -d' ' -f2)" >>"$GITHUB_ENV"
fi
rm "$(rustup which cargo)"
- name: prep lib
run: |
ARTIFACT_NAME="${LIB_NAME}-${LIB_VERSION}-${LIB_TARGET}.tar.gz"
mkdir -p tools
tar -xzf "libs/${ARTIFACT_NAME}" -C "tools"
rm -rf libs tools/lib-sums.tsv
echo "LIBR_POLARS_PATH=$(pwd)/tools/${LIB_NAME}.a" >>"$GITHUB_ENV"
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r }}
use-public-rspm: true
Ncpus: "2"
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::devtools
needs: check
- name: R test
shell: Rscript {0}
env:
NOT_CRAN: "true"
run: |
devtools::install_local(force = TRUE)
testthat::test_dir("tests")
release:
needs:
- build
- test
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: libs
path: libs
- name: create checksums
working-directory: libs
run: |
sha256sum * >"../sha256sums.txt"
md5sum * >"../md5sums.txt"
- name: create release
uses: softprops/action-gh-release@v1
with:
prerelease: true
files: |
libs/*
sha256sums.txt
md5sums.txt