|
| 1 | +# Workflow Guide |
| 2 | + |
| 3 | +## Repository Setup |
| 4 | + |
| 5 | +### Cloning the Repository |
| 6 | + |
| 7 | +```bash |
| 8 | +git clone https://github.com/Breakthrough/opencv-python-cuda.git |
| 9 | +cd opencv-python-cuda |
| 10 | +``` |
| 11 | + |
| 12 | +### Adding Upstream Remote |
| 13 | + |
| 14 | +To sync with the main `opencv/opencv-python` repository, add it as a remote: |
| 15 | + |
| 16 | +```bash |
| 17 | +git remote add upstream https://github.com/opencv/opencv-python.git |
| 18 | +``` |
| 19 | + |
| 20 | +### Preventing Tag Pollution |
| 21 | + |
| 22 | +The upstream `opencv/opencv-python` repo has numeric tags (0, 1, 2, ... 90) that will pollute your local repo during fetches. To prevent this, configure the remote to exclude tags: |
| 23 | + |
| 24 | +```bash |
| 25 | +git config remote.upstream.tagOpt --no-tags |
| 26 | +git config --add remote.upstream.fetch '^refs/tags/*' |
| 27 | +``` |
| 28 | + |
| 29 | +The `tagOpt` setting alone is sometimes not respected, so the negative refspec (`^refs/tags/*`) explicitly excludes all tags. |
| 30 | + |
| 31 | +### Syncing with Upstream |
| 32 | + |
| 33 | +After configuring the remote, you can sync without getting unwanted tags: |
| 34 | + |
| 35 | +```bash |
| 36 | +git fetch upstream |
| 37 | +git pull --rebase upstream 4.x |
| 38 | +``` |
| 39 | + |
| 40 | +### Removing Accidentally Fetched Tags |
| 41 | + |
| 42 | +If you already fetched the numeric tags, remove them with: |
| 43 | + |
| 44 | +```bash |
| 45 | +git tag -d 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 68 70 72 74 76 78 80 82 84 86 88 90 |
| 46 | +``` |
| 47 | + |
| 48 | +--- |
| 49 | + |
| 50 | +## Triggering Builds |
| 51 | + |
| 52 | +To trigger the Windows CUDA build workflow: |
| 53 | + |
| 54 | +```bash |
| 55 | +gh workflow run build_wheels_windows.yml --ref 4.x-cuda -R Breakthrough/opencv-python-cuda |
| 56 | +``` |
| 57 | + |
| 58 | +**Important:** Always specify `-R Breakthrough/opencv-python-cuda` when using `gh` commands. This repo is a fork of `opencv/opencv-python`, and `gh` will default to the parent repository without the explicit `-R` flag. |
| 59 | + |
| 60 | +### Build Options |
| 61 | + |
| 62 | +| Option | Description | Default | |
| 63 | +|--------|-------------|---------| |
| 64 | +| `restore_build_cache` | Restore build cache from previous runs | `true` | |
| 65 | +| `save_build_cache` | Save build cache after completion | `true` | |
| 66 | +| `rolling_build` | Use latest commit from upstream OpenCV | `false` | |
| 67 | + |
| 68 | +Example with options: |
| 69 | + |
| 70 | +```bash |
| 71 | +gh workflow run build_wheels_windows.yml --ref 4.x-cuda -R Breakthrough/opencv-python-cuda \ |
| 72 | + -f restore_build_cache=false \ |
| 73 | + -f save_build_cache=true |
| 74 | +``` |
| 75 | + |
| 76 | +### Force Rebuild (No Cache) |
| 77 | + |
| 78 | +To force a complete rebuild without using cached artifacts: |
| 79 | + |
| 80 | +```bash |
| 81 | +gh workflow run build_wheels_windows.yml --ref 4.x-cuda -R Breakthrough/opencv-python-cuda \ |
| 82 | + -f restore_build_cache=false |
| 83 | +``` |
| 84 | + |
| 85 | +--- |
| 86 | + |
| 87 | +## Monitoring Builds |
| 88 | + |
| 89 | +List recent runs: |
| 90 | + |
| 91 | +```bash |
| 92 | +gh run list -R Breakthrough/opencv-python-cuda --limit 5 |
| 93 | +``` |
| 94 | + |
| 95 | +Watch a running build: |
| 96 | + |
| 97 | +```bash |
| 98 | +gh run watch <run-id> -R Breakthrough/opencv-python-cuda |
| 99 | +``` |
| 100 | + |
| 101 | +View build details: |
| 102 | + |
| 103 | +```bash |
| 104 | +gh run view <run-id> -R Breakthrough/opencv-python-cuda |
| 105 | +``` |
| 106 | + |
| 107 | +--- |
| 108 | + |
| 109 | +## Reference: Git Config for Remotes |
| 110 | + |
| 111 | +After setup, your `.git/config` remote sections should look like: |
| 112 | + |
| 113 | +```ini |
| 114 | +[remote "origin"] |
| 115 | + url = https://github.com/Breakthrough/opencv-python-cuda.git |
| 116 | + fetch = +refs/heads/*:refs/remotes/origin/* |
| 117 | + |
| 118 | +[remote "upstream"] |
| 119 | + url = https://github.com/opencv/opencv-python.git |
| 120 | + fetch = +refs/heads/*:refs/remotes/upstream/* |
| 121 | + fetch = ^refs/tags/* |
| 122 | + tagOpt = --no-tags |
| 123 | +``` |
0 commit comments