Files

162 lines
6.7 KiB
YAML

name: Build Linux
on:
workflow_dispatch:
workflow_call:
permissions:
contents: read
concurrency:
group: linux-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GODOT_VERSION: 4.7.2
jobs:
build:
name: Linux ${{ matrix.arch }} build
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: ubuntu-24.04
preset: Linux x64 OpenXR
vulkan_preset: Linux x64 Vulkan
- arch: arm64
runner: ubuntu-24.04-arm
preset: Linux ARM64 OpenXR
vulkan_preset: Linux ARM64 Vulkan
env:
ARCH: ${{ matrix.arch }}
EXPORT_PRESET: ${{ matrix.preset }}
VULKAN_EXPORT_PRESET: ${{ matrix.vulkan_preset }}
defaults:
run:
shell: bash
steps:
- name: Get current date
id: date
run: echo "date=$(date '+%d-%m-%Y')" >> $GITHUB_OUTPUT
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Install build and test dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y \
build-essential cmake pkg-config python3 curl unzip libmpv-dev ffmpeg patchelf
JELLYFRAME_BUNDLE_INTEGRATION=1 python3 -m unittest discover -s tests -p 'test_linux_bundle.py'
- name: Build PC video plugin
run: |
bash tools/build-pc-video.sh
c++ -std=c++17 tests/test_pc_watchdog.cpp -o build/linux/test_pc_watchdog
build/linux/test_pc_watchdog
- name: Install Godot and export templates
run: |
release="${GODOT_VERSION}-stable"
base_url="https://github.com/godotengine/godot-builds/releases/download/${release}"
curl --fail --location --retry 3 "${base_url}/Godot_v${release}_linux.${ARCH}.zip" -o "$RUNNER_TEMP/godot.zip"
curl --fail --location --retry 3 "${base_url}/Godot_v${release}_export_templates.tpz" -o "$RUNNER_TEMP/templates.tpz"
mkdir -p "$RUNNER_TEMP/godot"
unzip -q "$RUNNER_TEMP/godot.zip" -d "$RUNNER_TEMP/godot"
mv "$RUNNER_TEMP/godot/Godot_v${release}_linux.${ARCH}" "$RUNNER_TEMP/godot/godot"
chmod +x "$RUNNER_TEMP/godot/godot"
echo "$RUNNER_TEMP/godot" >> "$GITHUB_PATH"
template_dir="$HOME/.local/share/godot/export_templates/${GODOT_VERSION}.stable"
mkdir -p "$template_dir"
unzip -j -q "$RUNNER_TEMP/templates.tpz" \
"templates/linux_debug.${ARCH}" "templates/linux_release.${ARCH}" \
-d "$template_dir"
- name: Test playback and authenticated streaming
run: |
godot --headless --xr-mode off --path . --editor --import --quit
for test in test_pc_video test_playback_profile test_player_loading test_core test_seek test_recenter test_timeline test_autoplay test_player_return test_player_tooltips; do
timeout 60s godot --headless --xr-mode off --path . --script "tests/${test}.gd"
done
mkdir -p build/linux/hls
ffmpeg -v error -i native/android/src/main/res/raw/stereo_test.mp4 \
-c copy -hls_time 2 -hls_playlist_type vod \
-hls_segment_filename 'build/linux/hls/segment%02d.ts' -y build/linux/hls/stream.m3u8
python3 tests/test_pc_streaming.py --godot "$(command -v godot)" --hls-directory build/linux/hls
- name: Export Linux build
run: |
output="dist/linux-${ARCH}"
mkdir -p "$output"
godot --headless --xr-mode off --path . --export-release "$EXPORT_PRESET" "$output/jellyframe-opengl.${ARCH}"
godot --headless --xr-mode off --path . --export-release "$VULKAN_EXPORT_PRESET" "$output/jellyframe-vulkan.${ARCH}"
test -s "$output/jellyframe-opengl.${ARCH}"
test -s "$output/jellyframe-vulkan.${ARCH}"
test -s "$output/jellyframe_mpv.linux.${ARCH}.so"
chmod +x "$output/jellyframe-opengl.${ARCH}" "$output/jellyframe-vulkan.${ARCH}"
cp -r "build/linux/${ARCH}/licenses" "$output/"
cp "build/linux/${ARCH}/build-info.txt" "$output/"
cp LICENSE "$output/licenses/jellyframe.txt"
cp INSTALLATION.md "$output/README.md"
- name: Check exported application
run: |
output="dist/linux-${ARCH}"
ldd "$output/jellyframe_mpv.linux.${ARCH}.so" | tee "$RUNNER_TEMP/dependencies.log"
if grep -q 'not found' "$RUNNER_TEMP/dependencies.log"; then
echo 'The exported decoder has missing shared libraries.' >&2
exit 1
fi
for renderer in opengl vulkan; do
binary="$output/jellyframe-${renderer}.${ARCH}"
log="$RUNNER_TEMP/jellyframe-${renderer}-smoke.log"
timeout 30s "$binary" --headless --xr-mode off --quit-after 10 --log-file "$log"
test -s "$log"
cat "$log"
if grep -E 'SCRIPT ERROR:|ERROR:' "$log"; then
exit 1
fi
timeout 30s godot --headless --xr-mode off --main-pack "$GITHUB_WORKSPACE/$binary" \
--script "$GITHUB_WORKSPACE/tests/test_export_renderer.gd" -- "$renderer"
done
- name: Bundle decoder libraries
run: |
python3 tools/bundle-linux-libraries.py \
--input-directory "dist/linux-${ARCH}" \
--output-directory "dist/linux-${ARCH}-bundled" --arch "$ARCH"
for renderer in opengl vulkan; do
binary="dist/linux-${ARCH}-bundled/jellyframe-${renderer}.${ARCH}"
log="$RUNNER_TEMP/jellyframe-${renderer}-bundled-smoke.log"
timeout 30s "$binary" --headless --xr-mode off --quit-after 10 --log-file "$log"
if grep -E 'SCRIPT ERROR:|ERROR:' "$log"; then
exit 1
fi
done
- name: Package Linux builds
run: |
tar -czf "dist/jellyframe-linux-${ARCH}-system-libs.tar.gz" -C "dist/linux-${ARCH}" .
tar -czf "dist/jellyframe-linux-${ARCH}-bundled-libs.tar.gz" -C "dist/linux-${ARCH}-bundled" .
- name: Upload Linux build with system libraries
uses: actions/upload-artifact@v7
with:
name: ${{ steps.date.outputs.date }}-jellyframe-linux-${{ matrix.arch }}-system-libs
path: dist/jellyframe-linux-${{ matrix.arch }}-system-libs.tar.gz
if-no-files-found: error
retention-days: 14
- name: Upload Linux build with bundled libraries
uses: actions/upload-artifact@v7
with:
name: ${{ steps.date.outputs.date }}-jellyframe-linux-${{ matrix.arch }}-bundled-libs
path: dist/jellyframe-linux-${{ matrix.arch }}-bundled-libs.tar.gz
if-no-files-found: error
retention-days: 14