Skip to content

Commit

Permalink
ci: build lib before build package
Browse files Browse the repository at this point in the history
  • Loading branch information
eitsupi committed Oct 28, 2023
1 parent 535c6b0 commit 6cb10d5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
15 changes: 13 additions & 2 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,20 @@ runs:
run: |
echo "RPOLARS_PROFILE=release" >>"$GITHUB_ENV"
- name: Find default target
id: find-target
if: inputs.target == ''
shell: bash
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
TARGET=x86_64-pc-windows-gnu
else
TARGET=$(rustc -vV | grep host | cut -d' ' -f2)
fi
echo "target=${TARGET}" >>"$GITHUB_OUTPUT"
- name: Cache Rust
if: inputs.target != ''
uses: Swatinem/rust-cache@v2
with:
shared-key: build-${{ env.RPOLARS_PROFILE }}-${{ inputs.target }}
shared-key: build-${{ env.RPOLARS_PROFILE }}-${{ inputs.target || steps.find-target.outputs.target }}
workspaces: "src/rust -> target"
15 changes: 12 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release', rtools-version: ""}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: macos-latest, r: 'release', target: 'x86_64-apple-darwin'}
- {os: macos-latest, r: 'release', target: 'aarch64-apple-darwin'}
Expand Down Expand Up @@ -74,17 +74,26 @@ jobs:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true
rtools-version: ${{ matrix.config.rtools-version }}
Ncpus: 2

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: dev
pak-version: devel
env:
CI: false

- name: Build lib
if: matrix.config.target == ''
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
TARGET=x86_64-pc-windows-gnu
else
TARGET=$(rustc -vV | grep host | cut -d' ' -f2)
fi
Rscript -e 'pkgbuild::compile_dll()'
echo "LIBR_POLARS_PATH=$(pwd)/src/rust/target/${TARGET}/release/libr_polars.a" >>$GITHUB_ENV
- name: make binary R package + test on host arch
if: matrix.config.target == ''
run: |
Expand Down

0 comments on commit 6cb10d5

Please sign in to comment.