Compile GLSL shaders into SPIR-V. #321
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cargo build | |
on: | |
push: | |
branches: [ "master", "reduce-dependencies" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
validate: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get current Rust version | |
id: get-rust-version | |
run: echo VERSION=$(rustc --version | sed s/\ /_/g) >> "$GITHUB_OUTPUT" | |
- name: Cache Rust dependencies and artifacts | |
id: cache-rust | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry/index | |
~/.cargo/registry/cache | |
~/.cargo/git/db | |
${{ github.workspace }}/target | |
key: lint-${{ runner.os }}-${{ steps.get-rust-version.outputs.VERSION }}-${{ hashFiles('Cargo.lock') }} | |
- name: Install glslang | |
run: sudo apt install glslang-tools | |
- name: Build SPIR-V shaders with glslang | |
run: glslang -V -g0 src/correlation.comp.glsl -o src/correlation.spv | |
- name: Validate Rust code with clippy | |
run: cargo clippy | |
- name: Upload SPIR-V shaders | |
uses: actions/upload-artifact@v3 | |
with: | |
name: shaders-spv | |
path: src/correlation.spv | |
build-linux: | |
# Older Ubuntu versions will link with an older GLIBC and provide better compatibility | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- arch: x86_64 | |
os: ubuntu | |
- arch: aarch64 | |
os: ubuntu | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get current Rust version | |
id: get-rust-version | |
run: echo VERSION=$(rustc --version | sed s/\ /_/g) >> "$GITHUB_OUTPUT" | |
- name: Cache Rust dependencies and artifacts | |
id: cache-rust | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry/index | |
~/.cargo/registry/cache | |
~/.cargo/git/db | |
${{ github.workspace }}/target | |
key: rust-${{ runner.os }}-${{ matrix.os }}-${{ matrix.arch }}-${{ steps.get-rust-version.outputs.VERSION }}-${{ hashFiles('Cargo.lock') }} | |
- name: Install compiler and prepare for cross-compilation | |
if: matrix.arch == 'aarch64' | |
run: | | |
rustup target add ${{ matrix.arch }}-unknown-linux-gnu | |
sudo apt-get update | |
sudo apt-get install -y crossbuild-essential-arm64 qemu-user-static | |
echo "LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV | |
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
echo "CC=/usr/bin/aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
echo "CXX=/usr/bin/aarch64-linux-gnu-g++" >> $GITHUB_ENV | |
echo "CFLAGS=-march=armv8.2-a" >> $GITHUB_ENV | |
echo "CXXFLAGS=-march=armv8.2-a" >> $GITHUB_ENV | |
- name: Build | |
run: cargo build --target=${{ matrix.arch }}-unknown-linux-gnu --release | |
- name: Package application | |
run: tar -cvjf cybervision-${{ matrix.os }}-${{ matrix.arch }}.tar.bz2 -C target/${{ matrix.arch }}-unknown-linux-gnu/release cybervision | |
- name: Upload application | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cybervision-${{ matrix.os }}-${{ matrix.arch }} | |
path: cybervision-*.tar.bz2 | |
build-windows: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
arch: [aarch64, x86_64] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get current Rust version | |
id: get-rust-version | |
run: | | |
$version = rustc --version | % {$_.replace(" ","_")} | |
echo "VERSION=$version" >> "$env:GITHUB_OUTPUT" | |
- name: Cache Rust dependencies and artifacts | |
id: cache-rust | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~\.cargo\registry\index | |
~\.cargo\registry\cache | |
~\.cargo\git\db | |
${{ github.workspace }}\target | |
key: rust-${{ runner.os }}-${{ matrix.arch }}-${{ steps.get-rust-version.outputs.VERSION }}-${{ hashFiles('Cargo.lock') }} | |
- name: Install compiler and prepare for cross-compilation | |
if: matrix.arch == 'aarch64' | |
run: rustup target add ${{ matrix.arch }}-pc-windows-msvc | |
- name: Build | |
run: | | |
$Env:RUSTFLAGS = "-C target-feature=+crt-static" | |
cargo build --target=${{ matrix.arch }}-pc-windows-msvc --release | |
- name: Package application | |
run: Compress-Archive -Path .\target\${{ matrix.arch }}-pc-windows-msvc\release\cybervision.exe -DestinationPath cybervision-${{ runner.os }}-${{ matrix.arch }}.zip | |
- name: Upload application | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cybervision-${{ runner.os }}-${{ matrix.arch }} | |
path: cybervision-*.zip | |
build-macos: | |
runs-on: macos-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
arch: [aarch64, x86_64] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get current Rust version | |
id: get-rust-version | |
run: echo VERSION=$(rustc --version | sed s/\ /_/g) >> "$GITHUB_OUTPUT" | |
- name: Cache Rust dependencies and artifacts | |
id: cache-rust | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry/index | |
~/.cargo/registry/cache | |
~/.cargo/git/db | |
${{ github.workspace }}/target | |
key: rust-${{ runner.os }}-${{ matrix.arch }}-${{ steps.get-rust-version.outputs.VERSION }}-${{ hashFiles('Cargo.lock') }} | |
- name: Install compiler and prepare for cross-compilation | |
if: matrix.arch == 'aarch64' | |
run: rustup target add ${{ matrix.arch }}-apple-darwin | |
- name: Build | |
run: cargo build --target=${{ matrix.arch }}-apple-darwin --release | |
- name: Package application | |
run: tar -cvjf cybervision-${{ runner.os }}-${{ matrix.arch }}.tar.bz2 -C target/${{ matrix.arch }}-apple-darwin/release cybervision | |
- name: Upload application | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cybervision-${{ runner.os }}-${{ matrix.arch }} | |
path: cybervision-*.tar.bz2 |