|
| 1 | +name: "Nightly Builds" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + ref: |
| 11 | + description: "Branch or tag to build" |
| 12 | + required: true |
| 13 | + default: "main" |
| 14 | + type: string |
| 15 | + |
| 16 | +env: |
| 17 | + CARGO_TERM_COLOR: always |
| 18 | + |
| 19 | +jobs: |
| 20 | + get-version: |
| 21 | + name: Get Version |
| 22 | + runs-on: ubuntu-latest |
| 23 | + outputs: |
| 24 | + version: ${{ steps.get_version.outputs.version }} |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + - name: Get Version |
| 28 | + id: get_version |
| 29 | + run: echo "version=$(grep '^version = ' src/ui/Cargo.toml | cut -d '"' -f2)" >> $GITHUB_OUTPUT |
| 30 | + |
| 31 | + build-linux: |
| 32 | + needs: get-version |
| 33 | + name: Build Linux |
| 34 | + runs-on: ubuntu-latest |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v4 |
| 37 | + with: |
| 38 | + ref: ${{ github.event.inputs.ref || github.ref }} |
| 39 | + |
| 40 | + - name: Install Rust |
| 41 | + uses: dtolnay/rust-toolchain@master |
| 42 | + with: |
| 43 | + toolchain: stable |
| 44 | + |
| 45 | + - name: Cache Rust dependencies |
| 46 | + uses: Swatinem/rust-cache@v2 |
| 47 | + with: |
| 48 | + shared-key: "rust-cache-linux" |
| 49 | + cache-on-failure: true |
| 50 | + |
| 51 | + - name: Install Linux Dependencies |
| 52 | + run: | |
| 53 | + sudo apt-get update |
| 54 | + sudo apt-get install -y libxkbcommon-dev libxkbcommon-x11-dev libx11-dev libvulkan-dev vulkan-validationlayers \ |
| 55 | + libgtk-3-dev libgdk3.0-cil-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev \ |
| 56 | + libwebkit2gtk-4.1-dev |
| 57 | +
|
| 58 | + - name: Build Release |
| 59 | + run: cargo build --release |
| 60 | + |
| 61 | + - name: Create AppImage |
| 62 | + run: | |
| 63 | + sudo apt-get install -y libfuse2 |
| 64 | + # Create .desktop file |
| 65 | + mkdir -p AppDir/usr/share/applications |
| 66 | + cat > AppDir/usr/share/applications/scope.desktop << EOF |
| 67 | + [Desktop Entry] |
| 68 | + Name=Scope |
| 69 | + Exec=scope |
| 70 | + Icon=scope |
| 71 | + Type=Application |
| 72 | + Categories=Development; |
| 73 | + EOF |
| 74 | +
|
| 75 | + # Copy icon |
| 76 | + mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps/ |
| 77 | + cp .github/scope-round-200.png AppDir/usr/share/icons/hicolor/256x256/apps/scope.png |
| 78 | +
|
| 79 | + # Copy binary |
| 80 | + mkdir -p AppDir/usr/bin |
| 81 | + cp target/release/scope AppDir/usr/bin/ |
| 82 | +
|
| 83 | + # Create AppImage |
| 84 | + wget -O linuxdeploy-x86_64.AppImage https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage |
| 85 | + chmod +x linuxdeploy-x86_64.AppImage |
| 86 | + ./linuxdeploy-x86_64.AppImage --appdir AppDir --output appimage |
| 87 | + mv Scope*.AppImage Scope-${{ needs.get-version.outputs.version }}.AppImage |
| 88 | +
|
| 89 | + - name: Upload Artifact |
| 90 | + uses: actions/upload-artifact@v4 |
| 91 | + with: |
| 92 | + name: Scope-${{ needs.get-version.outputs.version }}.AppImage |
| 93 | + path: Scope-${{ needs.get-version.outputs.version }}.AppImage |
| 94 | + |
| 95 | + build-windows: |
| 96 | + needs: get-version |
| 97 | + name: Build Windows |
| 98 | + runs-on: windows-latest |
| 99 | + steps: |
| 100 | + - uses: actions/checkout@v4 |
| 101 | + with: |
| 102 | + ref: ${{ github.event.inputs.ref || github.ref }} |
| 103 | + |
| 104 | + - name: Install Rust |
| 105 | + uses: dtolnay/rust-toolchain@master |
| 106 | + with: |
| 107 | + toolchain: stable |
| 108 | + |
| 109 | + - name: Cache Rust dependencies |
| 110 | + uses: Swatinem/rust-cache@v2 |
| 111 | + with: |
| 112 | + shared-key: "rust-cache-windows" |
| 113 | + cache-on-failure: true |
| 114 | + |
| 115 | + - name: Build Release |
| 116 | + run: cargo build --release |
| 117 | + |
| 118 | + - name: Install WiX Toolset |
| 119 | + run: | |
| 120 | + curl -OL https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311-binaries.zip |
| 121 | + Expand-Archive wix311-binaries.zip -DestinationPath wix |
| 122 | + echo "${{ github.workspace }}\wix" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| 123 | +
|
| 124 | + - name: Create WiX files |
| 125 | + shell: pwsh |
| 126 | + run: | |
| 127 | + @" |
| 128 | + <?xml version='1.0' encoding='windows-1252'?> |
| 129 | + <Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'> |
| 130 | + <Product Name='Scope' Manufacturer='Scope' Id='*' UpgradeCode='12345678-1234-1234-1234-111111111111' |
| 131 | + Language='1033' Codepage='1252' Version='${{ needs.get-version.outputs.version }}'> |
| 132 | + <Package Id='*' Keywords='Installer' Description='Scope Installer' |
| 133 | + Comments='Scope is a development tool' Manufacturer='Scope' |
| 134 | + InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' /> |
| 135 | + <Media Id='1' Cabinet='Scope.cab' EmbedCab='yes' /> |
| 136 | + <Directory Id='TARGETDIR' Name='SourceDir'> |
| 137 | + <Directory Id='ProgramFilesFolder' Name='PFiles'> |
| 138 | + <Directory Id='INSTALLDIR' Name='Scope'> |
| 139 | + <Component Id='MainExecutable' Guid='12345678-1234-1234-1234-222222222222'> |
| 140 | + <File Id='ScopeEXE' Name='scope.exe' DiskId='1' Source='target/release/scope.exe' KeyPath='yes'> |
| 141 | + <Shortcut Id='startmenuScope' Directory='ProgramMenuDir' Name='Scope' WorkingDirectory='INSTALLDIR' Icon='Scope.exe' IconIndex='0' Advertise='yes' /> |
| 142 | + </File> |
| 143 | + </Component> |
| 144 | + </Directory> |
| 145 | + </Directory> |
| 146 | + <Directory Id='ProgramMenuFolder' Name='Programs'> |
| 147 | + <Directory Id='ProgramMenuDir' Name='Scope'> |
| 148 | + <Component Id='ProgramMenuDir' Guid='12345678-1234-1234-1234-333333333333'> |
| 149 | + <RemoveFolder Id='ProgramMenuDir' On='uninstall' /> |
| 150 | + <RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' /> |
| 151 | + </Component> |
| 152 | + </Directory> |
| 153 | + </Directory> |
| 154 | + </Directory> |
| 155 | + <Feature Id='Complete' Level='1'> |
| 156 | + <ComponentRef Id='MainExecutable' /> |
| 157 | + <ComponentRef Id='ProgramMenuDir' /> |
| 158 | + </Feature> |
| 159 | + <Icon Id='Scope.exe' SourceFile='target/release/scope.exe' /> |
| 160 | + </Product> |
| 161 | + </Wix> |
| 162 | + "@ | Out-File -FilePath "scope.wxs" -Encoding UTF8 |
| 163 | +
|
| 164 | + - name: Build MSI |
| 165 | + run: | |
| 166 | + candle scope.wxs |
| 167 | + light -ext WixUIExtension scope.wixobj |
| 168 | + mv scope.msi Scope-${{ needs.get-version.outputs.version }}.msi |
| 169 | +
|
| 170 | + - name: Upload Artifact |
| 171 | + uses: actions/upload-artifact@v4 |
| 172 | + with: |
| 173 | + name: Scope-${{ needs.get-version.outputs.version }}.msi |
| 174 | + path: Scope-${{ needs.get-version.outputs.version }}.msi |
| 175 | + |
| 176 | + build-macos-intel: |
| 177 | + needs: get-version |
| 178 | + name: Build macOS (Intel) |
| 179 | + runs-on: macos-latest |
| 180 | + steps: |
| 181 | + - uses: actions/checkout@v4 |
| 182 | + with: |
| 183 | + ref: ${{ github.event.inputs.ref || github.ref }} |
| 184 | + |
| 185 | + - name: Install Rust |
| 186 | + uses: dtolnay/rust-toolchain@master |
| 187 | + with: |
| 188 | + toolchain: stable |
| 189 | + |
| 190 | + - name: Cache Rust dependencies |
| 191 | + uses: Swatinem/rust-cache@v2 |
| 192 | + with: |
| 193 | + shared-key: "rust-cache-macos-intel" |
| 194 | + cache-on-failure: true |
| 195 | + |
| 196 | + - name: Add Target |
| 197 | + run: rustup target add x86_64-apple-darwin |
| 198 | + |
| 199 | + - name: Build Release |
| 200 | + shell: bash |
| 201 | + run: cargo build --release --target x86_64-apple-darwin |
| 202 | + |
| 203 | + - name: Create App Bundle |
| 204 | + run: | |
| 205 | + mkdir -p Scope.app/Contents/{MacOS,Resources} |
| 206 | + cp target/x86_64-apple-darwin/release/scope Scope.app/Contents/MacOS/ |
| 207 | + cp .github/scope-round-200.png Scope.app/Contents/Resources/scope.icns |
| 208 | +
|
| 209 | + cat > Scope.app/Contents/Info.plist << EOF |
| 210 | + <?xml version="1.0" encoding="UTF-8"?> |
| 211 | + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 212 | + <plist version="1.0"> |
| 213 | + <dict> |
| 214 | + <key>CFBundleName</key> |
| 215 | + <string>Scope</string> |
| 216 | + <key>CFBundleDisplayName</key> |
| 217 | + <string>Scope</string> |
| 218 | + <key>CFBundleIdentifier</key> |
| 219 | + <string>com.scope.app</string> |
| 220 | + <key>CFBundleVersion</key> |
| 221 | + <string>${{ needs.get-version.outputs.version }}</string> |
| 222 | + <key>CFBundlePackageType</key> |
| 223 | + <string>APPL</string> |
| 224 | + <key>CFBundleSignature</key> |
| 225 | + <string>????</string> |
| 226 | + <key>CFBundleExecutable</key> |
| 227 | + <string>scope</string> |
| 228 | + <key>CFBundleIconFile</key> |
| 229 | + <string>scope.icns</string> |
| 230 | + <key>LSMinimumSystemVersion</key> |
| 231 | + <string>10.13</string> |
| 232 | + <key>NSHighResolutionCapable</key> |
| 233 | + <true/> |
| 234 | + </dict> |
| 235 | + </plist> |
| 236 | + EOF |
| 237 | +
|
| 238 | + - name: Create DMG |
| 239 | + run: | |
| 240 | + hdiutil create -volname "Scope" -srcfolder Scope.app -ov -format UDZO Scope-${{ needs.get-version.outputs.version }}_intel.dmg |
| 241 | +
|
| 242 | + - name: Upload Artifact |
| 243 | + uses: actions/upload-artifact@v4 |
| 244 | + with: |
| 245 | + name: Scope-${{ needs.get-version.outputs.version }}_intel.dmg |
| 246 | + path: Scope-${{ needs.get-version.outputs.version }}_intel.dmg |
| 247 | + |
| 248 | + build-macos-silicon: |
| 249 | + needs: get-version |
| 250 | + name: Build macOS (Silicon) |
| 251 | + runs-on: macos-latest |
| 252 | + steps: |
| 253 | + - uses: actions/checkout@v4 |
| 254 | + with: |
| 255 | + ref: ${{ github.event.inputs.ref || github.ref }} |
| 256 | + |
| 257 | + - name: Install Rust |
| 258 | + uses: dtolnay/rust-toolchain@master |
| 259 | + with: |
| 260 | + toolchain: stable |
| 261 | + |
| 262 | + - name: Cache Rust dependencies |
| 263 | + uses: Swatinem/rust-cache@v2 |
| 264 | + with: |
| 265 | + shared-key: "rust-cache-macos-silicon" |
| 266 | + cache-on-failure: true |
| 267 | + |
| 268 | + - name: Add Target |
| 269 | + run: rustup target add aarch64-apple-darwin |
| 270 | + |
| 271 | + - name: Build Release |
| 272 | + shell: bash |
| 273 | + run: cargo build --release --target aarch64-apple-darwin |
| 274 | + |
| 275 | + - name: Create App Bundle |
| 276 | + run: | |
| 277 | + mkdir -p Scope.app/Contents/{MacOS,Resources} |
| 278 | + cp target/aarch64-apple-darwin/release/scope Scope.app/Contents/MacOS/ |
| 279 | + cp .github/scope-round-200.png Scope.app/Contents/Resources/scope.icns |
| 280 | +
|
| 281 | + cat > Scope.app/Contents/Info.plist << EOF |
| 282 | + <?xml version="1.0" encoding="UTF-8"?> |
| 283 | + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 284 | + <plist version="1.0"> |
| 285 | + <dict> |
| 286 | + <key>CFBundleName</key> |
| 287 | + <string>Scope</string> |
| 288 | + <key>CFBundleDisplayName</key> |
| 289 | + <string>Scope</string> |
| 290 | + <key>CFBundleIdentifier</key> |
| 291 | + <string>com.scope.app</string> |
| 292 | + <key>CFBundleVersion</key> |
| 293 | + <string>${{ needs.get-version.outputs.version }}</string> |
| 294 | + <key>CFBundlePackageType</key> |
| 295 | + <string>APPL</string> |
| 296 | + <key>CFBundleSignature</key> |
| 297 | + <string>????</string> |
| 298 | + <key>CFBundleExecutable</key> |
| 299 | + <string>scope</string> |
| 300 | + <key>CFBundleIconFile</key> |
| 301 | + <string>scope.icns</string> |
| 302 | + <key>LSMinimumSystemVersion</key> |
| 303 | + <string>10.13</string> |
| 304 | + <key>NSHighResolutionCapable</key> |
| 305 | + <true/> |
| 306 | + </dict> |
| 307 | + </plist> |
| 308 | + EOF |
| 309 | +
|
| 310 | + - name: Create DMG |
| 311 | + run: | |
| 312 | + hdiutil create -volname "Scope" -srcfolder Scope.app -ov -format UDZO Scope-${{ needs.get-version.outputs.version }}_silicon.dmg |
| 313 | +
|
| 314 | + - name: Upload Artifact |
| 315 | + uses: actions/upload-artifact@v4 |
| 316 | + with: |
| 317 | + name: Scope-${{ needs.get-version.outputs.version }}_silicon.dmg |
| 318 | + path: Scope-${{ needs.get-version.outputs.version }}_silicon.dmg |
0 commit comments