mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-04 08:38:34 +00:00
52 lines
1.5 KiB
YAML
52 lines
1.5 KiB
YAML
name: 'AFFiNE Rust build'
|
|
description: 'Rust build setup, including cache configuration'
|
|
inputs:
|
|
target:
|
|
description: 'Cargo target'
|
|
required: true
|
|
package:
|
|
description: 'Package to build'
|
|
required: true
|
|
|
|
runs:
|
|
using: 'composite'
|
|
steps:
|
|
- name: Print rustup toolchain version
|
|
shell: bash
|
|
id: rustup-version
|
|
run: |
|
|
export RUST_TOOLCHAIN_VERSION="$(grep 'channel' rust-toolchain.toml | head -1 | awk -F '"' '{print $2}')"
|
|
echo "Rust toolchain version: $RUST_TOOLCHAIN_VERSION"
|
|
echo "RUST_TOOLCHAIN_VERSION=$RUST_TOOLCHAIN_VERSION" >> "$GITHUB_OUTPUT"
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
toolchain: '${{ steps.rustup-version.outputs.RUST_TOOLCHAIN_VERSION }}'
|
|
targets: ${{ inputs.target }}
|
|
env:
|
|
CARGO_INCREMENTAL: '1'
|
|
|
|
- name: Set CC
|
|
if: ${{ contains(inputs.target, 'linux') && inputs.package != '@affine/native' }}
|
|
shell: bash
|
|
run: |
|
|
echo "CC=clang" >> "$GITHUB_ENV"
|
|
echo "TARGET_CC=clang" >> "$GITHUB_ENV"
|
|
|
|
- name: Cache cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
~/.napi-rs
|
|
target/${{ inputs.target }}
|
|
key: stable-${{ inputs.target }}-cargo-cache
|
|
- name: Build
|
|
shell: bash
|
|
run: |
|
|
yarn workspace ${{ inputs.package }} build --target ${{ inputs.target }} --use-napi-cross
|
|
env:
|
|
DEBUG: 'napi:*'
|