Use constants instead of hard-coded function names. Also fix Rhai cas… #1261
Workflow file for this run
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: Build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| - fix | |
| pull_request: {} | |
| env: | |
| RUST_MSRV: 1.66.0 | |
| jobs: | |
| msrv: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin | |
| ~/.cargo/registry/index | |
| ~/.cargo/registry/cache | |
| ~/.cargo/git/db/ | |
| target | |
| key: "${{ runner.os }}-cargo-build-msrv-${{ hashFiles('**/Cargo.lock') }}" | |
| - run: cp Cargo.msrv.lock Cargo.lock | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: ${{ env.RUST_MSRV }} | |
| override: true | |
| - uses: actions-rs/cargo@v1 | |
| with: | |
| command: check | |
| args: "--features decimal,metadata,serde,debugging,grain" | |
| # typical build with various feature combinations | |
| build: | |
| name: Build | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: ${{ matrix.experimental }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest] | |
| flags: | |
| - "" | |
| - "--features testing-environ,grain" | |
| - "--features testing-environ,debugging" | |
| - "--features testing-environ,metadata" | |
| - "--features testing-environ,serde" | |
| - "--features testing-environ,decimal" | |
| - "--features testing-environ,no_float,decimal" | |
| - "--features testing-environ,unicode-xid-ident" | |
| - "--features testing-environ,internals" | |
| - "--features testing-environ,decimal,serde,metadata,internals,debugging,grain" | |
| - "--features testing-environ,unchecked,serde,metadata,internals,debugging,grain" | |
| - "--features testing-environ,sync,serde,metadata,internals,debugging,grain" | |
| - "--features testing-environ,no_position,serde,metadata,internals,debugging,grain" | |
| - "--features testing-environ,no_optimize,serde,metadata,internals,debugging,grain" | |
| - "--features testing-environ,no_float,serde,metadata,internals,debugging,grain" | |
| - "--features testing-environ,f32_float,serde,metadata,internals,debugging,grain" | |
| - "--features testing-environ,no_custom_syntax,serde,metadata,internals,debugging,grain" | |
| - "--tests --features testing-environ,only_i32,serde,metadata,internals,debugging,grain" | |
| - "--features testing-environ,only_i64,serde,metadata,internals,debugging,grain" | |
| - "--features testing-environ,no_index,serde,metadata,internals,debugging,grain" | |
| - "--features testing-environ,no_object,serde,metadata,internals,debugging,grain" | |
| - "--features testing-environ,no_function,serde,metadata,internals,debugging,grain" | |
| - "--features testing-environ,no_module,serde,metadata,internals,debugging,grain" | |
| - "--features testing-environ,no_time,serde,metadata,internals,debugging,grain" | |
| - "--features testing-environ,no_closure,serde,metadata,internals,debugging,grain" | |
| - "--features testing-environ,sync,no_time,no_function,no_float,no_position,no_optimize,no_module,no_closure,no_custom_syntax,metadata,serde,unchecked,debugging,grain" | |
| - "--features testing-environ,no_time,no_function,no_float,no_position,no_index,no_object,no_optimize,no_module,no_closure,no_custom_syntax,unchecked,grain" | |
| - "--tests --features testing-environ,f32_float,only_i32,serde,metadata,internals,debugging,grain" | |
| - "--tests --features testing-environ,no_float,only_i32,no_object,no_index,no_module,no_function,sync,grain" | |
| toolchain: [stable] | |
| experimental: [false] | |
| include: | |
| # smoke-tests for different toolchains | |
| - {toolchain: stable, os: windows-latest, experimental: false, flags: ""} | |
| - {toolchain: stable, os: macos-latest, experimental: false, flags: ""} | |
| - {toolchain: beta, os: ubuntu-latest, experimental: false, flags: "--features unstable"} | |
| - {toolchain: nightly, os: ubuntu-latest, experimental: true, flags: "--features unstable"} | |
| fail-fast: false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: ${{matrix.toolchain}} | |
| override: true | |
| - name: Test | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: test | |
| args: ${{matrix.flags}} | |
| # no-std builds are a bit more extensive to test | |
| no_std_build: | |
| name: NoStdBuild | |
| runs-on: ${{matrix.os}} | |
| continue-on-error: ${{matrix.experimental}} | |
| strategy: | |
| matrix: | |
| include: | |
| - {os: ubuntu-latest, flags: "--profile unix", experimental: false} | |
| - {os: windows-latest, flags: "--profile windows", experimental: true} | |
| - {os: macos-latest, flags: "--profile macos", experimental: false} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: nightly | |
| override: true | |
| - name: Build Project | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: build | |
| args: --manifest-path=no_std/no_std_test/Cargo.toml ${{matrix.flags}} | |
| wasm: | |
| name: Check Wasm build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| flags: | |
| - "--target wasm32-wasip1" | |
| # The `wasm32-unknown-unknown` target is not supported by default as it requires `wasm_js`. | |
| #- "--target wasm32-unknown-unknown" | |
| - "--target wasm32-unknown-unknown --features wasm-bindgen" | |
| - "--target wasm32-unknown-unknown --no-default-features --features std" | |
| - "--target wasm32-unknown-unknown --no-default-features --features std,wasm-bindgen" | |
| fail-fast: false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Generic Wasm Toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| target: wasm32-unknown-unknown | |
| - name: Setup Wasi Toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| target: wasm32-wasip1 | |
| - name: Build | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: build | |
| args: ${{matrix.flags}} | |
| rustfmt: | |
| name: Check Formatting | |
| runs-on: windows-latest | |
| continue-on-error: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: nightly | |
| override: true | |
| components: rustfmt, clippy | |
| - name: Run Rustfmt | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: fmt | |
| args: --all -- --check | |
| - name: Run Clippy | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: clippy | |
| args: --all -- -Aclippy::all -Dclippy::perf -Dclippy::correctness -Dclippy::suspicious | |
| codegen_build: | |
| name: Codegen Build | |
| runs-on: ${{matrix.os}} | |
| continue-on-error: ${{matrix.experimental}} | |
| strategy: | |
| matrix: | |
| include: | |
| - {toolchain: stable, os: ubuntu-latest, experimental: false, flags: "--features metadata"} | |
| - {toolchain: stable, os: windows-latest, experimental: false, flags: "--features metadata"} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: ${{matrix.toolchain}} | |
| override: true | |
| - name: Build Project | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: test | |
| args: --manifest-path=codegen/Cargo.toml ${{matrix.flags}} | |
| - name: Build Project | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: test | |
| args: --manifest-path=codegen/tests/custom_root/Cargo.toml ${{matrix.flags}} | |
| # Security audit: check dependencies for known CVEs | |
| audit: | |
| name: Security Audit | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install cargo-audit | |
| run: cargo install cargo-audit --locked | |
| - name: Run cargo audit | |
| run: cargo audit | |
| # Ensure all doc-comments compile cleanly with doc-relevant features | |
| doc: | |
| name: Check Documentation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| - name: Build docs | |
| uses: actions-rs/cargo@v1 | |
| env: | |
| RUSTDOCFLAGS: "-D warnings" | |
| with: | |
| command: doc | |
| args: --no-deps --features document-features,metadata,serde,internals,decimal,debugging | |
| # 32-bit Linux: catch pointer/size assumptions for embedded targets | |
| cross_32bit: | |
| name: Cross-compile 32-bit Linux | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| target: i686-unknown-linux-gnu | |
| - name: Install 32-bit libc | |
| run: sudo apt-get update && sudo apt-get install -y gcc-multilib | |
| - name: Build (32-bit) | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: build | |
| args: --target i686-unknown-linux-gnu --features testing-environ,serde,metadata,internals,debugging | |
| # ARM64 cross-compile: common deployment target for embedded Rhai | |
| cross_arm64: | |
| name: Cross-compile ARM64 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| target: aarch64-unknown-linux-gnu | |
| - name: Install cross-linker | |
| run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu | |
| - name: Build (ARM64) | |
| uses: actions-rs/cargo@v1 | |
| env: | |
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | |
| with: | |
| command: build | |
| args: --target aarch64-unknown-linux-gnu --features testing-environ,serde,metadata,internals,debugging | |
| miri: | |
| name: MIRI | |
| if: false | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: nightly | |
| override: true | |
| components: miri | |
| - name: Run MIRI | |
| env: | |
| MIRIFLAGS: "-Zmiri-strict-provenance" | |
| run: cargo miri test --features testing-environ -- --test-threads=1 |