Starting to implement FEATURES_PRIMITIVE_INDEX (still to check draw_i… #769
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: "Rust" | |
on: | |
push: | |
branches: [ master, instancing_rework ] | |
tags: | |
- 'v*.*.*' | |
pull_request: | |
branches: [ master, instancing_rework ] | |
tags: | |
- 'v*.*.*' | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_TARGET_DIR: ./crates/target | |
RUSTFLAGS: '--cfg=web_sys_unstable_apis' # required for webgpu | |
jobs: | |
check: | |
name: "Build on OS: ${{ matrix.os }}" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- windows-latest | |
#- macOS-latest | |
#- ubuntu-latest | |
steps: | |
- name: "Add rustflags to env" | |
run: echo RUSTFLAGS=${RUSTFLAGS} >> $GITHUB_ENV | |
- name: "Checkout repository and submodules" | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: "Install LLVM and Clang" # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797 | |
uses: KyleMayes/install-llvm-action@v2 | |
if: ${{ matrix.os }} == 'windows-latest' | |
with: | |
version: "13.0" | |
directory: ${{ runner.temp }}/llvm | |
- name: "Set LIBCLANG_PATH" | |
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV | |
if: ${{ matrix.os }} == 'windows-latest' | |
- name: "Creating folders" | |
run: | | |
mkdir -p "./crates/target/" | |
mkdir -p "./output/" | |
mkdir -p "./output/web/" | |
mkdir -p "./output/INOX/" | |
mkdir -p "./output/INOX/bin/" | |
mkdir -p "./output/INOX/bin/data_raw/" | |
- name: "Enable use of cache" | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
./crates/target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: "Install stable toolchain" | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: default | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
- name: "Add rust target wasm32" | |
run: rustup target add wasm32-unknown-unknown | |
- name: "Update repos" | |
run: | | |
cd crates | |
cargo update | |
cd .. | |
- name: "Run cargo clippy check" | |
uses: actions-rs/cargo@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
command: clippy | |
args: --manifest-path ./crates/Cargo.toml --no-deps -- -D warnings | |
- name: "Run cargo build workspace release" | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --manifest-path ./crates/Cargo.toml --release | |
- name: "Copy and rename inox_blender dll into pyd" | |
run: cp -Force ./crates/target/release/inox_blender.dll ./crates/blender/inox_blender/INOX/inox_blender.pyd | |
- name: "Copy inox_blender in INOX" | |
run: cp -r -Force "./crates/blender/inox_blender/INOX/" "./output/" | |
- name: "Copy inox_viewer configs in output" | |
run: | | |
mkdir -p "./output/INOX/bin/data_raw/config/" | |
mkdir -p "./output/INOX/bin/data_raw/config/inox_viewer/" | |
cp -r -Force "./data_raw/config/inox_viewer/" "./output/INOX/bin/data_raw/config/" | |
- name: "Copy pipelines in output" | |
run: | | |
mkdir -p "./output/INOX/bin/data_raw/pipelines/" | |
cp -r -Force "./data_raw/pipelines/" "./output/INOX/bin/data_raw/" | |
- name: "Copy shaders in output" | |
run: | | |
mkdir -p "./output/INOX/bin/data_raw/shaders/" | |
cp -r -Force "./data_raw/shaders/" "./output/INOX/bin/data_raw/" | |
- name: "Copy .dll in output" | |
run: cp -Force ./crates/target/release/*.dll ./output/INOX/bin/ | |
- name: "Copy .exes in output" | |
run: cp -Force ./crates/target/release/*.exe ./output/INOX/bin/ | |
- name: "Run cargo build workspace release wasm32" | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --manifest-path ./crates/Cargo.toml --release --target wasm32-unknown-unknown | |
- name: "Install wasm bindgen" | |
run: cargo install -f wasm-bindgen-cli | |
- name: "Run wasm bindgen" | |
run: wasm-bindgen ./crates/target/wasm32-unknown-unknown/release/inox_launcher.wasm --out-dir ./output/web/ --target web --no-typescript --no-demangle --keep-lld-exports --split-linked-modules | |
- name: "Copy wasm in web" | |
run: cp -Force "./crates/target/wasm32-unknown-unknown/release/inox_launcher.wasm" "./output/web/inox_launcher.wasm" | |
- name: "Copy wasm32 in output" | |
run: cp -Force "./web/*.html" "./output/web/" | |
- name: "Clearing data folder" | |
continue-on-error: true | |
run: | | |
rm -r "./data/" | |
rm -r "./output/web/data/" | |
- name: "Executing binarizer" | |
run: ./crates/target/release/inox_launcher.exe -plugin inox_binarizer -platform pc -platform web | |
- name: "Copy data binarized in output for wasm" | |
run: | | |
mkdir -p "./output/web/data/" | |
mkdir -p "./output/web/data/web/" | |
cp -r -Force "./data/web/" "./output/web/data/" | |
- name: "Upload artifacts" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: output-binaries | |
path: output/ |