2023-05-10 13:38:23 +03:00
|
|
|
name: 'AFFiNE Rust build'
|
|
|
|
description: 'Rust build setup, including cache configuration'
|
|
|
|
inputs:
|
|
|
|
target:
|
|
|
|
description: 'Cargo target'
|
|
|
|
required: true
|
2023-06-19 12:38:26 +03:00
|
|
|
nx_token:
|
|
|
|
description: 'Nx Cloud access token'
|
|
|
|
required: false
|
2023-05-10 13:38:23 +03:00
|
|
|
|
|
|
|
runs:
|
|
|
|
using: 'composite'
|
|
|
|
steps:
|
|
|
|
- name: Setup Rust
|
|
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
targets: ${{ inputs.target }}
|
|
|
|
|
|
|
|
- name: Cache cargo
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry/index/
|
|
|
|
~/.cargo/registry/cache/
|
|
|
|
~/.cargo/git/db/
|
|
|
|
.cargo-cache
|
|
|
|
target/${{ inputs.target }}
|
|
|
|
key: stable-${{ inputs.target }}-cargo-cache
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
if: ${{ inputs.target != 'x86_64-unknown-linux-gnu' && inputs.target != 'aarch64-unknown-linux-gnu' }}
|
|
|
|
shell: bash
|
2023-06-17 12:49:07 +03:00
|
|
|
run: yarn nx build @affine/native --target ${{ inputs.target }}
|
2023-06-19 12:38:26 +03:00
|
|
|
env:
|
|
|
|
NX_CLOUD_ACCESS_TOKEN: ${{ inputs.nx_token }}
|
2023-05-10 13:38:23 +03:00
|
|
|
|
|
|
|
- name: Build
|
|
|
|
if: ${{ inputs.target == 'x86_64-unknown-linux-gnu' }}
|
|
|
|
uses: addnab/docker-run-action@v3
|
|
|
|
with:
|
|
|
|
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
|
2023-06-19 12:38:26 +03:00
|
|
|
options: --user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build -e NX_CLOUD_ACCESS_TOKEN=${{ inputs.nx_token }}
|
2023-06-07 09:52:19 +03:00
|
|
|
run: >-
|
|
|
|
export CC=x86_64-unknown-linux-gnu-gcc &&
|
|
|
|
export CC_x86_64_unknown_linux_gnu=x86_64-unknown-linux-gnu-gcc &&
|
2023-06-17 12:49:07 +03:00
|
|
|
yarn nx build @affine/native --target ${{ inputs.target }} &&
|
|
|
|
chmod -R 777 node_modules/.cache
|
2023-05-10 13:38:23 +03:00
|
|
|
|
|
|
|
- name: Build
|
|
|
|
if: ${{ inputs.target == 'aarch64-unknown-linux-gnu' }}
|
|
|
|
uses: addnab/docker-run-action@v3
|
|
|
|
with:
|
|
|
|
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
|
2023-06-19 12:38:26 +03:00
|
|
|
options: --user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build -e NX_CLOUD_ACCESS_TOKEN=${{ inputs.nx_token }}
|
2023-06-07 09:52:19 +03:00
|
|
|
run: >-
|
2023-06-17 12:49:07 +03:00
|
|
|
yarn nx build @affine/native --target ${{ inputs.target }}
|
2023-06-27 12:23:19 +03:00
|
|
|
chmod -R 777 node_modules/.cache
|