Skip to content

Bump rust-polars to 0.41 #863

Bump rust-polars to 0.41

Bump rust-polars to 0.41 #863

Workflow file for this run

name: release-lib
on:
push:
tags:
- "lib-v*"
pull_request:
branches:
- main
paths:
- .github/actions/setup/action.yaml
- .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
LIBR_POLARS_FEATURES: "full_features"
LIBR_POLARS_PROFILE: release-optimized
permissions: read-all
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
- os: ubuntu-20.04
target: aarch64-unknown-linux-gnu
- os: macos-14
target: x86_64-apple-darwin
- os: macos-14
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 }}"
token: "${{ secrets.GITHUB_TOKEN }}"
- 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: Set for Windows
if: runner.os == 'Windows'
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
Ncpus: 2
- name: build lib
env:
NOT_CRAN: "true"
TARGET: ${{ matrix.target }}
LIBR_POLARS_PROFILE: ${{ env.LIBR_POLARS_PROFILE }}
LIBR_POLARS_BUILD: "true"
working-directory: src
run: |
LIB_PATH="$(pwd)/rust/target/${TARGET}/${LIBR_POLARS_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}/${LIBR_POLARS_PROFILE}" "${LIB_NAME}.a"
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >>"$GITHUB_ENV"
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: libs-${{ matrix.target }}
path: ${{ env.ARTIFACT_NAME }}
test:
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-12
- macos-14
- windows-latest
- ubuntu-latest
r:
- oldrel-1
- release
- devel
exclude:
- os: macos-12
r: devel
- os: macos-12
r: oldrel-1
- os: macos-14
r: devel
- os: macos-14
r: oldrel-1
- os: windows-latest
r: devel
permissions:
contents: read
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"
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)"
- uses: actions/download-artifact@v4
with:
name: libs-${{ env.LIB_TARGET }}
path: libs
- 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")
merge:
runs-on: ubuntu-latest
needs:
- build
- test
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: libs
pattern: libs-*
release:
needs:
- build
- test
- merge
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
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@v2
with:
prerelease: true
files: |
libs/*
sha256sums.txt
md5sums.txt