|
| 1 | +name: Publish Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + tags: |
| 8 | + - release/* |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + master |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + name: Build |
| 16 | + runs-on: ubuntu-latest |
| 17 | + container: |
| 18 | + image: debian:bullseye |
| 19 | + env: |
| 20 | + DEBIAN_FRONTEND: noninteractive |
| 21 | + strategy: |
| 22 | + matrix: |
| 23 | + target: |
| 24 | + - arm-linux-gnueabihf |
| 25 | + - aarch64-linux-gnu |
| 26 | + - x86_64-linux-gnu |
| 27 | + buildtype: |
| 28 | + - debug |
| 29 | + - release |
| 30 | + include: |
| 31 | + - target: 'x86_64-linux-gnu' |
| 32 | + is-cross: false |
| 33 | + debian-arch: 'amd64' |
| 34 | + |
| 35 | + - target: 'aarch64-linux-gnu' |
| 36 | + is-cross: true |
| 37 | + debian-arch: 'arm64' |
| 38 | + |
| 39 | + - target: 'arm-linux-gnueabihf' |
| 40 | + is-cross: true |
| 41 | + debian-arch: 'armhf' |
| 42 | + |
| 43 | + steps: |
| 44 | + - name: Add debian multiarch |
| 45 | + if: matrix.is-cross |
| 46 | + run: dpkg --add-architecture ${{ matrix.debian-arch }} |
| 47 | + |
| 48 | + # git needs to be installed before checking out, otherwise the checkout will fallback to the REST API, |
| 49 | + # and the submodule download won't work. |
| 50 | + - name: Install dependencies |
| 51 | + env: |
| 52 | + ARCH: ${{ matrix.debian-arch }} |
| 53 | + run: | |
| 54 | + apt-get update && apt-get install -y \ |
| 55 | + git cmake ninja-build clang lld \ |
| 56 | + libdrm-dev:$ARCH libgbm-dev:$ARCH libsystemd-dev:$ARCH libinput-dev:$ARCH libudev-dev:$ARCH libxkbcommon-dev:$ARCH \ |
| 57 | + libgstreamer-plugins-base1.0-dev:$ARCH \ |
| 58 | + libvulkan-dev:$ARCH \ |
| 59 | + libgl1-mesa-dev:$ARCH libgles2-mesa-dev:$ARCH libegl1-mesa-dev:$ARCH \ |
| 60 | + ${{ matrix.is-cross && format('gcc-{0} g++-{0}', matrix.target) || '' }} |
| 61 | + |
| 62 | + - uses: actions/checkout@v3 |
| 63 | + with: |
| 64 | + submodules: 'recursive' |
| 65 | + |
| 66 | + - name: Configure CMake |
| 67 | + env: |
| 68 | + CMAKE_SYSTEM_NAME: ${{ matrix.is-cross && '-DCMAKE_SYSTEM_NAME=Linux' || '' }} |
| 69 | + CMAKE_C_COMPILER_TARGET: ${{ matrix.is-cross && format('-DCMAKE_C_COMPILER_TARGET={0}', matrix.target) || '' }} |
| 70 | + CMAKE_CXX_COMPILER_TARGET: ${{ matrix.is-cross && format('-DCMAKE_CXX_COMPILER_TARGET={0}', matrix.target) || '' }} |
| 71 | + PKG_CONFIG_PATH: ${{ format('/usr/lib/{0}/pkgconfig:/usr/share/pkgconfig', matrix.target) }} |
| 72 | + PKG_CONFIG_LIBDIR: ${{ format('/usr/lib/{0}', matrix.target) }} |
| 73 | + PKG_CONFIG_SYSROOT_DIR: '' |
| 74 | + run: | |
| 75 | + cmake \ |
| 76 | + -B ./build \ |
| 77 | + -S . \ |
| 78 | + -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} \ |
| 79 | + $CMAKE_SYSTEM_NAME \ |
| 80 | + $CMAKE_C_COMPILER_TARGET \ |
| 81 | + $CMAKE_CXX_COMPILER_TARGET \ |
| 82 | + -DCMAKE_C_COMPILER=clang \ |
| 83 | + -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" \ |
| 84 | + -DCMAKE_CXX_COMPILER=clang++ \ |
| 85 | + -DBUILD_GSTREAMER_AUDIO_PLAYER_PLUGIN=On \ |
| 86 | + -DBUILD_GSTREAMER_VIDEO_PLAYER_PLUGIN=On \ |
| 87 | + -DENABLE_VULKAN=ON \ |
| 88 | + -DENABLE_OPENGL=ON \ |
| 89 | + -DENABLE_TESTS=On \ |
| 90 | + -DBUILD_SENTRY_PLUGIN=OFF \ |
| 91 | + -DCMAKE_INSTALL_PREFIX=$HOME/flutterpi-dist \ |
| 92 | + -GNinja |
| 93 | + |
| 94 | + - name: Build & Install |
| 95 | + run: cmake --build ./build --target install --config ${{ matrix.buildtype }} |
| 96 | + |
| 97 | + - name: Upload artifact |
| 98 | + uses: actions/upload-artifact@v4 |
| 99 | + with: |
| 100 | + name: flutterpi-${{ matrix.target }}-${{ matrix.buildtype }} |
| 101 | + path: $HOME/flutterpi-dist/flutter-pi |
| 102 | + |
| 103 | + publish: |
| 104 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release/') |
| 105 | + name: Publish |
| 106 | + runs-on: ubuntu-latest |
| 107 | + needs: build |
| 108 | + steps: |
| 109 | + - name: Download artifact |
| 110 | + uses: actions/download-artifact@v4 |
| 111 | + with: |
| 112 | + path: binaries |
| 113 | + |
| 114 | + - name: Publish Release |
| 115 | + uses: softprops/action-gh-release@v1 |
| 116 | + with: |
| 117 | + files: binaries/* |
| 118 | + tag_name: ${{ github.ref }} |
| 119 | + name: ${{ github.ref_name }} |
| 120 | + body: ${{ github.event.head_commit.message }} |
| 121 | + token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments