fix(ci): caching and vulkan builds, add tests

This commit is contained in:
Chance 2025-04-20 18:26:14 -04:00
parent 948c73cec7
commit 7e8c43cb47
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 489D213143D753FD

View file

@ -21,7 +21,9 @@ jobs:
path: | path: |
~/.cargo/bin ~/.cargo/bin
/tmp/zig /tmp/zig
key: cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} key: cargo-tools-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-tools-
- name: 🦀 Install Rust toolchain - name: 🦀 Install Rust toolchain
uses: https://github.com/actions-rs/toolchain@v1 uses: https://github.com/actions-rs/toolchain@v1
@ -39,9 +41,48 @@ jobs:
tar -Jxf zig-linux-x86_64.tar.xz -C /tmp/zig --strip-components=1 tar -Jxf zig-linux-x86_64.tar.xz -C /tmp/zig --strip-components=1
cargo install cargo-zigbuild cargo install cargo-zigbuild
cargo-test:
name: 🧪 Run Cargo Tests
needs: [setup]
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout source
uses: https://github.com/actions/checkout@v4
- name: 🗄️ Restore Cargo cache
uses: https://github.com/actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-
- name: 🦀 Install Rust toolchain
if: steps.restore-cargo-cache.outputs.cache-hit != 'true'
uses: https://github.com/actions-rs/toolchain@v1
with:
toolchain: stable
components: rust-src
override: true
- name: 🦀 Install Vulkan tools
run: |
apt update
apt install -y vulkan-tools glslc
- name: 🚀 Run tests
uses: https://github.com/actions-rs/cargo@v1
with:
command: test
args: --release --all
build: build:
name: 🏗️ Build ${{ matrix.target }} name: 🏗️ Build ${{ matrix.target }}
needs: setup needs: [setup, cargo-test]
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
@ -49,7 +90,7 @@ jobs:
target: target:
- x86_64-unknown-linux-gnu - x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu - aarch64-unknown-linux-gnu
- x86_64-pc-windows-msvc # - x86_64-pc-windows-msvc
include: include:
- target: x86_64-unknown-linux-gnu - target: x86_64-unknown-linux-gnu
binary_name: zenyx-x86_64-linux binary_name: zenyx-x86_64-linux
@ -57,9 +98,9 @@ jobs:
- target: aarch64-unknown-linux-gnu - target: aarch64-unknown-linux-gnu
binary_name: zenyx-aarch64-linux binary_name: zenyx-aarch64-linux
ext: "" ext: ""
- target: x86_64-pc-windows-msvc # - target: x86_64-pc-windows-msvc
binary_name: zenyx-x86_64-windows-msvc.exe # binary_name: zenyx-x86_64-windows-msvc.exe
ext: ".exe" # ext: ".exe"
steps: steps:
- name: 📥 Checkout source - name: 📥 Checkout source
@ -71,7 +112,10 @@ jobs:
path: | path: |
~/.cargo/bin ~/.cargo/bin
/tmp/zig /tmp/zig
key: cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} key: cargo-tools-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-tools-
- name: 📍 Add Zig to PATH - name: 📍 Add Zig to PATH
run: echo "/tmp/zig" >> $GITHUB_PATH run: echo "/tmp/zig" >> $GITHUB_PATH
@ -90,20 +134,31 @@ jobs:
~/.cargo/registry ~/.cargo/registry
~/.cargo/git ~/.cargo/git
target target
key: cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} key: cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: | restore-keys: |
cargo-${{ matrix.target }}- cargo-
- name: 🦀 Install Vulkan tools
run: |
apt update
apt install -y vulkan-tools glslc
- name: 🚀 Build release binary - name: 🚀 Build release binary
run: cargo zigbuild --target ${{ matrix.target }} --release uses: https://github.com/actions-rs/cargo@v1
with:
command: zigbuild
args: --target ${{ matrix.target }} --release
- name: 📦 Package artifact - name: 📦 Package artifact
run: | run: |
mkdir -p artifacts mkdir -p artifacts
cp target/${{ matrix.target }}/release/zenyx${{ matrix.ext }} artifacts/${{ matrix.binary_name }} cp target/${{ matrix.target }}/release/zenyx${{ matrix.ext }} artifacts/${{ matrix.binary_name }}
ls
du -sh artifacts
ls -lah artifacts
ls -lah target/${{ matrix.target }}/release
- name: ⬆️ Upload artifact - name: ⬆️ Upload artifact
uses: https://code.forgejo.org/forgejo/upload-artifact@v4 uses: https://code.forgejo.org/forgejo/upload-artifact@v4
with: with:
name: ${{ matrix.binary_name }} name: ${{ matrix.binary_name }}.zip
path: artifacts/${{ matrix.binary_name }} path: artifacts