From 9552b55bded99b20c5c53afb71f1baff4ff9ff70 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Mon, 27 Jan 2025 17:28:59 +0100 Subject: [PATCH 1/5] start adding github ci --- .github/workflows/build.yml | 82 +++++++++++++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 83 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4d78cba --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,82 @@ +name: Build + +on: + push: + branches: + - main + paths: + - ".github/workflows/**" + - "script/build.*" + - "src/ffi.ts" + - "webview/**" + - ".gitmodules" + - "package.json" + +jobs: + build: + name: ${{ matrix.kind }} ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + strategy: + matrix: + os: + [ + macos-latest, + macos-13, + windows-latest, + ubuntu-latest, + ubuntu-24.04-arm, + ] + + steps: + - name: Clone repository + uses: actions/checkout@v3 + with: + submodules: true + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + + - name: install webkit2gtk (Linux) + if: startsWith(matrix.os, 'ubuntu') + run: | + sudo apt-get update + sudo apt-get install -y webkitgtk-6.0 libwebkitgtk-6.0-dev cmake ninja-build clang pkg-config libgtk-4-dev + + - name: Install ninja (macOS) + if: startsWith(matrix.os, 'macos') + run: | + brew install ninja + brew install llvm + echo "WEBVIEW_CLANG_FORMAT_EXE=$(brew --prefix llvm)/bin/clang-format" >> $GITHUB_ENV + + - name: Install ninja (Windows) + if: matrix.os == 'windows-latest' + run: | + choco install ninja + + - name: Build dynamic library + run: bun scripts/build.ts + + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: build + path: | + build/*.dll + build/*.dylib + build/*.so + + # - name: Release Plugin + # uses: softprops/action-gh-release@master + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # tag_name: "0.9.1" + # files: | + # build/libwebview.x86_64.dylib + # build/libwebview.aarch64.dylib + # build/libwebview.x86_64.so + # build/libwebview.aarch64.so + # build/webview.dll + # build/Webview2Loader.dll diff --git a/.gitignore b/.gitignore index 6252398..4fd2a9a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules/ bun.lockb .vscode +.zed /webview/** From 4a8979326c09ef52849afd4d033ba32ace4e2f4d Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Mon, 27 Jan 2025 17:30:37 +0100 Subject: [PATCH 2/5] start testing ci --- .github/workflows/build.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4d78cba..5aaf1d9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,13 +4,14 @@ on: push: branches: - main - paths: - - ".github/workflows/**" - - "script/build.*" - - "src/ffi.ts" - - "webview/**" - - ".gitmodules" - - "package.json" + - ci + # paths: + # - ".github/workflows/**" + # - "script/build.*" + # - "src/ffi.ts" + # - "webview/**" + # - ".gitmodules" + # - "package.json" jobs: build: @@ -18,6 +19,7 @@ jobs: runs-on: ${{ matrix.os }} timeout-minutes: 60 strategy: + fail-fast: false matrix: os: [ From f09864e257b9f409506ad6b5b421b9c0b0fe634d Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Mon, 27 Jan 2025 17:38:39 +0100 Subject: [PATCH 3/5] ci --- scripts/build.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/build.ts b/scripts/build.ts index 05a5f82..bea1ef2 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -1,5 +1,4 @@ import { $ } from "bun"; -$.nothrow(); const { arch, platform } = process; @@ -24,10 +23,19 @@ switch (platform) { case "darwin": await $` cd webview - cmake -G "Ninja Multi-Config" -B build -S . -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/universal-macos-llvm.cmake + cmake -G "Ninja Multi-Config" -B build -S . \ + -DCMAKE_BUILD_TYPE=Release \ + -DWEBVIEW_BUILD_TESTS=OFF \ + -DWEBVIEW_BUILD_EXAMPLES=OFF \ + -DWEBVIEW_USE_CLANG_TOOLS=OFF \ + -DWEBVIEW_ENABLE_CHECKS=OFF \ + -DWEBVIEW_USE_CLANG_TIDY=OFF \ + -DWEBVIEW_BUILD_DOCS=OFF \ + -DWEBVIEW_USE_CLANG_FORMAT=OFF \ + -DWEBVIEW_CLANG_FORMAT_EXE=${process.env.WEBVIEW_CLANG_FORMAT_EXE} cmake --build build --config Release - cp build/core/Release/libwebview.dylib ../build/libwebview.dylib - strip -x -S ../build/libwebview.dylib - `; + cp build/core/Release/libwebview.dylib ../build/libwebview.${arch}.dylib + strip -x -S ../build/libwebview.${arch}.dylib + ` break; } From 2248177a9ffc993f89e6bfb8f75241090b593b1e Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Mon, 27 Jan 2025 18:17:22 +0100 Subject: [PATCH 4/5] ci --- scripts/build.bat | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/build.bat b/scripts/build.bat index c0b5c8f..afef04e 100644 --- a/scripts/build.bat +++ b/scripts/build.bat @@ -3,23 +3,27 @@ echo Looking for vswhere.exe... set "vswhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" if not exist "%vswhere%" set "vswhere=%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" if not exist "%vswhere%" ( - echo ERROR: Failed to find vswhere.exe - exit /b 1 + echo ERROR: Failed to find vswhere.exe + exit /b 1 ) echo Found %vswhere% echo Looking for VC... for /f "usebackq tokens=*" %%i in (`"%vswhere%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do ( - set vc_dir=%%i + set vc_dir=%%i ) if not exist "%vc_dir%\Common7\Tools\vsdevcmd.bat" ( - echo ERROR: Failed to find VC tools x86/x64 - exit /b 1 + echo ERROR: Failed to find VC tools x86/x64 + exit /b 1 ) echo Found %vc_dir% call "%vc_dir%\Common7\Tools\vsdevcmd.bat" -arch=x64 -host_arch=x64 cd %~dp0..\webview -cmake -G "Ninja Multi-Config" -B build -S . -cmake --build build --config Release \ No newline at end of file +cmake -G "Ninja Multi-Config" -B build -S . ^ + -DWEBVIEW_BUILD_DOCS=OFF ^ + -DWEBVIEW_USE_CLANG_TIDY=OFF ^ + -DWEBVIEW_USE_CLANG_FORMAT=OFF + +cmake --build build --config Release From 12db31b6d90cd3c6f03a674026e7b1125984a7e8 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Mon, 27 Jan 2025 18:23:58 +0100 Subject: [PATCH 5/5] done --- .github/workflows/build.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5aaf1d9..999e734 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,14 +4,13 @@ on: push: branches: - main - - ci - # paths: - # - ".github/workflows/**" - # - "script/build.*" - # - "src/ffi.ts" - # - "webview/**" - # - ".gitmodules" - # - "package.json" + paths: + - ".github/workflows/**" + - "script/build.*" + - "src/ffi.ts" + - "webview/**" + - ".gitmodules" + - "package.json" jobs: build: