Skip to content

Feat/fractionally #1609

Feat/fractionally

Feat/fractionally #1609

Workflow file for this run

on:
merge_group:
pull_request:
types: [synchronize, labeled, reopened, ready_for_review]
push:
branches:
- master
env:
CARGO_INCREMENTAL: false
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
# Sourced from https://vulkan.lunarg.com/sdk/home#linux
VULKAN_SDK_VERSION: "1.3.268"
# Sourced from https://www.nuget.org/packages/Microsoft.Direct3D.WARP
WARP_VERSION: "1.0.8"
# Sourced from https://github.com/microsoft/DirectXShaderCompiler/releases
#
# Must also be changed in shaders.yaml
DXC_RELEASE: "v1.7.2308"
DXC_FILENAME: "dxc_2023_08_14.zip"
# Sourced from https://archive.mesa3d.org/. Bumping this requires
# updating the mesa build in https://github.com/gfx-rs/ci-build and creating a new release.
MESA_VERSION: "23.3.1"
# Corresponds to https://github.com/gfx-rs/ci-build/releases
CI_BINARY_BUILD: "build18"
# We have some features that are only available on nightly. We need to test it.
NIGHTLY_VERSION: "nightly-2024-10-03"
name: CI
jobs:
lint:
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'B-test')
name: rust code lint
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
# we use nightly for clippy and rustfmt
toolchain: $NIGHTLY_VERSION
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: format style check
run: cargo fmt --all -- --check
- name: cargo clippy check
run: cargo clippy --all-targets --all-features -- -D warnings
# Check with stable toolchain to ensure stable compilation
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- run: cargo check
test-with-gpu:
# The content of this job is largely borrowed from the 'ci.yml' file in the 'wgpu/.github/workflows' directory.
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
# Windows
- name: Windows x86_64
os: windows-2022
# Mac
- name: Mac aarch64
os: macos-14
# Linux
- name: Linux x86_64
os: ubuntu-22.04
name: Test ${{ matrix.name }}
runs-on: ${{ matrix.os }}
needs: [lint]
steps:
- name: checkout repo
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: $NIGHTLY_VERSION
components: rustfmt, clippy
- name: Install cargo-nextest and cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest,cargo-llvm-cov
# Cache step must go before warp and mesa install on windows as they write into the
# target directory, and rust-cache will overwrite the entirety of the target directory.
- name: caching
uses: Swatinem/rust-cache@v2
with:
key: test-${{ matrix.os }}-ci-test
workspaces: |
. -> target
xtask -> xtask/target
- name: (windows) install dxc
if: matrix.os == 'windows-2022'
shell: bash
run: |
set -e
curl.exe -L --retry 5 https://github.com/microsoft/DirectXShaderCompiler/releases/download/$DXC_RELEASE/$DXC_FILENAME -o dxc.zip
7z.exe e dxc.zip -odxc bin/x64/{dxc.exe,dxcompiler.dll,dxil.dll}
# We need to use cygpath to convert PWD to a windows path as we're using bash.
cygpath --windows "$PWD/dxc" >> "$GITHUB_PATH"
- name: (windows) install warp
if: matrix.os == 'windows-2022'
shell: bash
run: |
set -e
# Make sure dxc is in path.
dxc --version
curl.exe -L --retry 5 https://www.nuget.org/api/v2/package/Microsoft.Direct3D.WARP/$WARP_VERSION -o warp.zip
7z.exe e warp.zip -owarp build/native/amd64/d3d10warp.dll
mkdir -p target/llvm-cov-target/debug/deps
cp -v warp/d3d10warp.dll target/llvm-cov-target/debug/
cp -v warp/d3d10warp.dll target/llvm-cov-target/debug/deps
- name: (windows) install mesa
if: matrix.os == 'windows-2022'
shell: bash
run: |
set -e
curl.exe -L --retry 5 https://github.com/pal1000/mesa-dist-win/releases/download/$MESA_VERSION/mesa3d-$MESA_VERSION-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}
cp -v mesa/* target/llvm-cov-target/debug/
cp -v mesa/* target/llvm-cov-target/debug/deps
# We need to use cygpath to convert PWD to a windows path as we're using bash.
echo "VK_DRIVER_FILES=`cygpath --windows $PWD/mesa/lvp_icd.x86_64.json`" >> "$GITHUB_ENV"
echo "GALLIUM_DRIVER=llvmpipe" >> "$GITHUB_ENV"
- name: (linux) install vulkan sdk
if: matrix.os == 'ubuntu-22.04'
shell: bash
run: |
set -e
sudo apt-get update -y -qq
# vulkan sdk
wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-$VULKAN_SDK_VERSION-jammy.list https://packages.lunarg.com/vulkan/$VULKAN_SDK_VERSION/lunarg-vulkan-$VULKAN_SDK_VERSION-jammy.list
sudo apt-get update
sudo apt install -y vulkan-sdk
- name: (linux) install mesa
if: matrix.os == 'ubuntu-22.04'
shell: bash
run: |
set -e
curl -L --retry 5 https://github.com/gfx-rs/ci-build/releases/download/$CI_BINARY_BUILD/mesa-$MESA_VERSION-linux-x86_64.tar.xz -o mesa.tar.xz
mkdir mesa
tar xpf mesa.tar.xz -C mesa
# The ICD provided by the mesa build is hardcoded to the build environment.
#
# We write out our own ICD file to point to the mesa vulkan
cat <<- EOF > icd.json
{
"ICD": {
"api_version": "1.1.255",
"library_path": "$PWD/mesa/lib/x86_64-linux-gnu/libvulkan_lvp.so"
},
"file_format_version": "1.0.0"
}
EOF
echo "VK_DRIVER_FILES=$PWD/icd.json" >> "$GITHUB_ENV"
echo "LD_LIBRARY_PATH=$PWD/mesa/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH" >> "$GITHUB_ENV"
echo "LIBGL_DRIVERS_PATH=$PWD/mesa/lib/x86_64-linux-gnu/dri" >> "$GITHUB_ENV"
- name: disable debug
shell: bash
run: |
mkdir -p .cargo
echo """
[profile.dev]
debug = 1" >> .cargo/config.toml
- name: run tests
shell: bash
run: |
set -e
cargo llvm-cov --workspace --lcov --output-path lcov.info --all-features
- name: generate coverage report
id: coverage
shell: bash
continue-on-error: true
run: |
set -e
cargo llvm-cov report --lcov --output-path lcov.info
- uses: actions/upload-artifact@v4
if: always()
with:
name: test-cases-${{ matrix.os }}
path: ./test_cases
- name: upload coverage report to codecov
uses: codecov/codecov-action@v3
if: steps.coverage.outcome == 'success'
with:
files: lcov.info
doc-examples:
needs: lint
name: compile doc examples
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: build ribir
run: cargo build
- name: compile doc examples
run: |
{
echo ./README.md
find "./docs" -name "*.md"
} | xargs -I {} rustdoc --test {} -L target/debug/deps/ --edition 2018 --extern ribir=target/debug/libribir.rlib
wasm-compile:
needs: lint
name: wasm compile
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
- name: compile to wasm
run: cargo build --workspace --target wasm32-unknown-unknown --exclude ribir_dev_helper
wasm-test:
needs: lint
name: wasm test
runs-on: ubuntu-latest
steps:
- name: Install Chrome
uses: browser-actions/setup-chrome@v1
- name: Checkout sources
uses: actions/checkout@v3
- name: Install
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Run wasm test of core
run: wasm-pack test --headless --chrome ./core