Skip to content

Commit

Permalink
Add Github action + fix glob (#10)
Browse files Browse the repository at this point in the history
* refactor

* patch workflows

* patch workflow

* add log

* update workflow

* rename mac-detect.yml

* patch detection

* add OPENCV4NODEJS_DISABLE_AUTOBUILD in win64 detect

* update workflow

* improve error messages

* add missing error message

* debug workflow

* fix brew autodetection

* update workflow

* give no version to linux build

* add test branch to workflow

* patch default version

* add missing new line in ts file

* update launch.json
  • Loading branch information
UrielCh committed Apr 16, 2024
1 parent e5e5588 commit 3c528d9
Show file tree
Hide file tree
Showing 17 changed files with 302 additions and 189 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: build openCV

on:
push:
branches: [ "master", "piercus" ]
branches: [ "master", "piercus", "test" ]
paths: ['src/**', 'dist/**', 'package.json', 'pnpm-lock.yaml', 'pnpmfile.js', 'test/**', 'bin/**', 'scripts/**', '.github/workflows/linux-build.yml' ]
pull_request:
branches: [ "master", "piercus" ]
paths: ['src/**', 'dist/**', 'package.json', 'pnpm-lock.yaml', 'pnpmfile.js', 'test/**', 'bin/**', 'scripts/**', '.github/workflows/linux-build.yml' ]

env:
OPENCV4NODEJS_AUTOBUILD_OPENCV_VERSION : 4.7.0
#env:
# OPENCV4NODEJS_AUTOBUILD_OPENCV_VERSION : 4.7.0

jobs:
build:
Expand All @@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
# node-version: [14.x, 16.x, 18.x]
node-version: [18.x, 20.x]
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand All @@ -38,5 +38,6 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm run build
- run: node bin/main.js --version 4.7.0
- name: node bin/main.js --version 4.7.0
run: node bin/main.js
- run: pnpm test
17 changes: 9 additions & 8 deletions .github/workflows/mac-detect.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: detect openCV from MacOS Brew no AUTOBUILD
name: Use OpenCV from Brew
on:
push:
branches: [ "never", "master" ]
branches: [ "never", "master", "test" ]
paths: ['src/**', 'dist/**', 'package.json', 'pnpm-lock.yaml', 'pnpmfile.js', 'test/**', 'bin/**', 'scripts/**', '.github/workflows/mac-detect.yml' ]
# pull_request:
# branches: [ "master" ]
Expand All @@ -15,26 +15,27 @@ jobs:
# node-version: [14.x, 16.x, 18.x]
opencv_version:
- 4

env:
OPENCV4NODEJS_DISABLE_AUTOBUILD: 1
steps:
- name: Install OpenCV ${{ matrix.opencv_version }}
run: |
brew install opencv@${{ matrix.opencv_version }}
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8.14.0
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
- name: Install OpenCV ${{ matrix.opencv_version }}
run: |
brew install opencv@${{ matrix.opencv_version }}
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'pnpm'
- run: pnpm run build
- run: node bin/main.js --prebuild=latestBuild
# --prebuild=latestBuild
- name: Detect OpenCV
run: node bin/main.js --verbose
- run: pnpm test
18 changes: 11 additions & 7 deletions .github/workflows/w64-detect.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: detect openCV from Chocolatey
name: Use openCV from Chocolatey
on:
push:
branches: [ "never" ]
branches: [ "never", "test" ]
paths: ['src/**', 'dist/**', 'package.json', 'pnpm-lock.yaml', 'pnpmfile.js', 'test/**', 'bin/**', 'scripts/**', '.github/workflows/w64-detect.yml' ]
# pull_request:
# branches: [ "master" ]
Expand All @@ -14,26 +14,30 @@ jobs:
matrix:
# node-version: [14.x, 16.x, 18.x]
opencv_version:
- 4.7.0
- 4.9.0
- 4.6.0
env:
OPENCV4NODEJS_DISABLE_AUTOBUILD: 1
steps:
#- name: Install cmake
# run: sudo apt-get install -y cmake
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8.14.0
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
- name: Install OpenCV
- name: Install OpenCV ${{ matrix.opencv_version }}
run: |
choco install OpenCV -y --version ${{ matrix.opencv_version }}
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'pnpm'
- run: pnpm run build
- run: node bin/main.js --prebuild=latestBuild
# --prebuild=latestBuild
- name: Detect OpenCV
run: node bin/main.js --verbose
- run: pnpm test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ dist/esm/*.map
dist/cjs/*.js
dist/cjs/*.ts
dist/cjs/*.map
latest
dist/esm/helper
dist/cjs/helper
13 changes: 9 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,19 @@
{
"type": "node",
"request": "launch",
"name": "install 4.5.3",
"program": "${workspaceFolder}/bin/main.js",
"name": "bin/main.ts",
"program": "${workspaceFolder}/bin/main.ts",
"args": ["--prebuild=latestBuild", "--verbose"],
"preLaunchTask": "tsc: build - tsconfig.json",
"outFiles": ["${workspaceFolder}/lib/**/*.js"],
"runtimeArgs": ["-r", "ts-node/register"],
"env": {
"OPENCV4NODEJS_AUTOBUILD_OPENCV_VERSION": "4.5.3",
"TS_NODE_PROJECT": "${workspaceFolder}/tsconfig-cjs.json",
"OPENCV4NODEJS_DISABLE_AUTOBUILD": "1",
"OPENCV_BUILD_ROOT": "",
// "OPENCV4NODEJS_AUTOBUILD_OPENCV_VERSION": "4.5.3",
// "OPENCV4NODEJS_AUTOBUILD_FLAGS": "-DBUILD_LIST=core,imgproc,imgcodecs,videoio,highgui,video,calib3d,features2d,objdetect,dnn,ml,flann,photo,stitching,gapi,face,text",
"OPENCV_GIT_CACHE": "1"
// "OPENCV_GIT_CACHE": "1"
},
"console": "integratedTerminal"
},
Expand Down
3 changes: 2 additions & 1 deletion bin/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env node
const OpenCVBuilder = require("../dist/cjs/OpenCVBuilder.js");
void new OpenCVBuilder.OpenCVBuilder(process.argv).install();
const builder = new OpenCVBuilder.OpenCVBuilder(process.argv);
void builder.install();
5 changes: 5 additions & 0 deletions bin/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env node
import * as OpenCVBuilder from "../src/OpenCVBuilder"
//= require("../dist/cjs/OpenCVBuilder.js");
const builder = new OpenCVBuilder.OpenCVBuilder(process.argv);
void builder.install();
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"access": "public"
},
"scripts": {
"clean": "rimraf build",
"clean": "rimraf dist/{cjs,esm}/*.{js,d.ts,map} dist/{cjs,esm}/helper",
"build": "tsc --pretty --project . && tsc --pretty --project tsconfig-cjs.json",
"build3x": "npm run build && node bin/main.js --keepsource",
"install_macm1": "npm run build && node bin/main.js --version 4.5.5 --flag=\"-DCMAKE_SYSTEM_PROCESSOR=arm64 -DCMAKE_OSX_ARCHITECTURES=arm64\"",
Expand Down
Loading

0 comments on commit 3c528d9

Please sign in to comment.