name: Build on: push: pull_request: 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 == '' }} strategy: matrix: cmake_preset: ['server', 'server-no-systemd', 'server-no-system-boost', 'dashboard'] steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: ccache uses: hendrikmuhs/ccache-action@v1.2 with: create-symlink: 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 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 qt6-base-dev qt6-tools-dev libcap-dev policykit-1 libboost-all-dev librsvg2-bin libssl-dev libnotify-dev - name: Prepare Vulkan SDK uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944 with: vulkan-query-version: 1.3.283.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 --preset ${{ matrix.cmake_preset }} - name: Package build dependencies if: ${{ matrix.cmake_preset == 'server' }} # 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 if: ${{ matrix.cmake_preset == 'server' }} 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/') && matrix.cmake_preset == 'server' 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-24.04 if: ${{ vars.APK_ONLY == '' }} container: image: bilelmoussaoui/flatpak-github-actions:freedesktop-23.08 options: --privileged steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Create the flatpak manifest run: | git config --global --add safe.directory $(pwd) tools/gen_flatpak_manifest.py --git https://github.com/${{github.repository}}.git > io.github.wivrn.wivrn.yml # TODO: replace with version > v6.3 when it's released - uses: flatpak/flatpak-github-actions/flatpak-builder@b8be6bc0ede43cb3a2cc55895654312b14f84a0d with: manifest-path: 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: ccache uses: hendrikmuhs/ccache-action@v1.2 with: create-symlink: true - name: Prepare Vulkan SDK uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944 with: vulkan-query-version: 1.3.283.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 libboost-all-dev librsvg2-bin libssl-dev sway grim mesa-vulkan-drivers wayland-protocols fonts-noto-cjk fonts-roboto - name: install server dependencies run: > sudo apt-get update && sudo apt-get install libavahi-glib-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev qt6-base-dev qt6-tools-dev libcap-dev policykit-1 libnotify-dev - name: Configure CMake run: > cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=/usr --preset everything -DWIVRN_BUILD_DASHBOARD=OFF -DWIVRN_BUILD_DISSECTOR=OFF - name: Build run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - name: Build Monado # Disable XRT_FEATURE_OPENXR_VISIBILITY_MASK because of https://gitlab.freedesktop.org/monado/monado/-/issues/480 run: | mkdir monado curl https://gitlab.freedesktop.org/Meumeu/monado/-/archive/5bdb51697685320e3f5d494210f25fb2967c9fc3/monado-main.tar.gz | tar -xz -C monado --strip-components=1 patch --directory=${{github.workspace}}/monado --strip=1 < ${{github.workspace}}/patches/monado-ci/0001-remote-resolution.patch DRIVERS=$(grep -oE "XRT_BUILD_DRIVER_[A-Z0-9_]*" monado/CMakeLists.txt | sort -u | grep -v XRT_BUILD_DRIVER_REMOTE | sed 's/\(.*\)/-D\1=OFF/') cmake monado -B ${{github.workspace}}/build-monado -DCMAKE_BUILD_TYPE=Release -DXRT_FEATURE_SERVICE_SYSTEMD=OFF -DXRT_FEATURE_SERVICE=OFF -DXRT_BUILD_DRIVER_REMOTE=ON -DXRT_MODULE_COMPOSITOR_MAIN=ON -DXRT_HAVE_WAYLAND=ON $DRIVERS -DXRT_MODULE_MONADO_REMOTECTL=ON -DBUILD_TESTING=OFF -DXRT_FEATURE_OPENXR_VISIBILITY_MASK=OFF cmake --build ${{github.workspace}}/build-monado - name: Take screenshots continue-on-error: true env: WLR_BACKENDS: headless WLR_RENDERER: pixman WLR_LIBINPUT_NO_DEVICES: 1 XR_RUNTIME_JSON: ${{github.workspace}}/build-monado/openxr_monado-dev.json P_OVERRIDE_ACTIVE_CONFIG: remote WIVRN_CONTROLLER: meta-quest-touch-plus WIVRN_GRIP_LEFT_OFFSET: '0 0 0 0 45 0' WIVRN_GRIP_RIGHT_OFFSET: '0 0 0 0 45 0' XRT_COMPOSITOR_SCALE_PERCENTAGE: '100' run: | echo "xwayland disable" > sway-config echo -e "output HEADLESS-1 {\n mode 2560x1440@60Hz\n}" >> sway-config sway -c sway-config & sleep 10 export WAYLAND_DISPLAY=$(cd "${XDG_RUNTIME_DIR}" && ls -tr wayland* | tail -1) mkdir -p ~/.config/fontconfig cp ${{github.workspace}}/.github/fonts.conf ~/.config/fontconfig/fonts.conf ${{github.workspace}}/build/server/wivrn-server --no-encrypt --no-publish-service & WIVRN_SERVER_PID=$! mkdir -p ~/.config/wivrn echo '{"servers": [{"autoconnect": false, "manual": true, "pretty_name": "Deep Thought", "hostname": "localhost", "port": 9757, "tcp_only": false, "cookie": ""}]}' > ~/.config/wivrn/client.json.in for LANG in en $(basename -a ${{github.workspace}}/locale/*) do mkdir ${LANG} if [ ${LANG} = fr ] then cat ~/.config/wivrn/client.json.in | jq .virtual_keyboard_layout=\"AZERTY\" > ~/.config/wivrn/client.json else cat ~/.config/wivrn/client.json.in | jq .virtual_keyboard_layout=\"QWERTY\" > ~/.config/wivrn/client.json fi ${{github.workspace}}/build/bin/wivrn & WIVRN_PID=$! sleep 10 ${{github.workspace}}/build-monado/src/xrt/targets/remotectl/monado-remotectl 127.0.0.1 4242 < ${{github.workspace}}/.github/screenshot-script.txt killall wivrn wait $WIVRN_PID || true done killall wivrn-server wait $WIVRN_SERVER_PID || true - name: Upload screenshots uses: actions/upload-artifact@v4 with: name: Screenshots path: "*/screenshot-*.png" build-dissector: name: Wireshark dissector runs-on: ubuntu-24.04 if: ${{ vars.APK_ONLY == '' }} strategy: matrix: # Ubuntu 24.04 has boost 1.83, the dissector requires 1.84 # cmake_preset: ['dissector', 'dissector-no-system-boost'] cmake_preset: ['dissector-no-system-boost'] 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 libopenxr-dev wireshark wireshark-dev libssl-dev - name: Configure CMake run: > cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=/usr --preset ${{ matrix.cmake_preset }} - 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 wget https://github.com/KhronosGroup/KTX-Software/releases/download/v4.3.2/KTX-Software-4.3.2-Linux-x86_64.deb sudo dpkg --install KTX-Software-4.3.2-Linux-x86_64.deb - 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 --always) if [ ${{ matrix.buildtype }} = 'Oculus' ] then SUFFIX="" VERSION_CODE=$(( 2 * $(git rev-list --count HEAD) )) if [ ${{ github.ref_type }} = 'tag' ] then VERSION_CODE=$(( $VERSION_CODE + 1 )) fi CSS=images/wivrn-release.css APPNAME=WiVRn else VERSION_CODE=1 if [ ${{ github.ref_type }} = 'tag' ] then SUFFIX=".github" CSS=images/wivrn-release.css APPNAME="WiVRn" else SUFFIX=".github.testing" CSS=images/wivrn-nightly.css APPNAME="WiVRn Testing" fi 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 echo Using stylesheet $CSS and name $APPNAME chmod +x gradlew ./gradlew -Pwivrn_version=$VERSION -Pwivrn_versionCode=$VERSION_CODE -Psuffix=$SUFFIX -Pwivrn_css=$CSS -Pwivrn_app_name="$APPNAME" assemble${{ matrix.hmd }}${{ matrix.buildtype }} - name: Upload build dir uses: actions/upload-artifact@v4 if: failure() with: name: android-cxx-debug-${{ matrix.buildtype }} path: .cxx include-hidden-files: true retention-days: 1 - 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/') || github.ref == 'refs/heads/master') }} 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 if [ ${{ github.ref_type }} = 'tag' ] then CHANNEL=RC IS_DRAFT=--draft else CHANNEL=NIGHTLY IS_DRAFT= fi ./ovr-platform-util upload-quest-build --app-id 7959676140827574 --token $OCULUS_TOKEN --apk apk/WiVRn-standard-oculus.apk --channel $CHANNEL --age-group TEENS_AND_ADULTS $IS_DRAFT --debug_symbols_dir debug/ --debug-symbols-pattern '*.so' build-ubuntu: name: Build Ubuntu package if: ${{ vars.APK_ONLY == '' }} strategy: fail-fast: false matrix: distro: ['ubuntu-24.04'] runs-on: ${{ matrix.distro }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 path: wivrn - name: Download monado run: | MONADO_COMMIT=$(grep -zo "FetchContent_Declare(monado[^)]*)" wivrn/CMakeLists.txt | sed -ze "s/^.*GIT_TAG *\([^ )]*\).*$/\1/" | tr -d '\0') wget https://gitlab.freedesktop.org/monado/monado/-/archive/$MONADO_COMMIT/monado-$MONADO_COMMIT.tar.gz mkdir wivrn/monado-src tar xzf monado-*.tar.gz --strip-components=1 -C wivrn/monado-src - name: Patch monado working-directory: wivrn/monado-src run: ../patches/apply.sh ../patches/monado/* - name: Edit changelog (nightly) if: ${{ ! startsWith(github.ref, 'refs/tags/') }} working-directory: wivrn/debian run: | mv changelog changelog.orig echo "wivrn ("$( (git describe --tags || echo 0) | sed s/^v//)") "$(lsb_release -c -s)"; urgency=medium" > changelog echo "" >> changelog echo " * Nightly build" >> changelog echo "" >> changelog echo " -- github-actions <41898282+github-actions@users.noreply.github.com> "$(date -R) >> changelog echo "" >> changelog cat changelog.orig | sed s/unstable/$(lsb_release -c -s)/ >> changelog cat changelog - name: Edit changelog (release) if: ${{ ! startsWith(github.ref, 'refs/tags/') }} working-directory: wivrn/debian run: | sed -i s/unstable/$(lsb_release -c -s)/ changelog cat changelog - name: Install dependencies run: | sudo apt update sudo apt install 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 qt6-base-dev qt6-tools-dev libcap-dev policykit-1 libboost-all-dev librsvg2-bin dpkg-dev pkg-config debhelper-compat build-essential lintian cmake libnotify-dev - name: Build package working-directory: wivrn run: dpkg-buildpackage --build=binary --no-sign - name: Publish package uses: actions/upload-artifact@v4 with: name: wivrn-${{ matrix.distro }} path: | *.deb *.ddeb - name: Check package working-directory: wivrn run: lintian --fail-on error | sed -e s/^W:/::warning::/ -e s/^E:/::error::/ release: name: Create release runs-on: ubuntu-22.04 needs: [build-server, build-android, build-test-client, build-dissector, build-server-flatpak, build-ubuntu] if: success() && startsWith(github.ref, 'refs/tags/') steps: - uses: actions/checkout@v4 with: fetch-depth: 0 path: wivrn - uses: actions/checkout@v4 with: fetch-depth: 0 repository: WiVRn/io.github.wivrn.wivrn path: flathub token: ${{ secrets.FLATHUB_TOKEN }} - 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: Download artifacts (deb) uses: actions/download-artifact@v4 with: name: wivrn-ubuntu-24.04 path: ubuntu - name: Release uses: softprops/action-gh-release@v2 with: tag_name: ${{ inputs.ref }} generate_release_notes: true draft: true files: | apk/*.apk flatpak/*.flatpak ubuntu/*.deb ubuntu/*.ddeb - name: Update flatpak manifest for flathub run: | WIVRN_TAG=$(echo $GITHUB_REF | sed -E -e "s,refs/[^/]*/v?,,") git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" git config --global user.name "github-actions[bot]" cd flathub git remote add upstream https://github.com/flathub/io.github.wivrn.wivrn.git git fetch upstream git reset --hard upstream/master git config --global --add safe.directory $(pwd) ../wivrn/tools/gen_flatpak_manifest.py --git https://github.com/${{github.repository}}.git > io.github.wivrn.wivrn.yml git checkout -b $WIVRN_TAG git add io.github.wivrn.wivrn.yml git commit -m "Version "$WIVRN_TAG git push --set-upstream origin $WIVRN_TAG git show - name: Update release branch run: | cd wivrn git fetch origin release git push origin HEAD:release sync_fork_downstream: name: Sync fork downstream runs-on: ubuntu-24.04 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"}'