Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto self build, or rust-gpu on stable rustc #176

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ jobs:
# Fetch dependencies in a separate step to clearly show how long each part
# of the testing takes
- name: cargo fetch --locked
run: cargo fetch --locked --target ${{ matrix.target }}
run: |
cargo fetch --locked --target ${{ matrix.target }}
cd crates/rustc_codegen_spirv
cargo fetch --locked --target ${{ matrix.target }}

# Core crates
# Compiled in --release because cargo compiletest would otherwise compile in release again.
- name: rustc_codegen_spirv build
if: ${{ matrix.target != 'aarch64-linux-android' }}
run: cargo test -p rustc_codegen_spirv --release --no-default-features --features "use-installed-tools" --no-run

- name: rustc_codegen_spirv test
if: ${{ matrix.target != 'aarch64-linux-android' }}
run: cargo test -p rustc_codegen_spirv --release --no-default-features --features "use-installed-tools"
run: |
cd crates/rustc_codegen_spirv
cargo test --no-default-features --features "use-installed-tools"

- name: compiletest
if: ${{ matrix.target != 'aarch64-linux-android' }}
Expand All @@ -74,9 +74,7 @@ jobs:

- name: build example shaders
if: ${{ matrix.target != 'aarch64-linux-android' }}
env:
OUT_DIR: "target/tmp"
run: cargo run -p example-runner-wgpu-builder --release --no-default-features --features "use-installed-tools"
run: cargo build -p example-runner-wgpu --no-default-features --features "use-installed-tools"

- name: Build WGPU Example for Android
if: ${{ matrix.target == 'aarch64-linux-android' }}
Expand Down Expand Up @@ -130,13 +128,22 @@ jobs:
- name: install rust-toolchain
run: cargo version
- name: cargo fetch --locked
run: cargo fetch --locked
run: |
cargo fetch --locked
cd crates/rustc_codegen_spirv
cargo fetch --locked
- name: Rustfmt
run: cargo fmt --all -- --check
run: |
cargo fmt --all -- --check
cd crates/rustc_codegen_spirv
cargo fmt --all -- --check
- name: Rustfmt tests
run: rustfmt --check tests/ui/**/*.rs
- name: Check docs are valid
run: RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps
run: |
RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps
cd crates/rustc_codegen_spirv
RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps
- name: Check docs for `spirv-std` and `spirv-builder` on stable (for docs.rs)
run: |
RUSTDOCFLAGS=-Dwarnings cargo +stable doc --no-deps -p spirv-std
Expand Down
29 changes: 21 additions & 8 deletions .github/workflows/docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,29 @@ else
FEAT="use-installed-tools"
fi

# HACK(eddyb) build docs using one toolchain, otherwise they wipe eachother.
ORIG_DIR="$PWD"
TOOLCHAIN_DIR="crates/rustc_codegen_spirv"
function doc() {
echo ::group::"$1"
cargo doc \
--manifest-path "$1/Cargo.toml" \
--no-default-features \
--features "$FEAT"
local crate_path="$1"
shift

echo ::group::"$crate_path"
# HACK(eddyb) need to be in `crates/rustc_codegen_spirv` to use its toolchain.
(
cd "$TOOLCHAIN_DIR"
cargo doc \
--manifest-path "$ORIG_DIR/$crate_path/Cargo.toml" \
--target-dir "$ORIG_DIR/target" \
"$@"
)
echo ::endgroup::
}
function doc_with_host_feat() {
doc "$@" --no-default-features --features "$FEAT"
}

# Core crates only!
cargo doc --manifest-path "crates/spirv-std/Cargo.toml" --all-features
doc crates/rustc_codegen_spirv
doc crates/spirv-builder
doc crates/spirv-std --all-features
doc_with_host_feat crates/rustc_codegen_spirv
doc_with_host_feat crates/spirv-builder
15 changes: 9 additions & 6 deletions .github/workflows/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ fi

function clippy() {
echo ::group::"$1"
cargo clippy \
--manifest-path "$1/Cargo.toml" \
--no-default-features \
--features "$FEAT" \
--all-targets \
-- -D warnings
# HACK(eddyb) need to be in `crates/rustc_codegen_spirv` to use its toolchain.
(
cd "$1"
cargo clippy \
--no-default-features \
--features "$FEAT" \
--all-targets \
-- -D warnings
)
echo ::endgroup::
}

Expand Down
103 changes: 40 additions & 63 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 6 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ members = [
"examples/runners/cpu",
"examples/runners/ash",
"examples/runners/wgpu",
"examples/runners/wgpu/builder",
"examples/shaders/reduce",
"examples/shaders/sky-shader",
"examples/shaders/simplest-shader",
"examples/shaders/compute-shader",
"examples/shaders/mouse-shader",
"examples/multibuilder",

"crates/rustc_codegen_spirv",
"crates/rustc_codegen_spirv-types",
"crates/spirv-builder",
"crates/spirv-std",
Expand All @@ -22,6 +20,11 @@ members = [
"tests",
"tests/deps-helper",
]
exclude = [
# HACK(eddyb) separate workspace because `rustc_codegen_spirv` requires its
# own `rust-toolchain.toml`, see also `crates/rustc_codegen_spirv/README.md`.
"crates/rustc_codegen_spirv",
]

[workspace.package]
version = "0.9.0"
Expand All @@ -38,25 +41,13 @@ spirv-builder = { path = "./crates/spirv-builder", version = "=0.9.0", default-f
spirv-std = { path = "./crates/spirv-std", version = "=0.9.0" }
spirv-std-types = { path = "./crates/spirv-std/shared", version = "=0.9.0" }
spirv-std-macros = { path = "./crates/spirv-std/macros", version = "=0.9.0" }
spirv-tools = { version = "0.10", default-features = false }
rustc_codegen_spirv = { path = "./crates/rustc_codegen_spirv", version = "=0.9.0", default-features = false }
rustc_codegen_spirv-types = { path = "./crates/rustc_codegen_spirv-types", version = "=0.9.0" }

# External dependencies that need to be mentioned more than once.
num-traits = { version = "0.2.15", default-features = false }
glam = { version = ">=0.22, <=0.29", default-features = false }

# Enable incremental by default in release mode.
# Enable incremental by default in release mode, as well.
[profile.release]
incremental = true
# HACK(eddyb) this is the default but without explicitly specifying it, Cargo
# will treat the identical settings in `[profile.release.build-override]` below
# as different sets of `rustc` flags and will not reuse artifacts between them.
codegen-units = 256

# Compile build-dependencies in release mode with the same settings
# as regular dependencies (including the incremental enabled above).
[profile.release.build-override]
opt-level = 3
incremental = true
codegen-units = 256
Loading