Skip to content

chore(ci): Enable WGPU on Linux #116

chore(ci): Enable WGPU on Linux

chore(ci): Enable WGPU on Linux #116

Workflow file for this run

name: validate
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
rustfmt-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
components: rustfmt
- name: Run cargo fmt
run: cargo fmt -- --check
# - name: Run cargo clippy
# run: cargo clippy -- -D warnings
check-std:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [blaze/macos-14, ubuntu-latest, windows-latest]
rust: [stable]
backend: ["ndarray", "wgpu", "torch"]
include:
- cache: stable
rust: stable
exclude:
# windows can have CPU Vulkan but Burn doesn't select CPU well yet
- os: windows-latest
backend: "wgpu"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
toolchain: ${{ matrix.rust }}
matcher: ${{ runner.os == 'Linux' && matrix.rust == 'stable' && matrix.backend == 'ndarray' }}
rustflags: "" # Disable when we're ready
- name: Setup cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-${{ matrix.cache }}-${{ matrix.backend }}-${{ hashFiles('**/Cargo.toml') }}
- name: (Linux) Install llvmpipe, lavapipe
if: runner.os == 'Linux'
run: |-
sudo apt-get update -y -qq
sudo add-apt-repository ppa:kisak/kisak-mesa -y
sudo apt-get update
sudo apt install -y libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
- name: (Windows) Install warp
if: runner.os == 'Windows'
shell: bash
run: |-
set -e
curl.exe -L https://www.nuget.org/api/v2/package/Microsoft.Direct3D.WARP/1.0.7.1 -o warp.zip
7z.exe e warp.zip -owarp build/native/amd64/d3d10warp.dll
mkdir -p target/debug/deps
cp -v warp/d3d10warp.dll target/debug/
cp -v warp/d3d10warp.dll target/debug/deps
- name: (Windows) Install mesa
if: runner.os == 'Windows'
shell: bash
run: |-
set -e
curl.exe -L https://github.com/pal1000/mesa-dist-win/releases/download/23.2.1/mesa3d-23.2.1-release-msvc.7z -o mesa.7z
7z.exe e mesa.7z -omesa x64/{opengl32.dll,libgallium_wgl.dll,libglapi.dll,vulkan_lvp.dll,lvp_icd.x86_64.json}
mkdir -p target/debug/deps
cp -v mesa/* target/debug/
cp -v mesa/* target/debug/deps
echo "VK_DRIVER_FILES=$PWD/mesa/lvp_icd.x86_64.json" >> "$GITHUB_ENV"
echo "GALLIUM_DRIVER=llvmpipe" >> "$GITHUB_ENV"
- name: (Windows) Install dxc
if: runner.os == 'Windows'
uses: napokue/[email protected]
- name: Run tests
shell: bash
run: |-
echo "::group::${{ matrix.backend }}"
cargo test --features ${{ matrix.backend }}
echo "::endgroup::"
# test accelerate feature for ndarray on macOS
if [ "${{ matrix.backend }}" = "ndarray" ] && [ "${{ runner.os }}" = "macOS" ]; then
echo "::group::${{ matrix.backend }} with accelerate"
cargo test --features ${{ matrix.backend }} --features accelerate
echo "::endgroup::"
fi
check-no-std:
runs-on: ubuntu-latest
strategy:
matrix:
rust: [stable]
target: ["wasm32-unknown-unknown", "thumbv7m-none-eabi"]
backend: ["ndarray"]
include:
- cache: stable
rust: stable
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
cache: false
matcher: false
rustflags: "" # Disable when we're ready
- name: Setup cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-${{ matrix.cache }}-${{ matrix.backend }}-${{ hashFiles('**/Cargo.toml') }}
- name: Run tests
run: cargo test --no-default-features --features ${{ matrix.backend }}
- name: Build ${{ matrix.target }}
run: cargo build --no-default-features --features ${{ matrix.backend }} --target ${{ matrix.target }}