feat!: based on prql-compiler 0.10.0 #52
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release-lib | |
on: | |
push: | |
tags: | |
- "lib-v*" | |
pull_request: | |
branches: | |
- main | |
paths: | |
- .github/workflows/release-lib.yml | |
- src/rust/** | |
- src/Makevars* | |
- tools/** | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
env: | |
LIB_NAME: libprqlr | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
- 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" | |
rustup target add ${{ matrix.target }} | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: "src/rust -> target" | |
shared-key: ${{ matrix.target }} | |
- name: prep for musl | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y musl-tools | |
- name: prep for arm64 Linux | |
if: matrix.target == 'aarch64-unknown-linux-musl' | |
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" | |
echo 'CC=aarch64-linux-gnu-gcc' >>"$GITHUB_ENV" | |
- name: build lib | |
env: | |
NOT_CRAN: "true" | |
TARGET: ${{ matrix.target }} | |
PRQLR_PROFILE: release | |
working-directory: src | |
run: | | |
LIB_PATH="$(pwd)/rust/target/${TARGET}/${PRQLR_PROFILE}/${LIB_NAME}.a" | |
ARTIFACT_NAME="${LIB_NAME}-${LIB_VERSION}-${TARGET}.tar.gz" | |
make -f Makevars${{ runner.os == 'Windows' && '.win' || '.in' }} "${LIB_PATH}" | |
tar -czf "../${ARTIFACT_NAME}" -C "rust/target/${TARGET}/${PRQLR_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" | |
elif [[ "${{ runner.os }}" == "Linux" ]]; then | |
echo "LIB_TARGET=x86_64-unknown-linux-musl" >>"$GITHUB_ENV" | |
else | |
echo "LIB_TARGET=x86_64-apple-darwin" >>"$GITHUB_ENV" | |
fi | |
rm "$(rustup which cargo)" | |
- name: prep lib | |
run: | | |
ARTIFACT_NAME="${LIB_NAME}-${LIB_VERSION}-${LIB_TARGET}.tar.gz" | |
tar -xzf "libs/${ARTIFACT_NAME}" -C "tools" | |
rm -rf "libs" | |
- 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::rcmdcheck, any::devtools | |
needs: check | |
- name: R test | |
shell: Rscript {0} | |
run: | | |
devtools::load_all() | |
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 |