From e11abe4514b25e3a0b7a1374a6900d82bc3fc477 Mon Sep 17 00:00:00 2001 From: mrobertseidowsky Date: Thu, 7 Apr 2022 10:02:42 +0200 Subject: [PATCH] ci android --- .github/meson-android-aarch64.ini | 11 +++++ .github/meson-android-arm.ini | 11 +++++ .github/meson-android-x86_64.ini | 12 +++++ .github/workflows/ci_android.yml | 79 ++++++++++++++++++++++++++++++ .github/workflows/ci_coverage.yml | 31 ------------ .github/workflows/ci_linux.yml | 67 ------------------------- .github/workflows/ci_mac.yml | 31 ------------ .github/workflows/ci_mingw.yml | 40 --------------- .github/workflows/ci_msvc.yml | 81 ------------------------------- README.md | 1 + 10 files changed, 114 insertions(+), 250 deletions(-) create mode 100644 .github/meson-android-aarch64.ini create mode 100644 .github/meson-android-arm.ini create mode 100644 .github/meson-android-x86_64.ini create mode 100644 .github/workflows/ci_android.yml delete mode 100644 .github/workflows/ci_coverage.yml delete mode 100644 .github/workflows/ci_linux.yml delete mode 100644 .github/workflows/ci_mac.yml delete mode 100644 .github/workflows/ci_mingw.yml delete mode 100644 .github/workflows/ci_msvc.yml diff --git a/.github/meson-android-aarch64.ini b/.github/meson-android-aarch64.ini new file mode 100644 index 0000000000..ef18571251 --- /dev/null +++ b/.github/meson-android-aarch64.ini @@ -0,0 +1,11 @@ +[binaries] +c = '/usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android28-clang' +cpp = '/usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android28-clang++' +strip = '/usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-strip' +pkgconfig = '/usr/bin/pkg-config' + +[host_machine] +system = 'android' +cpu_family = 'arm' +cpu = 'aarch64' +endian = 'little' diff --git a/.github/meson-android-arm.ini b/.github/meson-android-arm.ini new file mode 100644 index 0000000000..5124d5c2fe --- /dev/null +++ b/.github/meson-android-arm.ini @@ -0,0 +1,11 @@ +[binaries] +c = '/usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi28-clang' +cpp = '/usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi28-clang++' +strip = '/usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip' +pkgconfig = '/usr/bin/pkg-config' + +[host_machine] +system = 'android' +cpu_family = 'arm' +cpu = 'arm' +endian = 'little' diff --git a/.github/meson-android-x86_64.ini b/.github/meson-android-x86_64.ini new file mode 100644 index 0000000000..1cf1bd02dc --- /dev/null +++ b/.github/meson-android-x86_64.ini @@ -0,0 +1,12 @@ +[binaries] +c = '/usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android28-clang' +cpp = '/usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android28-clang++' +strip = '/usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android-strip' + +pkgconfig = '/usr/bin/pkg-config' + +[host_machine] +system = 'android' +cpu_family = 'x86' +cpu = 'x86_64' +endian = 'little' diff --git a/.github/workflows/ci_android.yml b/.github/workflows/ci_android.yml new file mode 100644 index 0000000000..df4becd03b --- /dev/null +++ b/.github/workflows/ci_android.yml @@ -0,0 +1,79 @@ +# Warning: this name must stay in sync with the badges referenced in the README +name: 'build Android 🤖' + +on: + push: + branches: + - 'master' + pull_request: + +jobs: + android-build: + + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + arch: [x86_64, arm, aarch64] + ffmpeg_version: ["4.4"] + + steps: + - uses: actions/checkout@v2 + + - name: Install dependencies + run: | + sudo apt -y update + sudo apt -y install ninja-build nasm + pip install --user meson + + - name: Get ffmpeg source code + run: | + wget https://ffmpeg.org/releases/ffmpeg-${{ matrix.ffmpeg_version }}.tar.xz + tar -xf ffmpeg-${{ matrix.ffmpeg_version }}.tar.xz + + - name: Compile ffmpeg source with the ndk toolchain for Android & install it to a specific directory + run: | + cd ffmpeg-${{ matrix.ffmpeg_version }} + android_suffix="android" + compiler=${{ matrix.arch }} + + if [ ${{ matrix.arch }} == "arm" ]; then + android_suffix="androideabi" + compiler="armv7a" + fi + + NDK_BIN_PATH=/usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin + ./configure \ + --disable-everything --disable-doc --disable-static --disable-autodetect --disable-programs \ + --enable-shared --enable-cross-compile --enable-jni --enable-mediacodec --enable-hwaccels \ + --enable-avdevice --enable-swresample --enable-rdft \ + --arch=${{ matrix.arch }} --target-os=android \ + --cross-prefix=$NDK_BIN_PATH/${{ matrix.arch }}-linux-${android_suffix}- \ + --cc=$NDK_BIN_PATH/${compiler}-linux-${android_suffix}28-clang \ + --prefix=$HOME/ffmpeg-install-${{ matrix.arch }} + + make install -j$(($(nproc)+1)) + + - name: Build sxplayer lib for Android & reshape tree files + run: | + git clone --depth 1 https://github.com/Stupeflix/sxplayer + cd sxplayer + + PKG_CONFIG_LIBDIR=$HOME/ffmpeg-install-${{ matrix.arch }}/lib/pkgconfig/ \ + meson setup --prefix $HOME/usr/local --cross-file .github/meson-android-${{ matrix.arch }}.ini builddir + meson install -C builddir + meson compile -C builddir -v + + - name: Build nodegl lib for Android + run: | + cd libnodegl + PKG_CONFIG_LIBDIR=$HOME/ffmpeg-install-${{ matrix.arch }}/lib/pkgconfig/:$HOME/usr/local/lib/pkgconfig/ \ + meson setup --cross-file ../.github/meson-android-${{ matrix.arch }}.ini builddir + meson test -C builddir -v + + - name: Upload Logs + if: ${{ always() }} + uses: actions/upload-artifact@v2 + with: + name: android-logs + path: builddir/meson-logs/testlog.txt diff --git a/.github/workflows/ci_coverage.yml b/.github/workflows/ci_coverage.yml deleted file mode 100644 index 821daebcc1..0000000000 --- a/.github/workflows/ci_coverage.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: 'coverage tests Linux' - -on: - push: - branches: - - 'master' - -jobs: - coverage: - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v2 - - - name: Install dependencies - run: | - sudo apt -y update - sudo apt -y install libsdl2-dev python3-venv gcovr - sudo apt -y install ffmpeg libavcodec-dev libavutil-dev libavformat-dev libavdevice-dev libavfilter-dev libswscale-dev libswresample-dev libpostproc-dev - - - name: Run tests - run: | - ./configure.py --buildtype debug --coverage --debug-opts gl scene - make tests - - name: Get coverage - run: | - make coverage-xml - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 - with: - file: builddir/libnodegl/meson-logs/coverage.xml diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml deleted file mode 100644 index 4938fec8ec..0000000000 --- a/.github/workflows/ci_linux.yml +++ /dev/null @@ -1,67 +0,0 @@ -# Warning: this name must stay in sync with the badges referenced in the README -name: 'tests Linux' - -on: - push: - branches: - - 'master' - pull_request: - -jobs: - linux: - - runs-on: ubuntu-20.04 - strategy: - matrix: - include: - - backend: "all" - custom_env: - - backend: "opengles 2" - custom_env: MESA_GLES_VERSION_OVERRIDE=2.0 - - backend: "opengles 3.0" - custom_env: MESA_GLES_VERSION_OVERRIDE=3.0 - - steps: - - uses: actions/checkout@v2 - - - name: Install dependencies - run: | - sudo apt -y update - # - # python3-venv is required to prevent the following issue: - # The virtual environment was not created successfully because ensurepip is not - # available. On Debian/Ubuntu systems, you need to install the python3-venv - # package using the following command. - # - # apt-get install python3-venv - # - sudo apt -y install libsdl2-dev python3-venv valgrind - sudo apt -y install ffmpeg libavcodec-dev libavutil-dev libavformat-dev libavdevice-dev libavfilter-dev libswscale-dev libswresample-dev libpostproc-dev libvulkan-dev - # - # Install a more up-to-date version of glslang (from Ubuntu 21.10) that - # provides the C interface node.gl depends on. - # - wget http://archive.ubuntu.com/ubuntu/pool/universe/s/spirv-tools/spirv-tools_2020.6-2_amd64.deb - wget http://archive.ubuntu.com/ubuntu/pool/universe/g/glslang/glslang-dev_11.1.0-4_amd64.deb - sudo dpkg --install spirv-tools_2020.6-2_amd64.deb - sudo dpkg --install glslang-dev_11.1.0-4_amd64.deb - - - name: Build - run: | - ./configure.py --buildtype debug --debug-opts gl gpu_capture - make - - - name: Python import and dylib runtime test - run: | - . venv/bin/activate - python -c "import pynodegl, pynodegl_utils" - ngl-python -h - - - name: Native lib memory check - run: | - . venv/bin/activate - meson test -C builddir/libnodegl --wrap 'valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1' - - - name: Run tests ${{matrix.backend}} - run: | - ${{matrix.custom_env}} make tests diff --git a/.github/workflows/ci_mac.yml b/.github/workflows/ci_mac.yml deleted file mode 100644 index a4eec5d5bb..0000000000 --- a/.github/workflows/ci_mac.yml +++ /dev/null @@ -1,31 +0,0 @@ -# Warning: this name must stay in sync with the badges referenced in the README -name: 'tests Mac' - -on: - push: - branches: - - 'master' - pull_request: - -jobs: - macos: - - runs-on: macos-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install dependencies - run: | - brew install python3 curl pkg-config sdl2 ffmpeg glslang molten-vk vulkan-headers - - - name: Build - run: | - ./configure.py - make - - - name: Python import and dylib runtime test - run: | - . venv/bin/activate - python -c 'import pynodegl, pynodegl_utils' - ngl-python -h diff --git a/.github/workflows/ci_mingw.yml b/.github/workflows/ci_mingw.yml deleted file mode 100644 index 953c88941a..0000000000 --- a/.github/workflows/ci_mingw.yml +++ /dev/null @@ -1,40 +0,0 @@ -# Warning: this name must stay in sync with the badges referenced in the README -name: 'tests MinGW' - -on: - push: - branches: - - 'master' - pull_request: - -jobs: - mingw: - - runs-on: windows-latest - - defaults: - run: - shell: msys2 {0} - - steps: - - uses: actions/checkout@v2 - - - uses: msys2/setup-msys2@v2 - with: - msystem: MINGW64 # Start a 64 bit Mingw environment - update: true - - - name: Install dependencies - run: | - pacman -S --noconfirm --needed git make mingw-w64-x86_64-{toolchain,ffmpeg,python,python3-pillow,meson,glslang,vulkan-devel} - - - name: Build - run: | - ./configure.py - make - - - name: Python import and dylib runtime test - run: | - . venv/bin/activate - python -c 'import pynodegl, pynodegl_utils' - ngl-python -h diff --git a/.github/workflows/ci_msvc.yml b/.github/workflows/ci_msvc.yml deleted file mode 100644 index dd8d1873ae..0000000000 --- a/.github/workflows/ci_msvc.yml +++ /dev/null @@ -1,81 +0,0 @@ -# Warning: this name must stay in sync with the badges referenced in the README -name: 'tests MSVC' - -on: - push: - branches: - - 'master' - pull_request: - schedule: - - cron: "0 0 * * 6" # Run every Saturday at midnight - -jobs: - msvc: - - runs-on: windows-latest - env: - VCPKG_TRIPLET: x64-windows - VCPKG_INSTALL_PACKAGES: opengl-registry ffmpeg[ffmpeg,ffprobe] sdl2 glslang - VULKAN_SDK_VERSION: 1.3.204.1 - strategy: - matrix: - include: - - build_backend: ninja - - build_backend: vs - - defaults: - run: - shell: pwsh - - steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-python@v2 - with: - python-version: '3.8' - - - name: Get vcpkg cache key - shell: bash - id: get-vcpkg-cache-key - run: | - VCPKG_COMMIT_ID=$(git -C C:/vcpkg rev-parse HEAD) - echo "::set-output name=key::$(echo $VCPKG_COMMIT_ID ${{env.VCPKG_TRIPLET}} ${{env.VCPKG_INSTALL_PACKAGES}} | md5sum | cut -f1 -d" ")" - - - name: Restore vcpkg binary cache archives - id: restore_vcpkg_binary_cache - uses: actions/cache@v2 - with: - path: C:\Users\runneradmin\AppData\Local\vcpkg\archives - key: ${{ steps.get-vcpkg-cache-key.outputs.key }} - - - name: Install dependencies - run: | - iwr https://sdk.lunarg.com/sdk/download/${{env.VULKAN_SDK_VERSION}}/windows/VulkanSDK-${{env.VULKAN_SDK_VERSION}}-Installer.exe -OutFile VulkanSDK-Installer.exe - .\VulkanSDK-Installer.exe --accept-licenses --default-answer --confirm-command install - - iwr https://sdk.lunarg.com/sdk/download/${{env.VULKAN_SDK_VERSION}}/windows/VulkanRT-${{env.VULKAN_SDK_VERSION}}-Installer.exe -OutFile VulkanRT-Installer.exe - .\VulkanRT-Installer.exe /S - - cd C:\vcpkg - .\vcpkg.exe install --triplet ${{env.VCPKG_TRIPLET}} ${{env.VCPKG_INSTALL_PACKAGES}} - - - name: Build (${{matrix.build_backend}}) - run: | - # Disable the Vulkan backend when using the vs backend to workaround - # the following meson error (specific to the CI setup which uses - # resources from multiple drives (C:\ and D:\)): - # ValueError: path is on mount 'C:', start on mount 'D:' - # ERROR: Unhandled python exception - # This is a Meson bug and should be reported! - if ("${{matrix.build_backend}}" -eq "ninja") { - $Env:VULKAN_SDK = "C:/VulkanSDK/${{env.VULKAN_SDK_VERSION}}" - } - .\scripts\msvc-env.ps1 - python.exe .\configure.py --debug-opts gpu_capture --build-backend ${{matrix.build_backend}} - nmake - - - name: Python import and dylib runtime test - run: | - .\venv\Scripts\Activate.ps1 - python.exe -c "import pynodegl, pynodegl_utils" - ngl-python.exe -h diff --git a/README.md b/README.md index 0c1a4d3b6e..336e9f8237 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ and API can change at any time. ![tests MinGW](https://github.com/gopro/gopro-lib-node.gl/workflows/tests%20MinGW/badge.svg) ![tests MSVC](https://github.com/gopro/gopro-lib-node.gl/workflows/tests%20MSVC/badge.svg) [![coverage](https://codecov.io/gh/gopro/gopro-lib-node.gl/branch/master/graph/badge.svg)](https://codecov.io/gh/gopro/gopro-lib-node.gl) +![build Android 🤖](https://github.com/stupeflix/sxplayer/workflows/build%20Android%20🤖/badge.svg) [gopro]: https://gopro.com/