mirror of
https://github.com/WiVRn/WiVRn.git
synced 2026-11-20 00:51:32 -08:00
330 lines
12 KiB
YAML
330 lines
12 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-24.04
|
|
if: ${{ vars.APK_ONLY == '' }}
|
|
|
|
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 libavahi-glib-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 libpipewire-0.3-dev libcli11-dev
|
|
- name: Prepare Vulkan SDK
|
|
uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944
|
|
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_SERVER=ON
|
|
-DWIVRN_BUILD_CLIENT=OFF
|
|
-DWIVRN_BUILD_DISSECTOR=OFF
|
|
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
|
|
-DWIVRN_USE_VAAPI=ON
|
|
-DWIVRN_USE_X264=ON
|
|
-DWIVRN_USE_NVENC=ON
|
|
-DWIVRN_USE_SYSTEM_BOOST=OFF
|
|
-DWIVRN_USE_PULSEAUDIO=ON
|
|
-DWIVRN_USE_PIPEWIRE=ON
|
|
-DWIVRN_WERROR=ON
|
|
|
|
- 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@v2
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
with:
|
|
tag_name: ${{ inputs.ref }}
|
|
generate_release_notes: true
|
|
draft: true
|
|
files: server-build-deps.tar.xz
|
|
|
|
build-server-flatpak:
|
|
name: Linux server (flatpak)
|
|
runs-on: ubuntu-latest
|
|
if: ${{ vars.APK_ONLY == '' }}
|
|
container:
|
|
image: bilelmoussaoui/flatpak-github-actions:freedesktop-23.08
|
|
options: --privileged
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# TODO: replace with version > v6.3 when it's released
|
|
- uses: flatpak/flatpak-github-actions/flatpak-builder@b8be6bc0ede43cb3a2cc55895654312b14f84a0d
|
|
with:
|
|
manifest-path: flatpak/io.github.wivrn.wivrn.yml
|
|
bundle: wivrn-server.flatpak
|
|
upload-artifact: false
|
|
|
|
# Upload manually instead of using flatpak/flatpak-github-actions/flatpak-builder because
|
|
# it uses upload-artifact@v3
|
|
- name: Publish artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: wivrn-server-x86_64
|
|
path: wivrn-server.flatpak
|
|
|
|
build-test-client:
|
|
name: Linux client
|
|
runs-on: ubuntu-24.04
|
|
if: ${{ vars.APK_ONLY == '' }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Prepare Vulkan SDK
|
|
uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944
|
|
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 libxcb-glx0-dev gettext libfontconfig-dev
|
|
|
|
- name: Configure CMake
|
|
run: >
|
|
cmake -B ${{github.workspace}}/build
|
|
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
|
-DCMAKE_INSTALL_PREFIX=/usr
|
|
-DWIVRN_BUILD_SERVER=OFF
|
|
-DWIVRN_BUILD_CLIENT=ON
|
|
-DWIVRN_BUILD_DISSECTOR=OFF
|
|
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
|
|
-DWIVRN_WERROR=ON
|
|
|
|
- name: Build
|
|
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
|
|
|
build-dissector:
|
|
name: Wireshark dissector
|
|
runs-on: ubuntu-24.04
|
|
if: ${{ vars.APK_ONLY == '' }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Prepare Vulkan SDK
|
|
uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944
|
|
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 wireshark wireshark-dev
|
|
|
|
- name: Configure CMake
|
|
run: >
|
|
cmake -B ${{github.workspace}}/build
|
|
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
|
-DCMAKE_INSTALL_PREFIX=/usr
|
|
-DWIVRN_BUILD_SERVER=OFF
|
|
-DWIVRN_BUILD_CLIENT=OFF
|
|
-DWIVRN_BUILD_DISSECTOR=ON
|
|
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
|
|
-DWIVRN_USE_SYSTEM_BOOST=OFF
|
|
-DWIVRN_WERROR=ON
|
|
|
|
- name: Build
|
|
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
|
|
|
build-android:
|
|
name: Android
|
|
runs-on: ubuntu-22.04
|
|
if: ${{ vars.APK_ONLY == '' }}
|
|
|
|
strategy:
|
|
matrix:
|
|
hmd: ['Standard']
|
|
buildtype: ['Release', 'Debug', 'DebugWithValidationLayer', 'Oculus']
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- 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 gettext
|
|
|
|
- name: Check for Secret availability
|
|
id: secret-check
|
|
shell: bash
|
|
run: |
|
|
if [[ "${{ secrets.APK_SIGNINGKEYPASSWORD }}" != '' && "${{ secrets.APK_KEYSTORE_BASE64 }}" != '' ]]; then
|
|
echo "available=true" >> $GITHUB_OUTPUT;
|
|
else
|
|
echo "available=false" >> $GITHUB_OUTPUT;
|
|
fi
|
|
|
|
- name: Secrets
|
|
if: ${{ github.event_name != 'pull_request' && steps.secret-check.outputs.available == 'true' }}
|
|
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: |
|
|
VERSION=$(git describe --tags)
|
|
if [ ${{ matrix.buildtype }} = 'Oculus' ]
|
|
then
|
|
VERSION_CODE=$(git rev-list --count HEAD)
|
|
else
|
|
VERSION_CODE=1
|
|
fi
|
|
|
|
sudo rm /usr/local/bin/cmake
|
|
"${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager" --install "cmake;3.30.3"
|
|
|
|
echo Setting version $VERSION and version code $VERSION_CODE in manifest
|
|
|
|
chmod +x gradlew
|
|
./gradlew -Pwivrn_version=$VERSION -Pwivrn_versionCode=$VERSION_CODE 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
|
|
if: ${{ matrix.buildtype != 'Oculus' }}
|
|
with:
|
|
name: apk-${{ matrix.hmd }}-${{ (github.event_name == 'pull_request' && matrix.buildtype == 'Release') && 'Release-unsigned' || matrix.buildtype }}
|
|
path: apk/*.apk
|
|
retention-days: 30
|
|
|
|
- name: Archive debug symbols
|
|
if: ${{ matrix.buildtype != 'Release' && matrix.buildtype != 'Oculus' }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: symbols-${{ matrix.hmd }}-${{ matrix.buildtype }}
|
|
path: debug/**/*.so
|
|
retention-days: 30
|
|
|
|
- name: Push to Oculus store
|
|
if: ${{ matrix.buildtype == 'Oculus' && startsWith(github.ref, 'refs/tags/') }}
|
|
env:
|
|
OCULUS_TOKEN: ${{ secrets.OCULUS_TOKEN }}
|
|
run: |
|
|
curl -L 'https://www.oculus.com/download_app/?id=5159709737372459' -o ovr-platform-util
|
|
chmod +x ovr-platform-util
|
|
./ovr-platform-util upload-quest-build --app-id 7959676140827574 --token $OCULUS_TOKEN --apk apk/WiVRn-standard-oculus.apk --channel ALPHA --age-group TEENS_AND_ADULTS --draft --debug_symbols_dir debug/ --debug-symbols-pattern '*.so'
|
|
|
|
release:
|
|
name: Create release
|
|
runs-on: ubuntu-22.04
|
|
needs: [build-server, build-android, build-test-client, build-dissector, build-server-flatpak]
|
|
if: success() && startsWith(github.ref, 'refs/tags/')
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Download artifacts (APK)
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: apk
|
|
pattern: '*-Release'
|
|
merge-multiple: true
|
|
|
|
- name: Download artifacts (flatpak)
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: wivrn-server-x86_64
|
|
path: flatpak
|
|
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ inputs.ref }}
|
|
generate_release_notes: true
|
|
draft: true
|
|
files: |
|
|
apk/*.apk
|
|
flatpak/*.flatpak
|
|
|
|
- name: Update release branch
|
|
run: |
|
|
git fetch origin release
|
|
git push origin HEAD:release
|
|
|
|
sync_fork_downstream:
|
|
name: Sync fork downstream
|
|
runs-on: ubuntu-latest
|
|
needs: [build-server, build-android]
|
|
if: ${{ vars.APK_ONLY == '' }} && github.branch == 'master'
|
|
steps:
|
|
- name: Check for DOWNSTREAM_GITHUB_TOKEN
|
|
id: downstream-secret-check
|
|
shell: bash
|
|
run: |
|
|
if [[ "${{ secrets.DOWNSTREAM_GITHUB_TOKEN }}" != '' ]]; then
|
|
echo "available=true" >> $GITHUB_OUTPUT;
|
|
else
|
|
echo "available=false" >> $GITHUB_OUTPUT;
|
|
fi
|
|
- name: Sync fork downstream
|
|
if: ${{ steps.downstream-secret-check.outputs.available == 'true' }}
|
|
run: |
|
|
curl -X POST -H "Accept: application/vnd.github.v3+json" \
|
|
-H "Authorization: token ${{ secrets.DOWNSTREAM_GITHUB_TOKEN }}" \
|
|
https://api.github.com/repos/WiVRn/WiVRn-APK/merge-upstream \
|
|
-d '{"branch":"master"}'
|