Skip to content
New issue

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

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

Already on GitHub? # to your account

ci: create cross-platform workflow pipelines #47

Merged
merged 88 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from 83 commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
2990e43
ci: create ci workflow with new github actions configuration
falcucci Sep 17, 2024
366be8f
ci: improve ci workflow to support additional toolchains
falcucci Sep 17, 2024
c26c55f
feat: refactor rendering functions and structs
falcucci Sep 17, 2024
04f9807
refactor: optimize data type conversions in geometry buffers
falcucci Sep 17, 2024
347d88c
ci: install fonts for macos in ci workflow config
falcucci Sep 18, 2024
5fd651b
chore: update shell configuration and font package
falcucci Sep 18, 2024
f19bd2c
ci: improve ci workflow for macos installations
falcucci Sep 18, 2024
e7d873f
ci: update ci workflow to include font installation step
falcucci Sep 18, 2024
fea7500
chore: install monospace nerd font for improved developer experience
falcucci Sep 18, 2024
d28fa7a
ci: increase font options in macos github actions workflow
falcucci Sep 18, 2024
52afa36
ci: update ci workflow to remove unnecessary `brew tap` command
falcucci Sep 18, 2024
defa652
chore: update font installations for better compatibility
falcucci Sep 18, 2024
f0b7e55
refactor: refactor temp directory management
falcucci Sep 18, 2024
e76adb1
feat: optimize rendering for different platforms
falcucci Sep 19, 2024
b439609
chore: refactor codebase to remove unnecessary imports
falcucci Sep 19, 2024
8f1599c
ci: add new build step for cargo compilation in job
falcucci Sep 19, 2024
7f69771
ci: include homebrew installation steps for linux runner os
falcucci Sep 19, 2024
dc8f600
ci: update ci workflows for homebrew installation on macos
falcucci Sep 19, 2024
6462f54
ci: update linux ci job configuration to use linuxbrew shellenv
falcucci Sep 19, 2024
b78a6ed
ci: update github actions and brew shellenv command usage
falcucci Sep 19, 2024
71ee6ef
chore: update linux environment setup and dependencies
falcucci Sep 19, 2024
d279e1b
ci: integrate new fonts into ci workflow
falcucci Sep 19, 2024
81e6449
chore: update build process to remove unnecessary `gcc` installation
falcucci Sep 19, 2024
a31da3f
chore: streamline font installation process using homebrew commands
falcucci Sep 19, 2024
86d5bad
ci: refactor ci workflow for homebrew updates and taps
falcucci Sep 19, 2024
cccb20e
ci: update github actions workflow for font installations
falcucci Sep 19, 2024
22144e5
ci: update font in ci workflow for github actions
falcucci Sep 19, 2024
5fb25c5
ci: refactor github actions for improved performance
falcucci Sep 19, 2024
1d4f97e
chore: update dependencies in ci workflow to use `font-monospace-nerd…
falcucci Sep 19, 2024
d7c1d1c
chore: update homebrew dependencies for font installation
falcucci Sep 19, 2024
406211a
chore: update font installations and downloader script
falcucci Sep 19, 2024
865d414
ci: improve font installation process in ci workflow
falcucci Sep 19, 2024
1e74fa5
ci: update font version in ci workflow
falcucci Sep 19, 2024
264ab65
chore: revamp font installation process for linux
falcucci Sep 19, 2024
a73ad1b
chore: update font installation list
falcucci Sep 19, 2024
ebd7ee2
ci: update ci workflow for improved font handling
falcucci Sep 19, 2024
c5ddeb1
chore: consolidate font handling logic across codebase
falcucci Sep 19, 2024
79e0005
fix: improve ci workflow for font check
falcucci Sep 19, 2024
bf10625
chore: update platform-specific configurations in renderer
falcucci Sep 19, 2024
e951a50
refactor: refactor rendering scopes and command encoding
falcucci Sep 19, 2024
6495068
chore: improve error handling for test command runtime
falcucci Sep 19, 2024
ee6f006
chore: update dependencies and ci workflow configurations
falcucci Sep 19, 2024
44cb425
ci: update ci workflow to streamline installation process
falcucci Sep 19, 2024
3a9fd70
chore: standardize environment variables and font installation
falcucci Sep 19, 2024
65b2fc0
chore: consolidate font installation commands and variables
falcucci Sep 19, 2024
0a6c397
ci: optimize ci workflow and renderer implementation
falcucci Sep 19, 2024
6c77f5a
ci: update ci workflow for mesa installation
falcucci Sep 19, 2024
5f3b5d0
chore: improve linux setup steps
falcucci Sep 19, 2024
1f7a45b
ci: update ubuntu version in ci workflow configurations
falcucci Sep 19, 2024
38304bb
chore: update dependencies in github actions workflow
falcucci Sep 19, 2024
74e83ca
refactor: refactor request handling for improved performance
falcucci Sep 19, 2024
f7a819d
chore: add support for windows-2022 and improve installation instruct…
falcucci Sep 19, 2024
874055b
chore: update installation script for windows-2022 configurations
falcucci Sep 19, 2024
05125a3
ci: update ci workflow font installation command
falcucci Sep 19, 2024
3eb23de
ci: update font installer in github ci workflow
falcucci Sep 19, 2024
eaf0c7e
chore: update font installation command to include 'cascadiacode-nf-p…
falcucci Sep 19, 2024
6b55472
fix: update font handling and installation protocol
falcucci Sep 19, 2024
98188d3
chore: update font paths to scoop directory for windows environment
falcucci Sep 19, 2024
a78432b
ci: update font paths and add installation check for windows os
falcucci Sep 19, 2024
ba6f9f5
feat: refactor font registration logic using fonthelper
falcucci Sep 19, 2024
7dfec7d
ci: update font installations and remove unnecessary ones in windows …
falcucci Sep 19, 2024
11a2d65
feat: install additional dependencies for windows support
falcucci Sep 19, 2024
a46cba5
docs: update directxshadercompiler information and comments
falcucci Sep 19, 2024
bd1f9b9
ci: update ci configuration with new settings and dependencies
falcucci Sep 19, 2024
13ce572
ci: remove unnecessary font installation script from ci workflow
falcucci Sep 20, 2024
48d1e6c
test: improve windows compatibility and test coverage
falcucci Sep 20, 2024
f7dfabd
test: refactor font handling in tests
falcucci Sep 20, 2024
11f126d
docs: improve font installation process in project
falcucci Sep 20, 2024
335a952
refactor: refactor font_styles function and add new font style
falcucci Sep 20, 2024
c856e63
fix conflicts
falcucci Sep 21, 2024
6b4a05d
style: standardize font style names across project
falcucci Sep 21, 2024
9a4960f
test: improve test coverage for font styles
falcucci Sep 21, 2024
a979a7b
ci: optimize ci configurations to improve build times
falcucci Sep 21, 2024
bd42679
ci: update ci workflow for windows 2022
falcucci Sep 21, 2024
d652ece
refactor: update request adapter configuration to force fallback adapter
falcucci Sep 21, 2024
1728242
refactor: improve adapter fallback logic
falcucci Sep 21, 2024
4e85728
chore: update build configuration variables and organization
falcucci Sep 21, 2024
674c220
feat: consolidate platform-specific backend support
falcucci Sep 21, 2024
0d57e51
refactor: update target os settings for cross-platform compatibility
falcucci Sep 21, 2024
5142d1e
chore: refactor shader feature in renderer module
falcucci Sep 21, 2024
ecfabef
refactor: optimize push constant size for performance improvements
falcucci Sep 21, 2024
31d9166
refactor: update installation steps and cleanup configuration in rend…
falcucci Sep 21, 2024
0f52be3
chore: update branch naming convention in ci workflow file
falcucci Sep 21, 2024
7efbc19
ci: improve cross-platform compatibility and workflows
falcucci Sep 22, 2024
557236c
chore: optimize gpu profiling code and settings
falcucci Sep 22, 2024
155f0fc
refactor: optimize gpuprofiler initialization and timer queries
falcucci Sep 22, 2024
4b05a1c
ci: update branch filter in ci workflow
falcucci Sep 22, 2024
2a73c0a
fix: refactor text layout and quad generation in debug scene
falcucci Sep 22, 2024
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
289 changes: 289 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,289 @@
name: CI

on:
push:
branches:
- main

defaults:
run:
shell: bash

env:
# 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"
WGPU_DX12_COMPILER: dxc
RUST_LOG: info
RUST_BACKTRACE: full

FONTS: "Monaspace FiraCode ProFont CascadiaCode Noto"
BREW_FONTS: "font-monaspace font-fira-code-nerd-font font-profont-nerd-font font-caskaydia-cove-nerd-font font-monaspace-nerd-font font-noto-nerd-font"
VERSION: "v3.2.1"
EXTENSION: ".zip"

jobs:
fmt:
name: cargo fmt
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2022, macos-latest, ubuntu-22.04]
toolchain: [stable, nightly]
steps:
- uses: actions/checkout@v4

- name: install stable toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: rustfmt

- name: cargo fmt
run: cargo fmt --all --check

clippy:
name: cargo clippy
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2022, macos-latest, ubuntu-22.04]
toolchain: [stable, nightly]
steps:
- uses: actions/checkout@v4

- name: restore cache
uses: Swatinem/rust-cache@v2

- name: install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy

- name: Show toolchain info
run: cargo --version --verbose

- name: Run Clippy
run: cargo clippy --all-targets -- -D warnings
continue-on-error: ${{ matrix.toolchain == 'nightly' }}

event-upload:
needs: test
name: Upload Test Event
runs-on: ubuntu-22.04
steps:
- uses: actions/upload-artifact@v4
with:
name: test-event
path: ${{ github.event_path }}

test:
name: cargo test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2022, macos-latest, ubuntu-22.04]
toolchain: [stable, nightly]
steps:
- uses: actions/checkout@v4

- name: restore cache
uses: Swatinem/rust-cache@v2

- name: install stable toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}

- 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: (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: (windows) Install Fonts
if: matrix.os == 'windows-2022'
shell: powershell
run: |
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
scoop install git
scoop bucket add extras
scoop bucket add nerd-fonts
scoop install Monaspace Monaspace-NF FiraCode-NF ProFont-NF CascadiaCode-NF Noto-NF

- name: Restart font cache
if: matrix.os == 'windows-2022'
shell: powershell
run: |
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public class FontHelper {
[DllImport("gdi32.dll")]
public static extern int AddFontResource(string lpFileName);
}
"@
$fontPaths = @(
"$env:USERPROFILE\scoop\apps\Monaspace-NF\current\*.ttf",
"$env:USERPROFILE\scoop\apps\FiraCode-NF\current\*.ttf",
"$env:USERPROFILE\scoop\apps\ProFont-NF\current\*.ttf",
"$env:USERPROFILE\scoop\apps\CascadiaCode-NF\current\*.ttf",
"$env:USERPROFILE\scoop\apps\Noto-NF\current\*.ttf"
)
foreach ($path in $fontPaths) {
if (Test-Path -Path $path) {
foreach ($font in Get-ChildItem -Path $path) {
[FontHelper]::AddFontResource($font.FullName) | Out-Null
}
}
}
Write-Output "Fonts have been registered."

- name: (macos) Install Fonts
if: matrix.os == 'macos-latest'
run: |
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh && brew upgrade
brew install ${{ env.BREW_FONTS }}

- name: (linux) Install Fonts
if: matrix.os == 'ubuntu-22.04'
run: |
FONT_DIR="${HOME}/.local/share/fonts"
mkdir -p "$FONT_DIR"
for font in ${{ env.FONTS }}; do
ZIP_FILE="${font}${EXTENSION}"
if [[ "$font" == "Monaspace" ]]; then
DOWNLOAD_URL="https://github.com/githubnext/monaspace/releases/download/v1.101/monaspace-v1.101.zip"
else
DOWNLOAD_URL="https://github.com/ryanoasis/nerd-fonts/releases/download/${VERSION}/${ZIP_FILE}"
fi
echo "Downloading and installing '$font'..."
wget --quiet "$DOWNLOAD_URL" -O "$ZIP_FILE"
unzip -oq "$ZIP_FILE" -d "$FONT_DIR"
rm "$ZIP_FILE"
echo "'$font' installed successfully."
done

# Refresh font cache
fc-cache -fv

- name: cargo test
run: RUST_BACKTRACE=full cargo test --workspace --locked --all-features

build:
name: cargo build
strategy:
fail-fast: false
matrix:
os: [windows-2022, macos-latest, ubuntu-22.04]
toolchain: [stable, nightly]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Setup toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}

- uses: Swatinem/rust-cache@v2

- name: Build
run: cargo build --locked --release
32 changes: 16 additions & 16 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ thread_local = "1.1.7"
# Used to make the error output for shader recompilation easier to read
termcolor = "1.4.1"
wgpu = { workspace = true, features = ["glsl"] }
wgpu-profiler = { version = "0.18.0", features = ["tracy"] }
winit = { workspace = true }

[target.'cfg(not(any(target_os = "linux", target_os = "macos")))'.dependencies]
wgpu-profiler = { version = "0.18.0", features = ["tracy"] }

[dev-dependencies]
image-compare = "0.4.1"
git2 = "0.18.3"
Loading