Skip to content

Commit 36b111d

Browse files
committed
[build] Add new builder for MacOS App Image
1 parent 6c423c6 commit 36b111d

File tree

2 files changed

+124
-8
lines changed

2 files changed

+124
-8
lines changed

.github/workflows/build-macos.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Build MacOS App Bundle for DVR-Scan
2+
name: MacOS Distribution
3+
4+
# TODO: Enable schedule.
5+
on:
6+
# schedule:
7+
# - cron: '0 0 * * *'
8+
# pull_request:
9+
# paths:
10+
# - dist/**
11+
# - dvr_scan/**
12+
# - tests/**
13+
# push:
14+
# paths:
15+
# - dist/**
16+
# - dvr_scan/**
17+
# - tests/**
18+
# tags:
19+
# - v*-release
20+
workflow_dispatch:
21+
22+
env:
23+
ffmpeg_version: "8.0"
24+
UV_SYSTEM_PYTHON: 1
25+
UV_LINK_MODE: "symlink"
26+
27+
28+
jobs:
29+
build:
30+
runs-on: macos-latest
31+
strategy:
32+
matrix:
33+
python-version: ["3.12"]
34+
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Set up Python ${{ matrix.python-version }}
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version: ${{ matrix.python-version }}
42+
cache: 'pip'
43+
44+
- name: Install uv and set the python version
45+
uses: astral-sh/setup-uv@v4
46+
with:
47+
version: "0.5.11"
48+
python-version: ${{ matrix.python-version }}
49+
50+
- name: Install Dependencies
51+
run: |
52+
uv pip install --upgrade pip build wheel virtualenv setuptools
53+
uv pip install -r dist/requirements_windows.txt -r docs/requirements.txt
54+
55+
- name: Unit Test
56+
run: |
57+
python -m pytest tests/
58+
59+
- name: Build DVR-Scan
60+
run: |
61+
python dist/pre_release.py --use-local-images
62+
pyinstaller dist/dvr-scan.spec
63+
python dist/post_release.py
64+
65+
- name: Upload
66+
uses: actions/[email protected]
67+
with:
68+
name: DVR-Scan-macos
69+
path: dist/dvr-scan
70+
71+
test:
72+
runs-on: macos-latest
73+
needs: build
74+
steps:
75+
- uses: actions/checkout@v4
76+
77+
- uses: actions/[email protected]
78+
with:
79+
name: DVR-Scan-macos
80+
path: build
81+
82+
- name: Test Artifact
83+
run: |
84+
chmod +x ./build/dvr-scan
85+
./build/dvr-scan --version
86+
./build/dvr-scan --license
87+
./build/dvr-scan -i tests/resources/simple_movement.mp4 -so -et 5s -df 3
88+
./build/dvr-scan -i tests/resources/simple_movement.mp4 -et 5s -df 3 -m copy

.github/workflows/build-windows-cuda.yml

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,29 +50,57 @@ jobs:
5050
uses: actions/cache@v3
5151
with:
5252
path: ./.cache/cuda_installer.exe
53-
key: cuda-installer-12.1.1
53+
key: cuda-installer-12.0.0
5454

5555
- name: 🔧 Install NVIDIA CUDA Toolkit
5656
run: |
5757
$installer_path = "./.cache/cuda_installer.exe"
5858
if (-not (Test-Path $installer_path)) {
5959
echo "Downloading CUDA Toolkit..."
60-
$cuda_installer_url = "https://developer.download.nvidia.com/compute/cuda/12.1.1/network_installers/cuda_12.1.1_windows_network.exe"
60+
$cuda_installer_url = "https://developer.download.nvidia.com/compute/cuda/12.0.0/network_installers/cuda_12.0.0_windows_network.exe"
6161
New-Item -Path (Split-Path $installer_path) -ItemType Directory -Force
6262
curl -L -o $installer_path $cuda_installer_url
6363
} else {
6464
echo "CUDA Toolkit installer found in cache."
6565
}
6666
6767
echo "Installing CUDA Toolkit silently..."
68-
$arguments = "-s nvcc_12.1 cudart_12.1"
68+
$arguments = "-s nvcc_12.0 cudart_12.0"
6969
Start-Process -FilePath $installer_path -ArgumentList $arguments -Wait -NoNewWindow
7070
7171
echo "Adding CUDA to PATH..."
72-
$cuda_path = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1"
73-
echo "CUDA_PATH=$cuda_path" | Out-File -FilePath $env:GITHUB_ENV -Append
74-
echo "$cuda_path\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
75-
echo "$cuda_path\lib\x64" | Out-File -FilePath $env:GITHUB_PATH -Append
72+
$CUDA_PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.0"
73+
echo "CUDA_PATH=$CUDA_PATH" | Out-File -FilePath $env:GITHUB_ENV -Append
74+
echo "$CUDA_PATH\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
75+
echo "$CUDA_PATH\lib\x64" | Out-File -FilePath $env:GITHUB_PATH -Append
76+
echo "$CUDA_PATH"
77+
shell: pwsh
78+
79+
- name: Cache CuDNN Installer
80+
id: cache-cudnn-installer
81+
uses: actions/cache@v3
82+
with:
83+
path: ./.cache/cudnn_installer.exe
84+
key: cudnn-installer-8.8.0.121-windows
85+
86+
- name: 🔧 Install NVIDIA CuDNN
87+
run: |
88+
$installer_path = "./.cache/cudnn_installer.exe"
89+
if (-not (Test-Path $installer_path)) {
90+
echo "Downloading CuDNN..."
91+
$cudnn_installer_url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.8.0/local_installers/12.0/cudnn_8.8.0.121_windows.exe"
92+
New-Item -Path (Split-Path $installer_path) -ItemType Directory -Force
93+
curl -L -o $installer_path $cudnn_installer_url
94+
} else {
95+
echo "CuDNN installer found in cache."
96+
}
97+
98+
echo "Installing CuDNN silently..."
99+
# The CuDNN local installer for Windows is a self-extracting executable.
100+
# We assume it installs to the correct CUDA Toolkit directory.
101+
# We use -s for silent installation.
102+
Start-Process -FilePath $installer_path -ArgumentList "-s" -Wait -NoNewWindow
103+
echo "CuDNN installation complete."
76104
shell: pwsh
77105

78106
- name: Cache opencv-python repository
@@ -118,7 +146,7 @@ jobs:
118146
-DBUILD_SHARED_LIBS=OFF `
119147
-DWITH_CUDA=ON `
120148
-DCUDA_ARCH_BIN="6.0;6.1;7.0;7.5" `
121-
-DCUDA_ARCH_PTX=7.5 `
149+
-DCUDA_ARCH_PTX="7.5" `
122150
-DOPENCV_ENABLE_NONFREE=ON `
123151
-DENABLE_LTO=ON `
124152
-DCPU_DISPATCH="AVX,AVX2" `

0 commit comments

Comments
 (0)