Skip to content

Commit

Permalink
check
Browse files Browse the repository at this point in the history
  • Loading branch information
udarrr committed Jun 28, 2023
1 parent 963daf5 commit 9abbea2
Show file tree
Hide file tree
Showing 6 changed files with 313 additions and 120 deletions.
258 changes: 165 additions & 93 deletions .github/workflows/tagged_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- v4.1.*

jobs:
prebuild-node:
prebuild-lib:
name: 'Build on Node v${{ matrix.node }} ${{ matrix.os.name }} ${{ matrix.arch }}'
runs-on: ${{ matrix.os.name }}-${{ matrix.os.version }}

Expand All @@ -18,7 +18,7 @@ jobs:
version: latest
- name: Windows
version: 2019
node: ['12','13','14','15','16','17','18','19.0.0', '20.0.0']
node: ['16']
arch: [x64]
steps:
- name: Set up Git repository
Expand All @@ -30,83 +30,55 @@ jobs:
architecture: ${{ matrix.arch }}
- name: 'Install npm@^8 to get a more up to date bundled node-gyp'
run: npm install --global npm@8.3.1
- name: 'Install Linux dependencies'
- name: 'Add Windows apps'
if: ${{ matrix.os.name == 'Windows' }}
run: |
choco install cmake -y
choco upgrade cmake
- name: 'Setup-msbuild'
if: ${{ matrix.os.name == 'Windows' }}
uses: microsoft/setup-msbuild@v1.1.3
- name: 'Add Linux apps'
if: ${{ matrix.os.name == 'Ubuntu' }}
run: |
sudo apt-get update
sudo apt-get install libudev-dev
- name: 'Install python'
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: 'Install Mac dependencies'
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install cmake
- name: 'Add macos apps'
if: ${{ matrix.os.name == 'macos' }}
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest
- name: Install
run: npm ci --unsafe-perm
- name: Prebuild
shell: bash
run: npm run prebuild
- uses: ncipollo/release-action@v1
with:
artifacts: "prebuilds/*.tar.gz"
allowUpdates: true

prebuild-electron-node14:
name: 'Build on Node v${{ matrix.node }} ${{ matrix.os.name }} ${{ matrix.arch }} electron ${{ matrix.electron }}'
runs-on: ${{ matrix.os.name }}-${{ matrix.os.version }}

strategy:
matrix:
os:
- name: Ubuntu
version: latest
- name: macOS
version: latest
- name: Windows
version: 2019
node: ['14']
arch: [x64]
runtime: [ electron ]
electron: [ "8.0.0", "9.0.0", "10.0.0", "11.0.0", "12.0.0", "13.0.0", "14.0.0" ]
steps:
- name: Set up Git repository
uses: actions/checkout@v2
- name: Set up node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.arch }}
- name: 'Install npm@^8 to get a more up to date bundled node-gyp'
run: npm install --global npm@8.3.1
- name: 'Install Linux dependencies'
if: ${{ matrix.os.name == 'Ubuntu' }}
run: |
sudo apt-get update
sudo apt-get install libudev-dev
- name: 'Install python'
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: 'Install Mac dependencies'
- name: Dependency install
run: npm ci --unsafe-perm
- name: Create opencvlib
run: npm run create_opencvlib
- name: 'Send Windows release to storage'
if: ${{ matrix.os.name == 'Windows' }}
uses: ncipollo/release-action@v1
with:
artifacts: "osOpencvWorlds/win32/*.tgz"
allowUpdates: true
- name: 'Send macos release to storage'
if: ${{ matrix.os.name == 'macos' }}
uses: maxim-lobanov/setup-xcode@v1
uses: ncipollo/release-action@v1
with:
xcode-version: latest
- name: Install
run: npm ci --unsafe-perm
- name: Prebuild
shell: bash
run: npm run prebuild -- -t ${{matrix.electron}} -r ${{matrix.runtime}}
- uses: ncipollo/release-action@v1
artifacts: "osOpencvWorlds/darwin/*.tgz"
allowUpdates: true
- name: 'Send Ubuntu release to storage'
if: ${{ matrix.os.name == 'Ubuntu' }}
uses: ncipollo/release-action@v1
with:
artifacts: "prebuilds/*.tar.gz"
artifacts: "osOpencvWorlds/linux/*.tgz"
allowUpdates: true

prebuild-electron-node16:
name: 'Build on Node v${{ matrix.node }} ${{ matrix.os.name }} ${{ matrix.arch }} electron ${{ matrix.electron }}'
prebuild-node:
name: 'Build on Node v${{ matrix.node }} ${{ matrix.os.name }} ${{ matrix.arch }}'
runs-on: ${{ matrix.os.name }}-${{ matrix.os.version }}

strategy:
Expand All @@ -118,10 +90,8 @@ jobs:
version: latest
- name: Windows
version: 2019
node: ['16']
node: ['12','13','14','15','16','17','18','19.0.0', '20.0.0']
arch: [x64]
runtime: [ electron ]
electron: [ "15.0.0", "16.0.0", "17.0.0", "18.0.0", "19.0.0" ]
steps:
- name: Set up Git repository
uses: actions/checkout@v2
Expand Down Expand Up @@ -150,34 +120,136 @@ jobs:
run: npm ci --unsafe-perm
- name: Prebuild
shell: bash
run: npm run prebuild -- -t ${{matrix.electron}} -r ${{matrix.runtime}}
run: npm run prebuild
- uses: ncipollo/release-action@v1
with:
artifacts: "prebuilds/*.tar.gz"
allowUpdates: true

deploy:
needs:
- prebuild-node
- prebuild-electron-node14
- prebuild-electron-node16
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v2
- name: Set up node
uses: actions/setup-node@v2
with:
node-version: 14
registry-url: 'https://registry.npmjs.org'
- name: 'Install npm@^8'
run: npm install --global npm@8.3.1
- name: Install
run: npm ci --unsafe-perm
- name: Publish tagged release to npm
run: |
npm i clean-package -g
npm whoami
npm run publish_package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# prebuild-electron-node14:
# name: 'Build on Node v${{ matrix.node }} ${{ matrix.os.name }} ${{ matrix.arch }} electron ${{ matrix.electron }}'
# runs-on: ${{ matrix.os.name }}-${{ matrix.os.version }}

# strategy:
# matrix:
# os:
# - name: Ubuntu
# version: latest
# - name: macOS
# version: latest
# - name: Windows
# version: 2019
# node: ['14']
# arch: [x64]
# runtime: [ electron ]
# electron: [ "8.0.0", "9.0.0", "10.0.0", "11.0.0", "12.0.0", "13.0.0", "14.0.0" ]
# steps:
# - name: Set up Git repository
# uses: actions/checkout@v2
# - name: Set up node
# uses: actions/setup-node@v2
# with:
# node-version: ${{ matrix.node }}
# architecture: ${{ matrix.arch }}
# - name: 'Install npm@^8 to get a more up to date bundled node-gyp'
# run: npm install --global npm@8.3.1
# - name: 'Install Linux dependencies'
# if: ${{ matrix.os.name == 'Ubuntu' }}
# run: |
# sudo apt-get update
# sudo apt-get install libudev-dev
# - name: 'Install python'
# uses: actions/setup-python@v4
# with:
# python-version: '3.9'
# - name: 'Install Mac dependencies'
# if: ${{ matrix.os.name == 'macos' }}
# uses: maxim-lobanov/setup-xcode@v1
# with:
# xcode-version: latest
# - name: Install
# run: npm ci --unsafe-perm
# - name: Prebuild
# shell: bash
# run: npm run prebuild -- -t ${{matrix.electron}} -r ${{matrix.runtime}}
# - uses: ncipollo/release-action@v1
# with:
# artifacts: "prebuilds/*.tar.gz"
# allowUpdates: true

# prebuild-electron-node16:
# name: 'Build on Node v${{ matrix.node }} ${{ matrix.os.name }} ${{ matrix.arch }} electron ${{ matrix.electron }}'
# runs-on: ${{ matrix.os.name }}-${{ matrix.os.version }}

# strategy:
# matrix:
# os:
# - name: Ubuntu
# version: latest
# - name: macOS
# version: latest
# - name: Windows
# version: 2019
# node: ['16']
# arch: [x64]
# runtime: [ electron ]
# electron: [ "15.0.0", "16.0.0", "17.0.0", "18.0.0", "19.0.0" ]
# steps:
# - name: Set up Git repository
# uses: actions/checkout@v2
# - name: Set up node
# uses: actions/setup-node@v2
# with:
# node-version: ${{ matrix.node }}
# architecture: ${{ matrix.arch }}
# - name: 'Install npm@^8 to get a more up to date bundled node-gyp'
# run: npm install --global npm@8.3.1
# - name: 'Install Linux dependencies'
# if: ${{ matrix.os.name == 'Ubuntu' }}
# run: |
# sudo apt-get update
# sudo apt-get install libudev-dev
# - name: 'Install python'
# uses: actions/setup-python@v4
# with:
# python-version: '3.9'
# - name: 'Install Mac dependencies'
# if: ${{ matrix.os.name == 'macos' }}
# uses: maxim-lobanov/setup-xcode@v1
# with:
# xcode-version: latest
# - name: Install
# run: npm ci --unsafe-perm
# - name: Prebuild
# shell: bash
# run: npm run prebuild -- -t ${{matrix.electron}} -r ${{matrix.runtime}}
# - uses: ncipollo/release-action@v1
# with:
# artifacts: "prebuilds/*.tar.gz"
# allowUpdates: true

# deploy:
# needs:
# - prebuild-node
# - prebuild-electron-node14
# - prebuild-electron-node16
# runs-on: ubuntu-latest
# steps:
# - name: Set up Git repository
# uses: actions/checkout@v2
# - name: Set up node
# uses: actions/setup-node@v2
# with:
# node-version: 14
# registry-url: 'https://registry.npmjs.org'
# - name: 'Install npm@^8'
# run: npm install --global npm@8.3.1
# - name: Install
# run: npm ci --unsafe-perm
# - name: Publish tagged release to npm
# run: |
# npm i clean-package -g
# npm whoami
# npm run publish_package
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 1 addition & 5 deletions build_src_opencv/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,7 @@ class InstallOpencv {
packageJson.opencv4nodejs.disableAutoBuild = 1;

try {
let patterns: Array<string> = [
path.join(process.cwd(), "opencv", "build", "include"),
path.join(process.cwd(), "opencv", "build", "lib"),
path.join(process.cwd(), "opencv", "build", "bin"),
];
let patterns: Array<string> = [path.join("opencv", "build", "include"), path.join("opencv", "build", "lib"), path.join("opencv", "build", "bin")];

if (process.platform === "darwin") {
await Pack.pack(patterns, `${path.join(process.cwd(), "osOpencvWorlds", "darwin", file)}`);
Expand Down
47 changes: 47 additions & 0 deletions install/download.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const pack_1 = require("../build_release_opencv/build_src_opencv/pack");
const Downloader = require("nodejs-file-downloader");
const packageJson = require("../package.json");
const path = require("path");
const file = `opencv_${process.platform}_${packageJson.opencv4nodejs.autoBuildOpencvVersion.replaceAll(".", "")}.tgz`;
async function download() {
let libUrl;
let dir;
if (process.platform === "win32") {
libUrl = `https://github.com/udarrr/opencv4nodejs-prebuilt-install/releases/download/v${
packageJson.version
}/opencv_win32_${packageJson.opencv4nodejs.autoBuildOpencvVersion.replaceAll(".", "")}.tgz`;
dir = path.join(process.cwd(), "osOpencvWorlds", "win32");
}
if (process.platform === "darwin") {
libUrl = `https://github.com/udarrr/opencv4nodejs-prebuilt-install/releases/download/v${
packageJson.version
}/opencv_darwin_${packageJson.opencv4nodejs.autoBuildOpencvVersion.replaceAll(".", "")}.tgz`;
dir = path.join(process.cwd(), "osOpencvWorlds", "darwin");
}
if (process.platform === "linux") {
libUrl = `https://github.com/udarrr/opencv4nodejs-prebuilt-install/releases/download/v${
packageJson.version
}/opencv_linux_${packageJson.opencv4nodejs.autoBuildOpencvVersion.replaceAll(".", "")}.tgz`;
dir = path.join(process.cwd(), "osOpencvWorlds", "linux");
}
const downloader = new Downloader({
url: libUrl,
directory: dir,
});
try {
await downloader.download();
if (process.platform === "darwin") {
pack_1.Pack.unpack(`${path.join(process.cwd(), "osOpencvWorlds", "darwin")}`, `${path.join(process.cwd(), "osOpencvWorlds", "darwin", file)}`);
} else if (process.platform === "linux") {
pack_1.Pack.unpack(`${path.join(process.cwd(), "osOpencvWorlds", "linux")}`, `${path.join(process.cwd(), "osOpencvWorlds", "linux", file)}`);
} else if (process.platform === "win32") {
pack_1.Pack.unpack(`${path.join(process.cwd(), "osOpencvWorlds", "win32")}`, `${path.join(process.cwd(), "osOpencvWorlds", "win32", file)}`).then(() => console.log("done"));
}
console.log("All done");
} catch (error) {
console.log("Download failed", error);
}
}
download();
Loading

0 comments on commit 9abbea2

Please sign in to comment.