From e82d9045a4625076fafafa6c4f76b35101a3adca Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Sun, 26 Feb 2023 13:05:49 -0600 Subject: [PATCH] ci: separate meson tests and reorganize build steps Instead of running the test directly in the build script, we can make a separate step in the workflow so it looks a little prettier. For running the actual tests, we skip mingw since they will never be run (cross compiled). Additionally, improve the github workflow logic a bit so that way logs on failure are only shown when that specific step fails. The freebsd job still has to be less elegant since it's in a weird vm thingy. Not really related but the location of various build directories (particularly waf) are corrected as well (might as well). --- .github/workflows/build.yml | 72 +++++++++++++++++++++++++++++-------- ci/build-freebsd.sh | 2 +- ci/build-macos.sh | 4 +-- ci/build-mingw64.sh | 5 ++- ci/build-msys2.sh | 2 -- ci/build-tumbleweed.sh | 2 -- 6 files changed, 62 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 35ac51f1cd..3250162fa2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,26 +37,28 @@ jobs: TARGET: ${{ matrix.target }} - name: Build with meson + id: build run: | ./ci/build-mingw64.sh meson pack env: TARGET: ${{ matrix.target }} - name: Print meson log - if: ${{ failure() }} + if: steps.build.outcome == 'failure' run: | cat ./build/meson-logs/meson-log.txt - name: Build with waf + id: build_waf run: | ./ci/build-mingw64.sh waf env: TARGET: ${{ matrix.target }} - name: Print waf log - if: ${{ failure() }} + if: steps.build_waf.outcome == 'failure' run: | - cat ./build/config.log + cat ./build_waf/config.log - uses: actions/upload-artifact@v3 with: @@ -86,6 +88,7 @@ jobs: brew install autoconf automake pkg-config libtool python freetype fribidi little-cms2 lua@5.1 libass ffmpeg meson - name: Build with meson + id: build run: | ./ci/build-macos.sh meson env: @@ -93,11 +96,22 @@ jobs: TRAVIS_OS_NAME: "${{ matrix.os }}" - name: Print meson log - if: ${{ failure() }} + if: steps.build.outcome == 'failure' run: | cat ./build/meson-logs/meson-log.txt + - name: Run meson tests + id: tests + run: | + meson test -C build + + - name: Print meson test log + if: steps.tests.outcome == 'failure' + run: | + cat ./build/meson-logs/testlog.txt + - name: Build with waf + id: build_waf run: | ./ci/build-macos.sh waf env: @@ -105,9 +119,9 @@ jobs: TRAVIS_OS_NAME: "${{ matrix.os }}" - name: Print waf log - if: ${{ failure() }} + if: steps.build_waf.outcome == 'failure' run: | - cat ./build/config.log + cat ./build_waf/config.log linux: runs-on: "ubuntu-22.04" @@ -130,22 +144,34 @@ jobs: git config --global --add safe.directory "$GITHUB_WORKSPACE" - name: Build with meson + id: build run: | ./ci/build-tumbleweed.sh meson - name: Print meson log - if: ${{ failure() }} + if: steps.build.outcome == 'failure' run: | cat ./build/meson-logs/meson-log.txt + - name: Run meson tests + id: tests + run: | + meson test -C build + + - name: Print meson test log + if: steps.tests.outcome == 'failure' + run: | + cat ./build/meson-logs/testlog.txt + - name: Build with waf + id: build_waf run: | ./ci/build-tumbleweed.sh waf - name: Print waf log - if: ${{ failure() }} + if: steps.build_waf.outcome == 'failure' run: | - cat ./build/config.log + cat ./build_waf/config.log freebsd: runs-on: macos-12 # until https://github.com/actions/runner/issues/385 @@ -195,16 +221,22 @@ jobs: # run: | ./ci/build-freebsd.sh + meson test -C build - name: Print meson log if: ${{ failure() }} run: | cat ./build/meson-logs/meson-log.txt + - name: Print meson test log + if: ${{ failure() }} + run: | + cat ./build/meson-logs/testlog.txt + - name: Print waf log if: ${{ failure() }} run: | - cat ./build/config.log + cat ./build_waf/config.log msys2: runs-on: windows-latest @@ -253,19 +285,31 @@ jobs: vulkan:p - name: Build with meson + id: build run: | ./ci/build-msys2.sh meson - name: Print meson log - if: ${{ failure() }} + if: steps.build.outcome == 'failure' run: | - cat ./build_meson/meson-logs/meson-log.txt + cat ./build/meson-logs/meson-log.txt + + - name: Run meson tests + id: tests + run: | + meson test -C build + + - name: Print meson test log + if: steps.tests.outcome == 'failure' + run: | + cat ./build/meson-logs/testlog.txt - name: Build with waf + id: build_waf run: | ./ci/build-msys2.sh waf - name: Print waf log - if: ${{ failure() }} + if: steps.build_waf.outcome == 'failure' run: | - cat ./build/config.log + cat ./build_waf/config.log diff --git a/ci/build-freebsd.sh b/ci/build-freebsd.sh index f08af6418b..39afe57f2d 100755 --- a/ci/build-freebsd.sh +++ b/ci/build-freebsd.sh @@ -12,6 +12,7 @@ meson setup build \ -Dopenal=enabled \ -Dsdl2=enabled \ -Dsndio=enabled \ + -Dtests=true \ -Dvdpau=enabled \ -Dvulkan=enabled \ -Doss-audio=enabled \ @@ -22,7 +23,6 @@ meson setup build \ $NULL meson compile -C build -meson test -C build ./build/mpv -v --no-config if [ ! -e "./waf" ] ; then diff --git a/ci/build-macos.sh b/ci/build-macos.sh index 00124107a0..3b3255b8a6 100755 --- a/ci/build-macos.sh +++ b/ci/build-macos.sh @@ -14,13 +14,11 @@ if [[ $1 = "meson" ]]; then PKG_CONFIG_PATH="${FFMPEG_SYSROOT}/lib/pkgconfig/" CC="${CC}" CXX="${CXX}" \ meson setup build \ -Dprefix="${MPV_INSTALL_PREFIX}" \ - -Dlibmpv=true \ + -D{libmpv,tests}=true \ -D{gl,iconv,lcms2,lua,jpeg,plain-gl,zlib}=enabled \ -D{cocoa,coreaudio,gl-cocoa,macos-cocoa-cb,macos-touchbar,videotoolbox-gl}=enabled meson compile -C build -j4 - meson test -C build - meson install -C build ./build/mpv -v --no-config fi diff --git a/ci/build-mingw64.sh b/ci/build-mingw64.sh index 6ac2f262ed..bd0c07cd0c 100755 --- a/ci/build-mingw64.sh +++ b/ci/build-mingw64.sh @@ -200,16 +200,15 @@ rm -rf build if [ "$1" = "meson" ]; then meson setup build --cross-file "$prefix_dir/crossfile" \ --buildtype debugoptimized \ - -D{libmpv,tests}=true -Dlua=luajit \ + -Dlibmpv=true -Dlua=luajit \ -D{shaderc,spirv-cross,d3d11,libplacebo}=enabled meson compile -C build - meson test -C build elif [ "$1" = "waf" ]; then PKG_CONFIG=pkg-config ./waf configure \ --out=build_waf \ --enable-libmpv-shared --lua=luajit \ - --enable-{shaderc,spirv-cross,d3d11,libplacebo,tests} + --enable-{shaderc,spirv-cross,d3d11,libplacebo} ./waf build fi diff --git a/ci/build-msys2.sh b/ci/build-msys2.sh index 0afd93e789..a044f61447 100755 --- a/ci/build-msys2.sh +++ b/ci/build-msys2.sh @@ -24,7 +24,6 @@ if [ "$1" = "meson" ]; then -D vulkan=enabled meson compile -C build cp ./build/generated/mpv.com ./build - meson test -C build ./build/mpv.com -v --no-config fi @@ -47,7 +46,6 @@ if [ "$1" = "waf" ]; then --enable-rubberband \ --enable-shaderc \ --enable-spirv-cross \ - --enable-tests \ --enable-uchardet \ --enable-vapoursynth \ --lua=luajit \ diff --git a/ci/build-tumbleweed.sh b/ci/build-tumbleweed.sh index 44020848fa..11a13f597c 100755 --- a/ci/build-tumbleweed.sh +++ b/ci/build-tumbleweed.sh @@ -14,7 +14,6 @@ if [ "$1" = "meson" ]; then -Dtests=true \ -Dvulkan=enabled meson compile -C build - meson test -C build ./build/mpv -v --no-config fi @@ -29,7 +28,6 @@ if [ "$1" = "waf" ]; then --enable-manpage-build \ --enable-pipewire \ --enable-shaderc \ - --enable-tests \ --enable-vulkan python3 ./waf build ./build_waf/mpv -v --no-config