## Summary - install the nightly Windows MSVC target and cargo-xwin in CI - build the production Windows executable alongside Linux - package both executables and only imported_assets in one Steam depot Reviewed-on: #50 Co-authored-by: Álex Román Núñez <eirexe@eirteam.moe>
144 lines
4.8 KiB
YAML
144 lines
4.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-and-test:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Rust toolchain
|
|
run: |
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
|
sh -s -- -y --profile minimal
|
|
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
|
"$HOME/.cargo/bin/rustup" toolchain install nightly-2026-09-14 --profile minimal
|
|
|
|
- name: Cache Rust dependencies and build artifacts
|
|
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
|
with:
|
|
prefix-key: v2-rust
|
|
shared-key: linux-nightly
|
|
cache-bin: false
|
|
|
|
- name: Install Linux dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install --no-install-recommends -y \
|
|
clang \
|
|
libasound2-dev \
|
|
libudev-dev \
|
|
libusb-1.0-0-dev \
|
|
libwayland-dev \
|
|
libx11-dev \
|
|
libxkbcommon-dev \
|
|
libxkbcommon-x11-0 \
|
|
mesa-vulkan-drivers \
|
|
mold \
|
|
pkg-config
|
|
|
|
- name: Build
|
|
run: cargo build --locked -j 4
|
|
|
|
- name: Run unit tests
|
|
run: cargo test --locked --lib -j 4
|
|
|
|
production-build:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 45
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Rust toolchain
|
|
run: |
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
|
sh -s -- -y --profile minimal
|
|
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
|
"$HOME/.cargo/bin/rustup" toolchain install nightly-2026-09-14 --profile minimal
|
|
|
|
- name: Install Windows build tooling
|
|
run: |
|
|
"$HOME/.cargo/bin/rustup" target add x86_64-pc-windows-msvc --toolchain nightly-2026-09-14
|
|
"$HOME/.cargo/bin/cargo" install cargo-xwin --locked
|
|
|
|
- name: Cache production Rust dependencies and build artifacts
|
|
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
|
with:
|
|
prefix-key: v2-rust
|
|
shared-key: linux-nightly-production
|
|
cache-bin: false
|
|
|
|
- name: Install Linux dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install --no-install-recommends -y \
|
|
clang-19 \
|
|
libasound2-dev \
|
|
libudev-dev \
|
|
libusb-1.0-0-dev \
|
|
libwayland-dev \
|
|
libx11-dev \
|
|
libxkbcommon-dev \
|
|
libxkbcommon-x11-0 \
|
|
lld-19 \
|
|
llvm-19 \
|
|
mesa-vulkan-drivers \
|
|
mold \
|
|
pkg-config
|
|
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-19 100
|
|
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-19 100
|
|
echo "/usr/lib/llvm-19/bin" >> "$GITHUB_PATH"
|
|
rm -f "$HOME/.cache/cargo-xwin/clang-cl"
|
|
|
|
- name: Preprocess assets
|
|
run: cargo run --locked --bin process-assets --no-default-features --features debug_features -j 4
|
|
|
|
- name: Build production binary
|
|
run: cargo build --locked --profile production --no-default-features --features debug_features -j 4
|
|
|
|
- name: Build Windows production binary
|
|
run: |
|
|
clang --version
|
|
cargo xwin build --locked --target x86_64-pc-windows-msvc --profile production --no-default-features --features debug_features -j 4 --bin shinespark
|
|
|
|
- name: Verify production binary is not Bevy/Rust dynamically linked
|
|
run: |
|
|
! readelf -d target/production/shinespark | grep -E 'libbevy_dylib|libstd-.*\.so'
|
|
|
|
- name: Package Linux Steam depot
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
run: |
|
|
mkdir -p build/game
|
|
cp target/production/shinespark build/game/shinespark
|
|
cp target/x86_64-pc-windows-msvc/production/shinespark.exe build/game/shinespark.exe
|
|
cp -R imported_assets build/game/imported_assets
|
|
|
|
- if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
uses: CyberAndrii/steam-totp@v1
|
|
name: Generate Steam TOTP
|
|
id: steam-totp
|
|
with:
|
|
shared_secret: ${{ secrets.STEAM_SHARED_SECRET }}
|
|
|
|
- name: Deploy Linux build to Steam
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
uses: game-ci/steam-deploy@v3
|
|
with:
|
|
username: ${{ secrets.STEAM_USERNAME }}
|
|
password: ${{ secrets.STEAM_PASSWORD }}
|
|
totp: ${{ steps.steam-totp.outputs.code }}
|
|
appId: 3409670
|
|
buildDescription: ${{ github.sha }}
|
|
rootPath: build
|
|
depot1Path: game
|
|
releaseBranch: master
|