|
| 1 | +--- |
| 2 | +name: CI-FreeBSD |
| 3 | +permissions: |
| 4 | + contents: read |
| 5 | + |
| 6 | +on: |
| 7 | + workflow_call: |
| 8 | + inputs: |
| 9 | + release_commit: |
| 10 | + required: true |
| 11 | + type: string |
| 12 | + release_version: |
| 13 | + required: true |
| 14 | + type: string |
| 15 | + |
| 16 | +env: |
| 17 | + FREEBSD_CLANG_VERSION: 19 |
| 18 | + |
| 19 | +jobs: |
| 20 | + build_freebsd: |
| 21 | + name: ${{ matrix.cmake_processor }}-${{ matrix.bsd_release }} |
| 22 | + if: github.event_name != 'pull_request' || matrix.pr == true |
| 23 | + runs-on: ubuntu-latest |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + include: |
| 28 | + - bsd_release: "14.3" |
| 29 | + arch: x86_64 |
| 30 | + cmake_processor: amd64 |
| 31 | + pr: true |
| 32 | + runner: ubuntu-latest |
| 33 | + - bsd_release: "14.3" |
| 34 | + arch: aarch64 |
| 35 | + cmake_processor: aarch64 |
| 36 | + pr: false |
| 37 | + runner: ubuntu-latest # ubuntu-24.04-arm is slower with the FreeBSD VM |
| 38 | + steps: |
| 39 | + - name: Checkout |
| 40 | + uses: actions/checkout@v5 |
| 41 | + with: |
| 42 | + submodules: recursive |
| 43 | + |
| 44 | + - name: Get Processor Count |
| 45 | + id: processor_count |
| 46 | + shell: bash |
| 47 | + run: | |
| 48 | + PROCESSOR_COUNT=$(nproc) |
| 49 | + echo "PROCESSOR_COUNT=${PROCESSOR_COUNT}" >> "${GITHUB_OUTPUT}" |
| 50 | + echo "PROCESSOR_COUNT: $PROCESSOR_COUNT" |
| 51 | +
|
| 52 | + - name: Setup FreeBSD |
| 53 | + uses: vmactions/freebsd-vm@v1.2.3 |
| 54 | + with: |
| 55 | + arch: ${{ matrix.arch }} |
| 56 | + cpu: ${{ steps.processor_count.outputs.PROCESSOR_COUNT }} |
| 57 | + # TODO: there is no libcap for freebsd... we need graphics/libdrm if we find a way to use libcap |
| 58 | + # TODO: docs are off because doxygen is too old: https://www.freshports.org/devel/doxygen/ must be >= 1.10 |
| 59 | + prepare: | |
| 60 | + set -e |
| 61 | +
|
| 62 | + pkg update |
| 63 | + pkg upgrade -y |
| 64 | + pkg install -y \ |
| 65 | + audio/opus \ |
| 66 | + audio/pulseaudio \ |
| 67 | + devel/cmake-core \ |
| 68 | + devel/evdev-proto \ |
| 69 | + devel/git \ |
| 70 | + devel/libayatana-appindicator \ |
| 71 | + devel/libevdev \ |
| 72 | + devel/libnotify \ |
| 73 | + devel/llvm${{ env.FREEBSD_CLANG_VERSION }} \ |
| 74 | + devel/ninja \ |
| 75 | + devel/pkgconf \ |
| 76 | + ftp/curl \ |
| 77 | + graphics/libdrm \ |
| 78 | + graphics/wayland \ |
| 79 | + lang/python312 \ |
| 80 | + multimedia/libva \ |
| 81 | + net/miniupnpc \ |
| 82 | + ports-mgmt/pkg \ |
| 83 | + security/openssl \ |
| 84 | + shells/bash \ |
| 85 | + www/npm \ |
| 86 | + x11/libX11 \ |
| 87 | + x11/libxcb \ |
| 88 | + x11/libXfixes \ |
| 89 | + x11/libXrandr \ |
| 90 | + x11/libXtst \ |
| 91 | + x11-servers/xorg-server |
| 92 | +
|
| 93 | + # create symlink for shebang bash compatibility |
| 94 | + ln -s /usr/local/bin/bash /bin/bash |
| 95 | +
|
| 96 | + # setup python |
| 97 | + ln -s /usr/local/bin/python3.12 /usr/local/bin/python |
| 98 | + release: ${{ matrix.bsd_release }} |
| 99 | + run: | |
| 100 | + set -e |
| 101 | +
|
| 102 | + # fix git safe.directory issues |
| 103 | + git config --global --add safe.directory "*" |
| 104 | +
|
| 105 | + # install gcvor |
| 106 | + python -m pip install gcovr |
| 107 | + sync: nfs |
| 108 | + |
| 109 | + - name: Configure |
| 110 | + env: |
| 111 | + BRANCH: ${{ github.head_ref || github.ref_name }} |
| 112 | + BUILD_VERSION: ${{ inputs.release_version }} |
| 113 | + COMMIT: ${{ inputs.release_commit }} |
| 114 | + shell: freebsd {0} |
| 115 | + run: | |
| 116 | + set -e |
| 117 | + cd "${GITHUB_WORKSPACE}" |
| 118 | +
|
| 119 | + export BRANCH="${BRANCH}" |
| 120 | + export BUILD_VERSION="${BUILD_VERSION}" |
| 121 | + export COMMIT="${COMMIT}" |
| 122 | +
|
| 123 | + cc_path="$(which clang${{ env.FREEBSD_CLANG_VERSION }})" |
| 124 | + cxx_path="$(which clang++${{ env.FREEBSD_CLANG_VERSION }})" |
| 125 | +
|
| 126 | + export CC="${cc_path}" |
| 127 | + export CXX="${cxx_path}" |
| 128 | +
|
| 129 | + mkdir -p build |
| 130 | + cmake \ |
| 131 | + -B build \ |
| 132 | + -G Ninja \ |
| 133 | + -S . \ |
| 134 | + -DBUILD_DOCS=OFF \ |
| 135 | + -DBUILD_WERROR=OFF \ |
| 136 | + -DCMAKE_BUILD_TYPE=Release \ |
| 137 | + -DCMAKE_INSTALL_PREFIX=/usr/local \ |
| 138 | + -DSUNSHINE_ASSETS_DIR=share/assets \ |
| 139 | + -DSUNSHINE_EXECUTABLE_PATH=/usr/local/bin/sunshine \ |
| 140 | + -DSUNSHINE_ENABLE_CUDA=OFF \ |
| 141 | + -DSUNSHINE_ENABLE_DRM=OFF \ |
| 142 | + -DSUNSHINE_ENABLE_WAYLAND=OFF \ |
| 143 | + -DSUNSHINE_ENABLE_X11=ON \ |
| 144 | + -DSUNSHINE_PUBLISHER_NAME='${{ github.repository_owner }}' \ |
| 145 | + -DSUNSHINE_PUBLISHER_WEBSITE='https://app.lizardbyte.dev' \ |
| 146 | + -DSUNSHINE_PUBLISHER_ISSUE_URL='https://app.lizardbyte.dev/support' |
| 147 | +
|
| 148 | + - name: Build |
| 149 | + shell: freebsd {0} |
| 150 | + run: | |
| 151 | + set -e |
| 152 | + cd "${GITHUB_WORKSPACE}" |
| 153 | + ninja -C build |
| 154 | +
|
| 155 | + - name: Package |
| 156 | + shell: freebsd {0} |
| 157 | + run: | |
| 158 | + set -e |
| 159 | + cd "${GITHUB_WORKSPACE}" |
| 160 | +
|
| 161 | + mkdir -p artifacts |
| 162 | +
|
| 163 | + cd build |
| 164 | + cpack -G FREEBSD |
| 165 | +
|
| 166 | + # move compiled files to artifacts |
| 167 | + mv ./cpack_artifacts/Sunshine.pkg \ |
| 168 | + ../artifacts/Sunshine-FreeBSD-${{ matrix.bsd_release }}-${{ matrix.cmake_processor }}.pkg |
| 169 | +
|
| 170 | + - name: Debug +MANIFEST |
| 171 | + if: always() |
| 172 | + shell: bash |
| 173 | + working-directory: build/cpack_artifacts |
| 174 | + run: cat ./_CPack_Packages/FreeBSD/FREEBSD/Sunshine/+MANIFEST |
| 175 | + |
| 176 | + - name: Test |
| 177 | + id: test |
| 178 | + if: always() |
| 179 | + shell: freebsd {0} |
| 180 | + run: | |
| 181 | + set -e |
| 182 | + cd "${GITHUB_WORKSPACE}/build/tests" |
| 183 | +
|
| 184 | + export DISPLAY=:1 |
| 185 | + Xvfb ${DISPLAY} -screen 0 1024x768x24 & |
| 186 | +
|
| 187 | + ./test_sunshine --gtest_color=yes --gtest_output=xml:test_results.xml |
| 188 | +
|
| 189 | + - name: Generate gcov report |
| 190 | + id: test_report |
| 191 | + # any except canceled or skipped |
| 192 | + if: >- |
| 193 | + always() && |
| 194 | + (steps.test.outcome == 'success' || steps.test.outcome == 'failure') |
| 195 | + shell: freebsd {0} |
| 196 | + run: | |
| 197 | + cd "${GITHUB_WORKSPACE}/build" |
| 198 | + python -m gcovr . -r ../src \ |
| 199 | + --exclude-noncode-lines \ |
| 200 | + --exclude-throw-branches \ |
| 201 | + --exclude-unreachable-branches \ |
| 202 | + --verbose \ |
| 203 | + --xml-pretty \ |
| 204 | + -o coverage.xml |
| 205 | +
|
| 206 | + - name: Upload coverage artifact |
| 207 | + if: >- |
| 208 | + always() && |
| 209 | + (steps.test_report.outcome == 'success') |
| 210 | + uses: actions/upload-artifact@v4 |
| 211 | + with: |
| 212 | + name: coverage-FreeBSD-${{ matrix.bsd_release }}-${{ matrix.cmake_processor }} |
| 213 | + path: | |
| 214 | + build/coverage.xml |
| 215 | + build/tests/test_results.xml |
| 216 | + if-no-files-found: error |
| 217 | + |
| 218 | + - name: Upload Artifacts |
| 219 | + uses: actions/upload-artifact@v4 |
| 220 | + with: |
| 221 | + name: build-FreeBSD-${{ matrix.bsd_release }}-${{ matrix.cmake_processor }} |
| 222 | + path: artifacts/ |
| 223 | + if-no-files-found: error |
0 commit comments