Fixes a lot of issues and upgrades to 3.4 #26
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, pull_request] | |
jobs: | |
build: | |
name: Build | |
strategy: | |
matrix: | |
os: [ubuntu, macos, windows] | |
runs-on: ${{ matrix.os }}-latest | |
env: | |
CARGO_TERM_VERBOSE: true # for better logs if something goes wrong | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true # for glfw submodule | |
- name: Install dependencies (Linux) | |
if: matrix.os == 'ubuntu' | |
run: | | |
sudo apt update | |
sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev libwayland-dev libxkbcommon-dev | |
# To check vulkan bindings. | |
- name: Prepare Vulkan SDK | |
uses: humbletim/[email protected] | |
with: | |
vulkan-query-version: latest | |
vulkan-components: Vulkan-Headers | |
vulkan-use-cache: true | |
- name: Source build with static link | |
shell: bash | |
run: cargo clean && cargo run -vv --example=version --features=src_build,static_link | |
- name: Source build with shared link | |
shell: bash | |
run: cargo clean && cargo run -vv --example=version --features=src_build | |
- name: Prebuilt libs with static link (Non-Linux) | |
shell: bash | |
# linux pre-built static libs are not provided, so, static linkign requires src_build. | |
if: matrix.os != 'ubuntu' | |
run: cargo clean && cargo run -vv --example=version --features=static_link,prebuilt_libs | |
- name: Prebuilt libs with shared link | |
shell: bash | |
if: matrix.os != 'ubuntu' | |
run: cargo clean && cargo run -vv --example=version --features=prebuilt_libs | |
# We delay this, because we don't want the previous steps to "accidentally" succeed | |
# by linking to system libraries (on linux). | |
- name: Install Glfw Packages (Linux) | |
if: matrix.os == 'ubuntu' | |
shell: bash | |
run: sudo apt install libglfw3-dev | |
- name: Install Glfw Packages (MacOs) | |
if: matrix.os == 'macos' | |
shell: bash | |
run: brew install glfw | |
- name: PkgConfig build with static linking (MacOs) | |
if: matrix.os == 'ubuntu' || matrix.os == 'macos' | |
shell: bash | |
run: cargo clean && cargo run -vv --example=version --features=static_link | |
- name: PkgConfig build with shared linking (MacOs And Linux) | |
if: matrix.os == 'ubuntu' || matrix.os == 'macos' | |
shell: bash | |
run: cargo clean && cargo run -vv --example=version | |
# We don't pass --no-default-features, so, this generates bindings for | |
# vulkan and native_gl/egl + other handles too by including system headers. | |
- name: Generate Bindings | |
shell: bash | |
run: cargo clean && cargo run -vv --example=version --features=bindgen,src_build | |
# Just to make sure that the script works on all platforms. | |
- name: Check gen_bindings.sh script | |
shell: bash | |
run: | | |
# bindgen-cli binary is not available for windows for some reason | |
if [ "$RUNNER_OS" == "Windows" ]; then | |
cargo install bindgen-cli | |
else | |
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-lang/rust-bindgen/releases/download/v0.71.1/bindgen-cli-installer.sh | sh | |
fi | |
./gen_bindings.sh ./bindings.rs | |
# lets log any differences between what is committed and what is generated. | |
# the "|| true" part is to avoid failing the build if there's any differences | |
diff -ub ./src/sys/pregenerated.rs ./bindings.rs || true | |