CI for mpv builds

This commit is contained in:
Damontecres 2025-11-05 16:20:32 -05:00
parent 5563935a51
commit 7c63164103
No known key found for this signature in database
3 changed files with 96 additions and 37 deletions

65
.github/actions/native-build.yml vendored Normal file
View file

@ -0,0 +1,65 @@
name: "Native build"
description: "Performs native builds"
inputs:
cache:
description: "Whether to use the cache or not"
required: true
runs:
using: "composite"
steps:
- name: Load ffmpeg module cache
id: cache_ffmpeg_module
if: ${{ inputs.cache }}
uses: actions/cache/restore@v4
with:
path: |
app/libs
key: ${{ runner.os }}-ffmpeg-${{ hashFiles('**/libs.versions.toml', '**/build_ffmpeg_decoder.sh') }}
- name: Build ffmpeg decoder
id: ffmpeg-decoder
if: steps.cache_ffmpeg_module.outputs.cache-hit != 'true'
run: |
./build_ffmpeg_decoder.sh "${{ env.ANDROID_SDK_ROOT }}/ndk/${{ env.NDK_VERSION }}"
- name: Save ffmpeg module cache
id: cache_ffmpeg_module_save
uses: actions/cache/save@v4
with:
path: |
app/libs
key: ${{ steps.cache_ffmpeg_module.outputs.cache-primary-key }}
- name: Load libmpv module cache
id: cache_libmpv_module
if: ${{ inputs.cache }}
uses: actions/cache/restore@v4
with:
path: |
app/src/main/libs
key: ${{ runner.os }}-libmpv-${{ hashFiles('**/scripts/mpv/*.sh', '**/scripts/mpv/include/*', '**/scripts/mpv/scripts/*') }}
- name: Install python dependencies
if: steps.cache_libmpv_module.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install jsonschema jinja2 meson
- name: Get libmpv dependencies
if: steps.cache_libmpv_module.outputs.cache-hit != 'true'
run: |
cd scripts/mpv
./get_dependencies
- name: Build libmpv dependencies
if: steps.cache_libmpv_module.outputs.cache-hit != 'true'
run: |
cd scripts/mpv
./buildall.sh --clean --arch arm64 mpv
./buildall.sh mpv
cd ../..
env PREFIX32="$(realpath prefix/armv7l)" PREFIX64="$(realpath prefix/arm64)" ndk-build -C app/src/main -j
ln -s app/src/main/libs app/src/main/jnilibs
- name: Save libmpv module cache
id: cache_libmpv_module_save
uses: actions/cache/save@v4
with:
path: |
app/src/main/libs
key: ${{ steps.cache_libmpv_module.outputs.cache-primary-key }}

26
.github/actions/setup.yml vendored Normal file
View file

@ -0,0 +1,26 @@
name: Setup
description: "Setup the environment"
runs:
using: "composite"
steps:
- name: Checkout the code
uses: actions/checkout@v5
with:
fetch-depth: 0 # Need the tags to build
# Setup the SDKs
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Setup JDK
uses: actions/setup-java@v5
with:
distribution: zulu
java-version: '21'
cache: 'gradle'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
packages: "tools platform-tools build-tools;36.0.0 ndk;29.0.14206865"

View file

@ -8,10 +8,7 @@ defaults:
shell: bash
env:
BUILD_TOOLS_VERSION: 36.0.0
BUILD_DIRS_ARTIFACT: build-dirs
NDK_VERSION: "29.0.14206865"
jobs:
pre-commit:
@ -32,41 +29,12 @@ jobs:
runs-on: ubuntu-latest
needs: pre-commit
steps:
- name: Checkout the code
uses: actions/checkout@v5
- name: Setup
uses: ./.github/actions/setup.yml
- name: Native build
uses: ./.github/actions/native-build.yml
with:
fetch-depth: 0 # Need the tags to build
- name: Setup JDK
uses: actions/setup-java@v5
with:
distribution: zulu
java-version: '21'
cache: 'gradle'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
packages: "tools platform-tools build-tools;${{ env.BUILD_TOOLS_VERSION }} ndk;${{ env.NDK_VERSION }}"
- name: Load ffmpeg module cache
id: cache_ffmpeg_module
uses: actions/cache/restore@v4
with:
path: |
app/libs
key: ${{ runner.os }}-ffmpeg-${{ hashFiles('**/libs.versions.toml', '**/build_ffmpeg_decoder.sh') }}
- name: Build ffmpeg decoder
id: ffmpeg-decoder
if: steps.cache_ffmpeg_module.outputs.cache-hit != 'true'
run: |
./build_ffmpeg_decoder.sh "${{ env.ANDROID_SDK_ROOT }}/ndk/${{ env.NDK_VERSION }}"
- name: Save ffmpeg module cache
id: cache_ffmpeg_module_save
uses: actions/cache/save@v4
with:
path: |
app/libs
key: ${{ steps.cache_ffmpeg_module.outputs.cache-primary-key }}
cache: true
- name: Build app
id: buildapp
run: |