Files
WiVRn/.github/workflows/Build.yml
T

175 lines
6.2 KiB
YAML

name: Build
on:
push:
pull_request:
branches: [ "master" ]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build-server:
name: Linux server
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: >
sudo apt-get update && sudo apt-get install libvulkan-dev libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev libpulse-dev xz-utils nvidia-cuda-toolkit libnvidia-encode-535-server
- name: Prepare Vulkan SDK
uses: humbletim/[email protected]
with:
vulkan-query-version: 1.3.275.0
vulkan-components: Vulkan-Headers
vulkan-use-cache: true
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=/usr -DWIVRN_BUILD_CLIENT=OFF -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DWIVRN_USE_VAAPI=ON -DWIVRN_USE_X264=ON -DWIVRN_USE_NVENC=ON -DWIVRN_USE_SYSTEM_BOOST=OFF
- name: Package build dependencies
# For easier packaging, build dependencies are made available as a separate archive
run: (cd build/_deps/ ; tar --create --xz *-src) > server-build-deps.tar.xz
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Publish build dependencies
uses: actions/upload-artifact@v4
with:
name: server-build-deps
path: server-build-deps.tar.xz
- name: Release build dependencies
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
tag_name: ${{ inputs.ref }}
generate_release_notes: true
draft: true
files: server-build-deps.tar.xz
build-test-client:
name: Linux client
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare Vulkan SDK
uses: humbletim/[email protected]
with:
vulkan-query-version: 1.3.268.0
vulkan-components: Vulkan-Headers
vulkan-use-cache: true
- name: Install dependencies
run: >
sudo apt-get update && sudo apt-get install libvulkan-dev libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev libopenxr-dev
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=/usr -DWIVRN_BUILD_SERVER=OFF -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
build-android:
name: Android
runs-on: ubuntu-22.04
strategy:
matrix:
hmd: ['Standard', 'Pico']
buildtype: ['Release', 'Debug', 'DebugWithValidationLayer']
steps:
- uses: actions/checkout@v4
with:
lfs: ${{ matrix.hmd == 'Pico' }}
fetch-depth: 0
- name: Checkout LFS objects
run: git lfs checkout
if: ${{ matrix.hmd == 'Pico' }}
- name: set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Install dependencies
run: >
sudo apt-get update && sudo apt-get install glslang-tools librsvg2-bin
- name: Secrets
if: ${{ github.event_name != 'pull_request' }}
env:
APK_SIGNINGKEYPASSWORD: ${{ secrets.APK_SIGNINGKEYPASSWORD }}
APK_KEYSTORE_BASE64: ${{ secrets.APK_KEYSTORE_BASE64 }}
run: |
echo signingKeyPassword="$APK_SIGNINGKEYPASSWORD" > gradle.properties
echo "$APK_KEYSTORE_BASE64" | base64 --decode --ignore-garbage > ks.keystore
- name: Build
run: |
chmod +x gradlew
./gradlew assemble${{ matrix.hmd }}${{ matrix.buildtype }}
- name: Prepare before archiving artifacts
run: |
mkdir apk
mv $(find build/outputs/apk/ -name "*.apk") apk/
mkdir debug
mv build/intermediates/merged_native_libs/*/out/lib/* debug/
find debug -name libopenxr_loader.so -delete
- name: Archive APK
uses: actions/upload-artifact@v4
with:
name: apk-${{ matrix.hmd }}-${{ (github.event_name == 'pull_request' && matrix.buildtype == 'Release') && 'Release-unsigned' || matrix.buildtype }}
path: apk/*.apk
- name: Archive debug symbols
if: ${{ matrix.buildtype != 'Release' }}
uses: actions/upload-artifact@v4
with:
name: symbols-${{ matrix.hmd }}-${{ matrix.buildtype }}
path: debug/**/*.so
release:
name: Create release
runs-on: ubuntu-22.04
if: success() && startsWith(github.ref, 'refs/tags/')
needs: build-android
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: apk
pattern: '*-Release'
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ inputs.ref }}
generate_release_notes: true
draft: true
files: |
apk/*.apk