|
| 1 | +name: Portable |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + build-portable: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + include: |
| 16 | + - distro: "debian" |
| 17 | + version: "13" |
| 18 | + |
| 19 | + container: |
| 20 | + image: ghcr.io/fastflowlm/fastflowlm/build-environment:${{ matrix.distro }}${{ matrix.version }} |
| 21 | + credentials: |
| 22 | + username: ${{ github.actor }} |
| 23 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Checkout repository |
| 27 | + uses: actions/checkout@v4 |
| 28 | + with: |
| 29 | + submodules: recursive |
| 30 | + fetch-depth: 0 |
| 31 | + |
| 32 | + - name: Configure git safe directory |
| 33 | + run: git config --global --add safe.directory $(pwd) |
| 34 | + |
| 35 | + - name: Get version from git describe |
| 36 | + id: get_version |
| 37 | + run: | |
| 38 | + VERSION=$(git describe --tags --always) |
| 39 | + echo "version=${VERSION}" >> $GITHUB_OUTPUT |
| 40 | +
|
| 41 | + - name: Get short SHA |
| 42 | + id: short_sha |
| 43 | + run: echo "sha=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT |
| 44 | + |
| 45 | + - name: Upgrade Rust toolchain |
| 46 | + run: | |
| 47 | + apt-get update |
| 48 | + apt-get install -y uuid-dev |
| 49 | + apt-get install -y --no-install-recommends curl ca-certificates |
| 50 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \ |
| 51 | + sh -s -- -y --profile minimal --default-toolchain stable |
| 52 | + echo "$HOME/.cargo/bin" >> $GITHUB_PATH |
| 53 | +
|
| 54 | + - name: Build FLM portable distribution |
| 55 | + run: | |
| 56 | + cd src |
| 57 | + cmake --preset linux-portable |
| 58 | + cmake --build build -j$(nproc) |
| 59 | +
|
| 60 | + - name: Create installation package |
| 61 | + run: | |
| 62 | + cd src/build |
| 63 | + DESTDIR=$PWD/install cmake --install . |
| 64 | +
|
| 65 | + echo "=== Installation Contents ===" |
| 66 | + find install -type f |
| 67 | +
|
| 68 | + echo "" |
| 69 | + echo "=== Binary in installation ===" |
| 70 | + ls -lh install/opt/fastflowlm/flm |
| 71 | +
|
| 72 | + echo "" |
| 73 | + echo "=== Bundled libraries ===" |
| 74 | + ls -lh install/opt/fastflowlm/lib/ |
| 75 | +
|
| 76 | + echo "" |
| 77 | + echo "=== Checking for bundled XRT and XDNA ===" |
| 78 | + if [ -f install/opt/fastflowlm/lib/libxrt_coreutil.so.2 ]; then |
| 79 | + echo "✅ XRT library bundled" |
| 80 | + else |
| 81 | + echo "❌ XRT library NOT bundled" |
| 82 | + fi |
| 83 | + if [ -f install/opt/fastflowlm/lib/libxrt_driver_xdna.so.2 ]; then |
| 84 | + echo "✅ XDNA plugin bundled" |
| 85 | + else |
| 86 | + echo "❌ XDNA plugin NOT bundled" |
| 87 | + fi |
| 88 | +
|
| 89 | + echo "" |
| 90 | + echo "=== Binary dependencies ===" |
| 91 | + ldd install/opt/fastflowlm/flm | head -40 |
| 92 | +
|
| 93 | + echo "" |
| 94 | + echo "=== Checking FFmpeg linking ===" |
| 95 | + if ldd install/opt/fastflowlm/flm | grep -q "libavformat.so"; then |
| 96 | + echo "❌ FAIL: FFmpeg is dynamically linked (should be static)" |
| 97 | + exit 1 |
| 98 | + else |
| 99 | + echo "✅ PASS: FFmpeg statically linked" |
| 100 | + fi |
| 101 | +
|
| 102 | + - name: Create portable tarball |
| 103 | + env: |
| 104 | + VERSION: ${{ steps.get_version.outputs.version }} |
| 105 | + run: | |
| 106 | + cd src/build/install/opt/fastflowlm |
| 107 | + tar czf $GITHUB_WORKSPACE/flm-portable-${VERSION}-${{ matrix.distro }}${{ matrix.version }}.tar.gz \ |
| 108 | + flm \ |
| 109 | + lib/ \ |
| 110 | + xclbins/ \ |
| 111 | + model_list.json |
| 112 | + echo "Created tarball with symlinks preserved" |
| 113 | + tar tzf $GITHUB_WORKSPACE/flm-portable-${VERSION}-${{ matrix.distro }}${{ matrix.version }}.tar.gz | grep libxrt |
| 114 | +
|
| 115 | + - name: Upload portable build artifact |
| 116 | + uses: actions/upload-artifact@v4 |
| 117 | + with: |
| 118 | + name: flm-portable-${{ matrix.distro }}${{ matrix.version }}-${{ steps.short_sha.outputs.sha }} |
| 119 | + path: flm-portable-${{ steps.get_version.outputs.version }}-${{ matrix.distro }}${{ matrix.version }}.tar.gz |
| 120 | + retention-days: 7 |
| 121 | + if-no-files-found: error |
| 122 | + |
| 123 | + test-summary: |
| 124 | + runs-on: ubuntu-latest |
| 125 | + needs: build-portable |
| 126 | + if: always() |
| 127 | + steps: |
| 128 | + - name: Summary |
| 129 | + run: | |
| 130 | + echo "# Portable Build Test Results" >> $GITHUB_STEP_SUMMARY |
| 131 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 132 | + echo "✅ FLM built successfully with portable distribution" >> $GITHUB_STEP_SUMMARY |
| 133 | + echo "✅ FFmpeg statically linked (no external FFmpeg dependencies)" >> $GITHUB_STEP_SUMMARY |
| 134 | + echo "✅ XRT and XDNA plugin bundled with distribution" >> $GITHUB_STEP_SUMMARY |
| 135 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 136 | + echo "## Build Configuration" >> $GITHUB_STEP_SUMMARY |
| 137 | + echo "- **FFmpeg**: Statically linked (built from source)" >> $GITHUB_STEP_SUMMARY |
| 138 | + echo "- **XRT**: Dynamically linked, bundled in lib/" >> $GITHUB_STEP_SUMMARY |
| 139 | + echo "- **XDNA plugin**: Bundled in lib/" >> $GITHUB_STEP_SUMMARY |
| 140 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 141 | + echo "## Usage" >> $GITHUB_STEP_SUMMARY |
| 142 | + echo "The binary is portable and includes all necessary libraries in the lib/ directory." >> $GITHUB_STEP_SUMMARY |
| 143 | + echo "RPATH is set to \$ORIGIN/../lib for automatic library discovery." >> $GITHUB_STEP_SUMMARY |
| 144 | +
|
| 145 | + release: |
| 146 | + permissions: |
| 147 | + contents: write |
| 148 | + runs-on: ubuntu-latest |
| 149 | + needs: build-portable |
| 150 | + if: github.ref_type == 'tag' |
| 151 | + steps: |
| 152 | + - name: Checkout code |
| 153 | + uses: actions/checkout@v4 |
| 154 | + with: |
| 155 | + fetch-depth: 0 |
| 156 | + |
| 157 | + - name: Get version from git describe |
| 158 | + id: get_version |
| 159 | + run: | |
| 160 | + VERSION=$(git describe --tags --always) |
| 161 | + echo "version=${VERSION}" >> $GITHUB_OUTPUT |
| 162 | +
|
| 163 | + - name: Download all portable artifacts |
| 164 | + uses: actions/download-artifact@v4 |
| 165 | + with: |
| 166 | + path: portable |
| 167 | + |
| 168 | + - name: Upload Binaries to Release |
| 169 | + uses: svenstaro/upload-release-action@v2 |
| 170 | + with: |
| 171 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 172 | + tag: ${{ github.ref }} |
| 173 | + file_glob: true |
| 174 | + file: portable/*/*.gz |
0 commit comments