-
-
Notifications
You must be signed in to change notification settings - Fork 1
137 lines (112 loc) · 4.78 KB
/
build.yml
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: "Build App"
on:
pull_request:
push:
branches:
- main
jobs:
build-app:
defaults:
run:
shell: bash -el {0}
environment: signing
strategy:
fail-fast: false
matrix:
include:
- platform: macos-latest
triplet: x64-osx
vcpkg-package: "opencv4[dnn]"
vcpkg-version: 2022.09.27
- platform: windows-latest
triplet: x64-windows-static-md
vcpkg-package: "opencv4[dnn]"
vcpkg-version: 2022.09.27
- platform: ubuntu-latest
triplet: x64-linux
vcpkg-package: "opencv4[dnn]"
vcpkg-version: 2022.09.27
runs-on: ${{ matrix.platform }}
steps:
- name: Pin vcpkg version
run: |
cd $VCPKG_INSTALLATION_ROOT && git checkout . && git checkout ${{ matrix.vcpkg-version }}
- name: Install Linux System Dependencies
run: |
sudo apt-get update
sudo apt-get install -y libdbus-1-3 libdbus-1-dev libxi-dev libxtst-dev libgles2-mesa-dev libgtk-3-dev \
libwebkit2gtk-4.0-dev librsvg2-dev jq clang && sudo ln -fs libclang.so.1 /usr/lib/llvm-14/lib/libclang.so
if: runner.os == 'Linux'
- name: Install Windows System Dependencies
run: choco install -y wget jq
if: runner.os == 'Windows'
- name: Install MacOS System Dependencies
run: brew install jq pkg-config && mkdir -p /Users/runner/lib && ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib /Users/runner/lib/libclang.dylib
if: runner.os == 'macOS'
- uses: actions/checkout@v4
with:
submodules: true
- name: Disable Signing if not on main
# Private key not available otherwise
if: github.ref != 'refs/heads/main'
run: jq '.tauri.updater.active = false' src-tauri/tauri.conf.json > src-tauri/tauri.conf.json.tmp && mv src-tauri/tauri.conf.json.tmp src-tauri/tauri.conf.json
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Set VCPKG_ROOT
run: echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV
- name: Cache vcpkg
uses: actions/cache@v3
with:
path: |
${{ env.VCPKG_ROOT }}/installed
${{ env.VCPKG_ROOT }}/packages
key: ${{ matrix.vcpkg-version }}-${{ matrix.platform }}-vcpkg-${{ matrix.vcpkg-package }}-${{ matrix.triplet }}
- name: Download Model
run: wget -O md_v5a.0.0-1280x1280.onnx https://github.com/bencevans/megadetector-onnx/releases/download/v0.2.0/md_v5a.0.0-1280x1280.onnx
- name: Build OpenCV 4
run: "'${{env.VCPKG_ROOT}}/vcpkg' install ${{ matrix.vcpkg-package }}:${{ matrix.triplet }}"
- name: Cache Rust / Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
src-tauri/target
key: ${{ runner.os }}-${{runner.arch}}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.vcpkg-version }}-${{ matrix.platform }}-vcpkg-${{ matrix.vcpkg-package }}-${{ matrix.triplet }}
- name: Build App
run: npm ci && OPENCV_DISABLE_PROBES=pkg_config,cmake npm run tauri build
env:
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
- name: Run Rust Tests
run: cd src-tauri && cargo test
- uses: actions/upload-artifact@v3
if: ${{ env.ACTIONS_RUNNER_DEBUG }}
with:
name: CamTrap Detector MacOS Intel.dmg
path: src-tauri/target/release/bundle/dmg/*.dmg
- name: Remove Bundles to Reduce Cache
run: rm -rf src-tauri/target/release/bundle/
# - uses: tauri-apps/tauri-action@v0
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }}
# APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
# APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
# APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
# APPLE_ID: ${{ secrets.APPLE_ID }}
# APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
# with:
# tauriScript: npm run tauri --
# args: --features builtin
# tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
# releaseName: 'App v__VERSION__'
# releaseBody: 'See the assets to download this version and install.'
# releaseDraft: true
# prerelease: false