CI build changed plugins (#1323)

* Fix WritableDeviceState

* Fix tsconfig error

* Fix test

* Create build-plugins-changed.yml

* Update build-sdk.yml

* Update build-plugins-changed.yml
This commit is contained in:
Long Zheng
2024-02-19 18:12:39 +11:00
committed by GitHub
parent 064da326c0
commit eec6291d9e
4 changed files with 43 additions and 28 deletions

View File

@@ -0,0 +1,40 @@
name: Build changed plugins
on:
push:
branches: ["main"]
paths: ["plugins/**"]
pull_request:
paths: ["plugins/**"]
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Set up base packages
run: ./npm-install.sh
- name: Build changed plugins
run: |
# Get the list of changed directories in /plugins
changed_dirs=$(git diff --name-only HEAD^ HEAD ./plugins | awk -F/ '{print $2}' | uniq)
# Loop through each changed directory
for dir in $changed_dirs; do
pushd "./plugins/$dir"
echo "plugins/$dir > npm install"
npm install
echo "plugins/$dir > npm run build"
npm run build
popd
done

View File

@@ -18,7 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npm ci

View File

@@ -1,6 +1,5 @@
import { writeFileSync } from "fs";
import { ffmpegFilterImage } from "../src/ffmpeg-image-filter";
import { sharpFilterImage } from "../src/sharp-image-filter";
import path from 'path';
async function main1() {
@@ -27,29 +26,4 @@ async function main1() {
console.log('test1 done');
}
async function main2() {
const ret = await sharpFilterImage('/Users/koush/Downloads/151-1678381127261.jpg',
{
blur: true,
// crop: {
// // fractional: true,
// left: 100,
// top: 100,
// width: 1000,
// height: 500,
// },
brightness: -.2,
text: {
fontFile: path.join(__dirname, '../fs/Lato-Bold.ttf'),
text: 'Hello World',
}
// }
// { "crop": { "left": 0.216796875, "top": 0.2552083333333333, "width": 0.318359375, "height": 0.17907714843749994, "fractional": true }
}
);
writeFileSync('test2.jpg', ret);
console.log('test2 done');
}
main1();
main2();

View File

@@ -8,6 +8,7 @@
"sourceMap": true
},
"include": [
"src/**/*"
"src/**/*",
"test/**/*",
]
}