fix: resolve CI/CD compiler targets and WASM linker issues #3
This file contains hidden or 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: CI Build and Test | |
| on: | |
| push: | |
| branches: [ trunk, main ] | |
| pull_request: | |
| branches: [ trunk, main ] | |
| jobs: | |
| test-rust: | |
| name: Rust Unit Tests | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Cache Rust Dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: plug.app/rt | |
| - name: Run Cargo Tests | |
| working-directory: plug.app/rt | |
| run: cargo test --target ${{ matrix.target }} | |
| build-windows: | |
| name: Build plug (Windows) | |
| runs-on: windows-latest | |
| needs: test-rust | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown, x86_64-pc-windows-msvc | |
| - name: Set up MSVC & Developer Command Prompt | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - name: Set up CMake & Ninja | |
| uses: lukka/get-cmake@latest | |
| - name: Build Rust Static Library | |
| working-directory: plug.app/rt | |
| run: cargo build --release --lib --target x86_64-pc-windows-msvc | |
| - name: Build WASM Plugins | |
| run: | | |
| mkdir plugins | |
| rustc --target wasm32-unknown-unknown --crate-type cdylib plug.app/rt/src_plugins/pTerm/pTerm.rs -o plugins/pTerm.wasm -C opt-level=z -C lto=true -C link-arg=--allow-undefined | |
| cp plug.app/rt/src_plugins/plugin.toml plugins/plugin.toml | |
| - name: Run CMake Configuration | |
| run: | | |
| cmake -G Ninja -S plug.cross/windows -B plug.cross/windows/build -DRUST_LIB_PATH=../../plug.app/rt/target/x86_64-pc-windows-msvc/release/tm_main.lib -DCMAKE_BUILD_TYPE=Release | |
| - name: Compile plug executable | |
| run: | | |
| cmake --build plug.cross/windows/build | |
| build-linux: | |
| name: Build plug (Linux) | |
| runs-on: ubuntu-latest | |
| needs: test-rust | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - name: Install GTK4 Dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgtk-4-dev pkg-config ninja-build libx11-dev | |
| - name: Build Rust Static Library | |
| working-directory: plug.app/rt | |
| run: cargo build --release --lib | |
| - name: Build WASM Plugins | |
| run: | | |
| mkdir plugins | |
| rustc --target wasm32-unknown-unknown --crate-type cdylib plug.app/rt/src_plugins/pTerm/pTerm.rs -o plugins/pTerm.wasm -C opt-level=z -C lto=true -C link-arg=--allow-undefined | |
| cp plug.app/rt/src_plugins/plugin.toml plugins/plugin.toml | |
| - name: Run CMake Configuration | |
| run: | | |
| cmake -G Ninja -S plug.cross/linux -B plug.cross/linux/build -DRUST_LIB_PATH=../../plug.app/rt/target/release/libtm_main.a -DCMAKE_BUILD_TYPE=Release | |
| - name: Compile plug executable | |
| run: | | |
| cmake --build plug.cross/linux/build |