diff --git a/.github/install-spirv-tools/Cargo.toml b/.github/install-spirv-tools/Cargo.toml deleted file mode 100644 index 365c38d9a4..0000000000 --- a/.github/install-spirv-tools/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -# We make this tool its own workspace as it doesn't share dependencies with the -# rest of the workspace, and it shouldn't be built normally, only as a helper -# for CI so it would just slow down local development for no reason -[workspace] - -[package] -name = "install-spirv-tools" -edition = "2021" -version = "0.1.0" -publish = false - -[dependencies] -tar = "0.4" -zstd = "0.13" diff --git a/.github/install-spirv-tools/src/main.rs b/.github/install-spirv-tools/src/main.rs deleted file mode 100644 index fca33f562a..0000000000 --- a/.github/install-spirv-tools/src/main.rs +++ /dev/null @@ -1,109 +0,0 @@ -use std::{env, fs, io::Write as _, process::Command}; - -struct Group(bool); - -impl Group { - fn new(group: &str) -> Self { - let is_gh = env::var_os("CI").is_some(); - if is_gh { - println!("::group::{group}"); - } else { - println!("{group}"); - } - Self(is_gh) - } -} - -impl Drop for Group { - fn drop(&mut self) { - if self.0 { - println!("::endgroup::"); - } - } -} - -fn main() { - let (triple, release, td) = { - let mut args = env::args().skip(1); - let triple = args.next().expect("expected target triple"); - let release = args.next().expect("expected release tag name"); - let td = args.next().expect("expected output directory"); - - (triple, release, td) - }; - - let compressed = { - let _s = Group::new(&format!("downloading {triple} tarball")); - let mut cmd = Command::new("curl"); - cmd.args(["-f", "-L"]) - .arg(format!("https://github.com/EmbarkStudios/spirv-tools-rs/releases/download/{release}/{triple}.tar.zst")) - .stdout(std::process::Stdio::piped()); - - let output = cmd - .spawn() - .expect("curl is not installed") - .wait_with_output() - .expect("failed to wait for curl"); - - if !output.status.success() { - panic!("failed to download tarball via curl"); - } - - output.stdout - }; - - let decoded = { - let _s = Group::new(&format!("decompressing {triple} tarball")); - // All archives are <8MiB decompressed - let uncompressed = Vec::with_capacity(8 * 1024 * 1024); - let mut decoder = - zstd::stream::write::Decoder::new(uncompressed).expect("failed to create decoder"); - decoder - .write_all(&compressed) - .expect("failed to decompress"); - decoder.flush().expect("failed to flush decompress stream"); - - decoder.into_inner() - }; - - { - let _s = Group::new(&format!("untarring {triple} tarball")); - { - let mut tar = tar::Archive::new(std::io::Cursor::new(&decoded)); - - if tar - .entries() - .expect("failed to retrieve entries") - .filter(|ent| ent.is_ok()) - .count() - == 0 - { - panic!("no valid entries found in tarball"); - } - } - - let mut tar = tar::Archive::new(std::io::Cursor::new(decoded)); - tar.unpack(&td).expect("failed to untar files"); - } - - if let Some(gh_path) = env::var_os("GITHUB_PATH") { - let _s = Group::new(&format!("adding '{td}' to $GITHUB_PATH ({gh_path:?})")); - - // emulate >> for both empty and non-empty files - let has_contents = fs::metadata(&gh_path).map_or(false, |md| md.len() > 0); - - let mut file = fs::OpenOptions::new() - .append(true) - .open(gh_path) - .expect("failed to open $GITHUB_PATH"); - - let td = if has_contents { - format!("\n{td}\n") - } else { - td - }; - - file.write_all(td.as_bytes()) - .expect("failed to write to $GITHUB_PATH"); - } -} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cb90ba5e84..a30a7c9120 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,19 +23,18 @@ jobs: - os: windows-2022 target: x86_64-pc-windows-msvc - os: macOS-latest - target: x86_64-apple-darwin + target: aarch64-apple-darwin runs-on: ${{ matrix.os }} env: RUSTUP_UNPACK_RAM: "26214400" RUSTUP_IO_THREADS: "1" steps: - uses: actions/checkout@v4 - # Install the spirv-tools binaries from tarballs hosted on each release - # of spirv-tools. This downloads the tarball, decompresses it, unpacks - # the binaries to the specified path, and adds them to PATH - - name: Install spirv-tools binaries - shell: bash - run: cargo run --manifest-path .github/install-spirv-tools/Cargo.toml -- ${{matrix.host || matrix.target}} 0.10.0 "${{github.workspace}}/bin" + - name: Install Vulkan SDK + uses: humbletim/install-vulkan-sdk@v1.2 + with: + version: 1.4.309.0 + cache: true - if: ${{ runner.os == 'Linux' }} name: Linux - Install native dependencies run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev @@ -91,12 +90,11 @@ jobs: RUSTUP_IO_THREADS: "1" steps: - uses: actions/checkout@v4 - # Install the spirv-tools binaries from tarballs hosted on each release - # of spirv-tools. This downloads the tarball, decompresses it, unpacks - # the binaries to the specified path, and adds them to PATH - - name: Install spirv-tools binaries - shell: bash - run: cargo run --manifest-path .github/install-spirv-tools/Cargo.toml -- ${{matrix.host || matrix.target}} 0.10.0 "${{github.workspace}}/bin" + - name: Install Vulkan SDK + uses: humbletim/install-vulkan-sdk@v1.2 + with: + version: 1.4.309.0 + cache: true # cargo version is a random command that forces the installation of rust-toolchain - name: install rust-toolchain run: cargo version @@ -138,13 +136,15 @@ jobs: - os: windows-2022 target: x86_64-pc-windows-msvc - os: macOS-latest - target: x86_64-apple-darwin + target: aarch64-apple-darwin runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - name: Install spirv-tools binaries - shell: bash - run: cargo run --manifest-path .github/install-spirv-tools/Cargo.toml -- ${{matrix.target}} 0.10.0 "${{github.workspace}}/bin" + - name: Install Vulkan SDK + uses: humbletim/install-vulkan-sdk@v1.2 + with: + version: 1.4.309.0 + cache: true # cargo version is a random command that forces the installation of rust-toolchain - name: install rust-toolchain run: cargo version @@ -163,13 +163,15 @@ jobs: - os: windows-2022 target: x86_64-pc-windows-msvc - os: macOS-latest - target: x86_64-apple-darwin + target: aarch64-apple-darwin runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - name: Install spirv-tools binaries - shell: bash - run: cargo run --manifest-path .github/install-spirv-tools/Cargo.toml -- ${{matrix.target}} 0.10.0 "${{github.workspace}}/bin" + - name: Install Vulkan SDK + uses: humbletim/install-vulkan-sdk@v1.2 + with: + version: 1.4.309.0 + cache: true - if: ${{ runner.os == 'Linux' }} name: Linux - Install native dependencies run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev @@ -212,8 +214,11 @@ jobs: submodules: "false" - name: Install native dependencies run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev - - name: Install spirv-tools - run: cargo run --manifest-path .github/install-spirv-tools/Cargo.toml -- x86_64-unknown-linux-gnu 0.10.0 "${{github.workspace}}/bin" + - name: Install Vulkan SDK + uses: humbletim/install-vulkan-sdk@v1.2 + with: + version: 1.4.309.0 + cache: true - name: Install rustup components run: rustup component add rustfmt clippy # cargo version is a random command that forces the installation of rust-toolchain