mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-22 14:56:27 +00:00
e8aef14347
* examples/wgpu: Handle escape to exit (same as ash example) * examples/wgpu: Set up for use on Android * examples/wgpu: Convert #[cfg] blocks to cfg_if * examples/wgpu: Wait for events instead of busy-looping The image currently does not change and the OS will notify us when to redraw (ie. after window resizes). This is going to save power especially on mobile devices. As soon as interactive or animating visuals are introduced to this example redraws can be requested with `window.request_redraw()`. * examples/wgpu: Create swapchain in ::Resume on Android * docs: Add Android to supported operating systems * ci: Build test cross-compilation for Android * HACK: ci: Create Android symlink without spaces * ci: Set legacy ANDROID_HOME because ndk-build prefers deprecated var
122 lines
4.7 KiB
YAML
122 lines
4.7 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
name: Continuous integration
|
|
|
|
jobs:
|
|
check:
|
|
name: Test
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
target: x86_64-unknown-linux-gnu
|
|
- os: windows-latest
|
|
target: x86_64-pc-windows-msvc
|
|
- os: macOS-latest
|
|
target: x86_64-apple-darwin
|
|
runs-on: ${{ matrix.os }}
|
|
env:
|
|
spirv_tools_version: "20200928"
|
|
steps:
|
|
# Note that we are explicitly NOT checking out submodules, to validate
|
|
# that we haven't accidentally enabled spirv-tools native compilation
|
|
# and regressed CI times
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: "false"
|
|
# Ubuntu does have `brew install spirv-tools`, but it installs from
|
|
# source and so takes >8 minutes.
|
|
- if: ${{ runner.os == 'Linux' }}
|
|
name: Linux - Install native dependencies
|
|
run: |
|
|
sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
|
|
mkdir "${HOME}/spirv-tools"
|
|
curl -fL https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/linux-clang-release/continuous/1305/20201026-063148/install.tgz | tar -xz -C "${HOME}/spirv-tools"
|
|
echo "${HOME}/spirv-tools/install/bin" >> $GITHUB_PATH
|
|
- if: ${{ runner.os == 'macOS' }}
|
|
name: Mac - Install spirv-tools
|
|
run: brew install spirv-tools
|
|
# Currently SPIR-V tools aren't available in any package manager
|
|
# on Windows that put the tools in the path.
|
|
- if: ${{ runner.os == 'Windows' }}
|
|
name: Windows - Install spirv-tools
|
|
shell: bash
|
|
run: |
|
|
tmparch=$(mktemp)
|
|
mkdir "${HOME}/spirv-tools"
|
|
curl -fL -o "$tmparch" https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/windows-msvc-2017-release/continuous/1232/20200928-085551/install.zip
|
|
unzip "$tmparch" -d "${HOME}/spirv-tools"
|
|
- if: ${{ runner.os == 'Windows' }}
|
|
# Runs separately to add spir-v tools to Powershell's Path.
|
|
run: echo "$HOME/spirv-tools/install/bin" >> $env:GITHUB_PATH
|
|
- name: Install rustup components
|
|
run: rustup component add rust-src rustc-dev llvm-tools-preview
|
|
# Fetch dependencies in a separate step to clearly show how long each part
|
|
# of the testing takes
|
|
- name: cargo fetch
|
|
run: cargo fetch --target ${{ matrix.target }}
|
|
- name: Run tests
|
|
shell: bash
|
|
run: .github/workflows/test.sh ${{ runner.os }}
|
|
|
|
- name: Install cargo-apk
|
|
run: cargo install cargo-apk
|
|
|
|
- if: runner.os == 'Windows'
|
|
name: Create symlink to Android SDK/NDK without spaces
|
|
run: |
|
|
$oldAndroidPath = $env:ANDROID_HOME
|
|
$sdk_root = "C:\Android"
|
|
New-Item -Path $sdk_root -ItemType SymbolicLink -Value $oldAndroidPath
|
|
|
|
echo "ANDROID_SDK_ROOT=$sdk_root" >> $env:GITHUB_ENV
|
|
echo "ANDROID_NDK_ROOT=$sdk_root\ndk-bundle" >> $env:GITHUB_ENV
|
|
|
|
# Update legacy path for ndk-build:
|
|
echo "ANDROID_HOME=$sdk_root" >> $env:GITHUB_ENV
|
|
|
|
# Unset legacy paths:
|
|
echo "ANDROID_NDK_HOME=" >> $env:GITHUB_ENV
|
|
echo "ANDROID_NDK_PATH=" >> $env:GITHUB_ENV
|
|
|
|
- name: Compile WGPU example for Android
|
|
run: |
|
|
rustup target add aarch64-linux-android
|
|
cargo apk build --manifest-path examples/runners/wgpu/Cargo.toml --features use-installed-tools --no-default-features
|
|
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# Note that we are explicitly NOT checking out submodules, to validate
|
|
# that we haven't accidentally enabled spirv-tools native compilation
|
|
# and regressed CI times
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: "false"
|
|
- name: Install native dependencies
|
|
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
|
|
- name: Install spirv-tools
|
|
run: |
|
|
mkdir "${HOME}/spirv-tools"
|
|
curl -fL https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/linux-clang-release/continuous/1305/20201026-063148/install.tgz | tar -xz -C "${HOME}/spirv-tools"
|
|
echo "${HOME}/spirv-tools/install/bin" >> $GITHUB_PATH
|
|
- name: Install rustup components
|
|
run: rustup component add rustfmt clippy rust-src rustc-dev llvm-tools-preview
|
|
- name: Rustfmt
|
|
run: cargo fmt --all -- --check
|
|
- name: cargo fetch
|
|
run: cargo fetch
|
|
- name: Clippy
|
|
run: .github/workflows/clippy.sh
|
|
|
|
cargo-deny:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: EmbarkStudios/cargo-deny-action@v1
|