|
| 1 | +name: release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: ci-${{ github.workflow }}-${{ github.ref }} |
| 10 | + cancel-in-progress: false |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: write |
| 14 | + |
| 15 | +jobs: |
| 16 | + ubuntu-x64: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + submodules: recursive |
| 22 | + |
| 23 | + - name: Cache apt packages |
| 24 | + uses: actions/cache@v4 |
| 25 | + with: |
| 26 | + path: /var/cache/apt/archives |
| 27 | + key: apt-${{ runner.os }}-x64-${{ hashFiles('.github/workflows/release.yml') }} |
| 28 | + restore-keys: apt-${{ runner.os }}-x64- |
| 29 | + |
| 30 | + - name: Install build packages |
| 31 | + run: | |
| 32 | + sudo apt-get update |
| 33 | + sudo apt-get install -y ninja-build ccache cmake |
| 34 | + dpkg-query -W -f='${Package} ${Version}\n' ninja-build ccache cmake > /tmp/apt-fingerprint.txt |
| 35 | +
|
| 36 | + - name: ccache |
| 37 | + uses: ggml-org/ccache-action@v1.2.21 |
| 38 | + with: |
| 39 | + max-size: 500MB |
| 40 | + evict-old-files: 7d |
| 41 | + |
| 42 | + - name: Configure |
| 43 | + run: >- |
| 44 | + cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release |
| 45 | + -DCMAKE_C_COMPILER_LAUNCHER=ccache |
| 46 | + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache |
| 47 | + -DCMAKE_INSTALL_RPATH='$ORIGIN' |
| 48 | + -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON |
| 49 | + -DBUILD_SHARED_LIBS=OFF |
| 50 | +
|
| 51 | + - name: Build |
| 52 | + run: cmake --build build -j"$(nproc)" |
| 53 | + |
| 54 | + - name: Package |
| 55 | + run: | |
| 56 | + mkdir -p stage/bin |
| 57 | + cp build/bin/inference build/bin/quantize stage/bin/ |
| 58 | + tar -czf "dinov2-${{ github.ref_name }}-bin-ubuntu-x64.tar.gz" -C stage bin |
| 59 | +
|
| 60 | + - uses: actions/upload-artifact@v4 |
| 61 | + with: |
| 62 | + name: dinov2-bin-linux-x64 |
| 63 | + path: dinov2-*-bin-ubuntu-x64.tar.gz |
| 64 | + if-no-files-found: error |
| 65 | + |
| 66 | + ubuntu-arm64: |
| 67 | + runs-on: ubuntu-24.04-arm |
| 68 | + steps: |
| 69 | + - uses: actions/checkout@v4 |
| 70 | + with: |
| 71 | + submodules: recursive |
| 72 | + |
| 73 | + - name: Cache apt packages |
| 74 | + uses: actions/cache@v4 |
| 75 | + with: |
| 76 | + path: /var/cache/apt/archives |
| 77 | + key: apt-${{ runner.os }}-arm64-${{ hashFiles('.github/workflows/release.yml') }} |
| 78 | + restore-keys: apt-${{ runner.os }}-arm64- |
| 79 | + |
| 80 | + - name: Install build packages |
| 81 | + run: | |
| 82 | + sudo apt-get update |
| 83 | + sudo apt-get install -y ninja-build ccache cmake |
| 84 | + dpkg-query -W -f='${Package} ${Version}\n' ninja-build ccache cmake > /tmp/apt-fingerprint.txt |
| 85 | +
|
| 86 | + - name: ccache |
| 87 | + uses: ggml-org/ccache-action@v1.2.21 |
| 88 | + with: |
| 89 | + max-size: 500MB |
| 90 | + evict-old-files: 7d |
| 91 | + |
| 92 | + - name: Configure |
| 93 | + run: >- |
| 94 | + cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release |
| 95 | + -DCMAKE_C_COMPILER_LAUNCHER=ccache |
| 96 | + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache |
| 97 | + -DCMAKE_INSTALL_RPATH='$ORIGIN' |
| 98 | + -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON |
| 99 | + -DBUILD_SHARED_LIBS=OFF |
| 100 | +
|
| 101 | + - name: Build |
| 102 | + run: cmake --build build -j"$(nproc)" |
| 103 | + |
| 104 | + - name: Package |
| 105 | + run: | |
| 106 | + mkdir -p stage/bin |
| 107 | + cp build/bin/inference build/bin/quantize stage/bin/ |
| 108 | + tar -czf "dinov2-${{ github.ref_name }}-bin-ubuntu-arm64.tar.gz" -C stage bin |
| 109 | +
|
| 110 | + - uses: actions/upload-artifact@v4 |
| 111 | + with: |
| 112 | + name: dinov2-bin-linux-arm64 |
| 113 | + path: dinov2-*-bin-ubuntu-arm64.tar.gz |
| 114 | + if-no-files-found: error |
| 115 | + |
| 116 | + macos-arm64: |
| 117 | + runs-on: macos-latest |
| 118 | + steps: |
| 119 | + - uses: actions/checkout@v4 |
| 120 | + with: |
| 121 | + submodules: recursive |
| 122 | + |
| 123 | + - name: Cache brew formulas |
| 124 | + uses: actions/cache@v4 |
| 125 | + with: |
| 126 | + path: | |
| 127 | + /usr/local/Cellar/ninja |
| 128 | + /usr/local/Cellar/ccache |
| 129 | + /opt/homebrew/Cellar/ninja |
| 130 | + /opt/homebrew/Cellar/ccache |
| 131 | + key: brew-${{ runner.os }}-${{ runner.arch }}-ninja-ccache |
| 132 | + restore-keys: brew-${{ runner.os }}-${{ runner.arch }}- |
| 133 | + |
| 134 | + - name: Install build packages |
| 135 | + run: | |
| 136 | + brew install ninja ccache |
| 137 | + brew link --overwrite ninja ccache |
| 138 | +
|
| 139 | + - name: ccache |
| 140 | + uses: ggml-org/ccache-action@v1.2.21 |
| 141 | + with: |
| 142 | + max-size: 500MB |
| 143 | + evict-old-files: 7d |
| 144 | + |
| 145 | + - name: Configure |
| 146 | + run: >- |
| 147 | + cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release |
| 148 | + -DCMAKE_C_COMPILER_LAUNCHER=ccache |
| 149 | + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache |
| 150 | + -DCMAKE_BUILD_RPATH='@loader_path' |
| 151 | + -DCMAKE_OSX_DEPLOYMENT_TARGET=13.3 |
| 152 | + -DBUILD_SHARED_LIBS=OFF |
| 153 | +
|
| 154 | + - name: Build |
| 155 | + run: cmake --build build -j"$(sysctl -n hw.logicalcpu)" |
| 156 | + |
| 157 | + - name: Package |
| 158 | + run: | |
| 159 | + mkdir -p stage/bin |
| 160 | + cp build/bin/inference build/bin/quantize stage/bin/ |
| 161 | + tar -czf "dinov2-${{ github.ref_name }}-bin-macos-arm64.tar.gz" -C stage bin |
| 162 | +
|
| 163 | + - uses: actions/upload-artifact@v4 |
| 164 | + with: |
| 165 | + name: dinov2-bin-macos-arm64 |
| 166 | + path: dinov2-*-bin-macos-arm64.tar.gz |
| 167 | + if-no-files-found: error |
| 168 | + |
| 169 | + windows-x64: |
| 170 | + runs-on: windows-latest |
| 171 | + env: |
| 172 | + SCCACHE_GHA_ENABLED: "true" |
| 173 | + SCCACHE_CACHE_SIZE: 500MB |
| 174 | + CMAKE_C_COMPILER_LAUNCHER: sccache |
| 175 | + CMAKE_CXX_COMPILER_LAUNCHER: sccache |
| 176 | + steps: |
| 177 | + - uses: actions/checkout@v4 |
| 178 | + with: |
| 179 | + submodules: recursive |
| 180 | + |
| 181 | + - name: sccache |
| 182 | + uses: Mozilla-Actions/sccache-action@v0.0.9 |
| 183 | + |
| 184 | + - name: Configure |
| 185 | + shell: pwsh |
| 186 | + run: >- |
| 187 | + cmake -B build -G "Ninja Multi-Config" |
| 188 | + -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake |
| 189 | + -DCMAKE_BUILD_TYPE=Release |
| 190 | + -DBUILD_SHARED_LIBS=OFF |
| 191 | +
|
| 192 | + - name: Build |
| 193 | + shell: pwsh |
| 194 | + run: cmake --build build --config Release |
| 195 | + |
| 196 | + - name: Package |
| 197 | + shell: pwsh |
| 198 | + run: | |
| 199 | + New-Item -ItemType Directory -Force -Path stage/bin | Out-Null |
| 200 | + Copy-Item build/bin/Release/inference.exe,build/bin/Release/quantize.exe stage/bin/ |
| 201 | + Compress-Archive -Path stage/bin -DestinationPath dinov2-bin-win-cpu-x64.zip |
| 202 | +
|
| 203 | + - uses: actions/upload-artifact@v4 |
| 204 | + with: |
| 205 | + name: dinov2-bin-win-cpu-x64 |
| 206 | + path: dinov2-bin-win-cpu-x64.zip |
| 207 | + if-no-files-found: error |
| 208 | + |
| 209 | + release: |
| 210 | + needs: [ubuntu-x64, ubuntu-arm64, macos-arm64, windows-x64] |
| 211 | + runs-on: ubuntu-latest |
| 212 | + steps: |
| 213 | + - uses: actions/download-artifact@v4 |
| 214 | + with: |
| 215 | + merge-multiple: true |
| 216 | + path: dist |
| 217 | + |
| 218 | + - name: Generate checksums |
| 219 | + run: | |
| 220 | + cd dist |
| 221 | + sha256sum * > SHA256SUMS.txt |
| 222 | +
|
| 223 | + - name: Publish release |
| 224 | + uses: softprops/action-gh-release@v2 |
| 225 | + with: |
| 226 | + files: | |
| 227 | + dist/** |
| 228 | + generate_release_notes: true |
0 commit comments