From 0f27af4f8bb026eab7349c97f5e3906f6121278c Mon Sep 17 00:00:00 2001 From: CircuitX Date: Sun, 8 Jun 2025 13:43:03 +0800 Subject: [PATCH 1/9] chore(ci): rename build.yaml to baas_ocr.yaml - rename `build.yaml` to `baas_ocr_yaml` - rename baas ocr workflow name `CI` shown on GitHub to `bass ocr ci/cd` --- .github/workflows/{build.yaml => baas_ocr.yaml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{build.yaml => baas_ocr.yaml} (99%) diff --git a/.github/workflows/build.yaml b/.github/workflows/baas_ocr.yaml similarity index 99% rename from .github/workflows/build.yaml rename to .github/workflows/baas_ocr.yaml index 07c00be..4790cda 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/baas_ocr.yaml @@ -1,4 +1,4 @@ -name: CI +name: baas ocr ci/cd on: From 175c0fc0a366f4a66fd7e4dfe26e053c527c2dce Mon Sep 17 00:00:00 2001 From: CircuitX Date: Sun, 15 Jun 2025 15:59:19 +0800 Subject: [PATCH 2/9] refactor(ci): simplify workflow's triggers on ocr ci/cd - change `on/push/paths` to `apps/ocr_server/CMakeLists.txt` - change `on/pull_request/paths` to `paths-ignore/docs/**` - set `main` to `on/pull_request/branches` - simplify code's style for better reading --- .github/workflows/baas_ocr.yaml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/baas_ocr.yaml b/.github/workflows/baas_ocr.yaml index 4790cda..d9053f0 100644 --- a/.github/workflows/baas_ocr.yaml +++ b/.github/workflows/baas_ocr.yaml @@ -11,10 +11,17 @@ on: push: branches: - main - paths: ['resource/**', 'apps/ocr_server/test/**', '.github/workflows/build.yaml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cmake'] + paths: + - 'apps/ocr_server/CMakeLists.txt' pull_request: - types: [opened, synchronize, reopened] - paths: ['resource/**', 'apps/ocr_server/test/**', '.github/workflows/build.yaml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cmake'] + branches: + - main + types: + - opened + - synchronize + - reopened + paths-ignore: + - 'docs/**' concurrency: From 6a39bff064f045ea0db52fe70997191934b691dc Mon Sep 17 00:00:00 2001 From: CircuitX Date: Sun, 15 Jun 2025 16:20:31 +0800 Subject: [PATCH 3/9] feat(ci): initialize ci/cd workflow for baas_afwc - Warning: only supports Windows platform now --- .github/workflows/baas_afwc.yaml | 81 ++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .github/workflows/baas_afwc.yaml diff --git a/.github/workflows/baas_afwc.yaml b/.github/workflows/baas_afwc.yaml new file mode 100644 index 0000000..6e707be --- /dev/null +++ b/.github/workflows/baas_afwc.yaml @@ -0,0 +1,81 @@ +name: baas afwc ci/cd + + +on: + workflow_dispatch: + inputs: + create_release: + description: 'Create new release' + required: true + type: boolean + push: + branches: + - main + paths: + - 'apps/BAAS_auto_fight_workflow_checker/CMakeLists.txt' + pull_request: + branches: + - main + types: + - opened + - synchronize + - reopened + paths-ignore: + - 'docs/**' + + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} + cancel-in-progress: true + + +permissions: + contents: write # for creating release + + +env: + BUILD_TYPE: Release + BUILD_BAAS_AW_CHECKER: ON + + +jobs: + Windows-latest-cmake-x64: + name: 'Build Binary for Windows x64' + runs-on: windows-latest + defaults: + run: + working-directory: ./baas_cpp + steps: + - name: Clone Source Repo + id: checkout_main + uses: actions/checkout@v4 + with: + fetch-depth: 0 + path: "baas_cpp" + + - name: Install Build Dependencies + id: install_build_depends + run: | + choco install ninja + + - name: Setup MSVC Dev Cmd # Setup Developer Command Prompt for Microsotf Visual C++ + uses: TheMrMilchmann/setup-msvc-dev@v3 + with: + arch: x64 + + - name: Build + id: cmake_build + run: | + Write-Output "::group::Generate makefile" + cmake -S . -B build -DBUILD_BAAS_AW_CHECKER=${{env.BUILD_BAAS_OCR}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -G Ninja # Hard encode command with env var before exec + Write-Output "::endgroup::" + Write-Output "::group::Build" + cmake --build build --config Release -j 4 # TODO: add number of threads + Write-Output "::endgroup::" + + - name: Upload artifacts + # if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/main' ) || github.event.inputs.create_release == 'true' }} + uses: actions/upload-artifact@v4 + with: + path: ./baas_cpp/build/bin + name: baas-afwc-bin-windows-x64 From 346a6116cb507a1ea693b860bb6d726ce8a0092d Mon Sep 17 00:00:00 2001 From: CircuitX Date: Sun, 15 Jun 2025 16:34:28 +0800 Subject: [PATCH 4/9] fix(ci): fix wrong env vars in build cmds --- .github/workflows/baas_afwc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/baas_afwc.yaml b/.github/workflows/baas_afwc.yaml index 6e707be..b9a8f1e 100644 --- a/.github/workflows/baas_afwc.yaml +++ b/.github/workflows/baas_afwc.yaml @@ -67,7 +67,7 @@ jobs: id: cmake_build run: | Write-Output "::group::Generate makefile" - cmake -S . -B build -DBUILD_BAAS_AW_CHECKER=${{env.BUILD_BAAS_OCR}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -G Ninja # Hard encode command with env var before exec + cmake -S . -B build -DBUILD_BAAS_AW_CHECKER=${{env.BUILD_BAAS_AW_CHECKER}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -G Ninja # Hard encode command with env var before exec Write-Output "::endgroup::" Write-Output "::group::Build" cmake --build build --config Release -j 4 # TODO: add number of threads From 009689ef3b898f2ff0e652a40411a0329622cdd5 Mon Sep 17 00:00:00 2001 From: CircuitX Date: Sun, 15 Jun 2025 17:10:58 +0800 Subject: [PATCH 5/9] feat(ci): initialize ci/cd workflow for baas_app - Warning: only supports Windows platform now --- .github/workflows/baas_app.yaml | 92 +++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 .github/workflows/baas_app.yaml diff --git a/.github/workflows/baas_app.yaml b/.github/workflows/baas_app.yaml new file mode 100644 index 0000000..34826a6 --- /dev/null +++ b/.github/workflows/baas_app.yaml @@ -0,0 +1,92 @@ +name: baas app ci/cd + + +on: + workflow_dispatch: + inputs: + create_release: + description: 'Create new release' + required: true + type: boolean + push: + branches: + - main + paths: + - 'apps/BAAS/CMakeLists.txt' + pull_request: + branches: + - main + types: + - opened + - synchronize + - reopened + paths-ignore: + - 'docs/**' + + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} + cancel-in-progress: true + + +permissions: + contents: write # for creating release + + +env: + BUILD_TYPE: Release + BUILD_APP_BAAS: ON + BAAS_APP_USE_CUDA: ON + RUNNER_TEMP_DIR: './tmp' + ONNXRUNTIME_URL: 'https://github.com/microsoft/onnxruntime/releases/download/v1.22.0/onnxruntime-win-x64-gpu-1.22.0.zip' + + +jobs: + Windows-latest-cmake-x64: + name: 'Build Binary for Windows x64' + runs-on: windows-latest + defaults: + run: + working-directory: ./baas_cpp + steps: + - name: Clone Source Repo + id: checkout_main + uses: actions/checkout@v4 + with: + fetch-depth: 0 + path: "baas_cpp" + + - name: Install Build Dependencies + id: install_build_depends + run: | + choco install ninja + + - name: Fetch onnxruntime + id: fetch_onnxruntime + shell: msys2 {0} + run: | + wget -O onnxruntime.zip ${{env.ONNXRUNTIME_URL}} + unzip onnxruntime.zip -d ${{env.RUNNER_TEMP_DIR}} + mv ${{env.RUNNER_TEMP_DIR}}/lib/onnxruntime_providers_cuda.dll dll/Windows/ + + - name: Setup MSVC Dev Cmd # Setup Developer Command Prompt for Microsotf Visual C++ + uses: TheMrMilchmann/setup-msvc-dev@v3 + with: + arch: x64 + + - name: Build + id: cmake_build + run: | + Write-Output "::group::Generate makefile" + cmake -S . -B build -DBUILD_APP_BAAS=${{env.BUILD_APP_BAAS}} -DBAAS_APP_USE_CUDA=${{env.BAAS_APP_USE_CUDA}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -G Ninja # Hard encode command with env var before exec + Write-Output "::endgroup::" + Write-Output "::group::Build" + cmake --build build --config Release -j 4 # TODO: add number of threads + Write-Output "::endgroup::" + + - name: Upload artifacts + # if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/main' ) || github.event.inputs.create_release == 'true' }} + uses: actions/upload-artifact@v4 + with: + path: ./baas_cpp/build/bin + name: baas-app-bin-windows-x64 From eff645e5228eda9586cb97af70678cc6153aaa10 Mon Sep 17 00:00:00 2001 From: CircuitX Date: Sun, 15 Jun 2025 20:22:22 +0800 Subject: [PATCH 6/9] chore(build): set BUILD_BAAS_OCR=OFF as default --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e5b52c2..e329bb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,7 @@ option(BUILD_APP_BAAS "Build BAAS app " OFF) option(BUILD_APP_ISA "Build ISA app " OFF) # other -option(BUILD_BAAS_OCR "build the ocr server app" ON) +option(BUILD_BAAS_OCR "build the ocr server app" OFF) option(BUILD_BAAS_AW_CHECKER "build BAAS Auto Fight Workflow Checker" OFF) check_app_options( From d48583f22b839b08ca3ad818df5237723216f249 Mon Sep 17 00:00:00 2001 From: CircuitX Date: Sun, 15 Jun 2025 23:34:03 +0800 Subject: [PATCH 7/9] fix(ci): baas_app ci/cd failed on fetching onnxruntime --- .github/workflows/baas_app.yaml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/baas_app.yaml b/.github/workflows/baas_app.yaml index 34826a6..91f3555 100644 --- a/.github/workflows/baas_app.yaml +++ b/.github/workflows/baas_app.yaml @@ -37,7 +37,6 @@ env: BUILD_TYPE: Release BUILD_APP_BAAS: ON BAAS_APP_USE_CUDA: ON - RUNNER_TEMP_DIR: './tmp' ONNXRUNTIME_URL: 'https://github.com/microsoft/onnxruntime/releases/download/v1.22.0/onnxruntime-win-x64-gpu-1.22.0.zip' @@ -61,13 +60,23 @@ jobs: run: | choco install ninja + - name: Setup MSYS2 + id: setup_msys2 + uses: msys2/setup-msys2@v2 + with: + msystem: UCRT64 + update: true + install: >- + wget + unzip + - name: Fetch onnxruntime id: fetch_onnxruntime shell: msys2 {0} run: | - wget -O onnxruntime.zip ${{env.ONNXRUNTIME_URL}} - unzip onnxruntime.zip -d ${{env.RUNNER_TEMP_DIR}} - mv ${{env.RUNNER_TEMP_DIR}}/lib/onnxruntime_providers_cuda.dll dll/Windows/ + wget -q -O onnxruntime.zip ${{env.ONNXRUNTIME_URL}} + unzip onnxruntime.zip + mv ./onnxruntime-win-x64-gpu-1.22.0/lib/onnxruntime_providers_cuda.dll dll/Windows/ - name: Setup MSVC Dev Cmd # Setup Developer Command Prompt for Microsotf Visual C++ uses: TheMrMilchmann/setup-msvc-dev@v3 From ee4f558fc71c5649c9391600925d4496227b6987 Mon Sep 17 00:00:00 2001 From: CircuitX Date: Fri, 27 Jun 2025 15:51:35 +0800 Subject: [PATCH 8/9] chore(ci): typo baas_ocr_ci.yaml - move `install_gcc_13` behind `install_build_deps` - typo `Upload Artifacts` (cherry picked from commit 55431a41c74a352323248487089af571d6db25ce) --- .github/workflows/baas_ocr.yaml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/baas_ocr.yaml b/.github/workflows/baas_ocr.yaml index d9053f0..3e44fe0 100644 --- a/.github/workflows/baas_ocr.yaml +++ b/.github/workflows/baas_ocr.yaml @@ -53,16 +53,6 @@ jobs: fetch-depth: 0 path: "baas_cpp" - - name: Install GCC 13 - run: | - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - sudo apt update - sudo apt install g++-13 -y - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100 - - - name: Check compiler version - run: g++ --version - - name: Clone Prebuild Repo if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/main' ) || github.event.inputs.create_release == 'true' }} id: checkout_prebuild @@ -80,6 +70,16 @@ jobs: sudo apt-get update sudo apt-get install build-essential + - name: Install GCC 13 + run: | + sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y + sudo apt-get update + sudo apt-get install g++-13 -y + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100 + + - name: Check GCC Version + run: g++ --version + - name: Build id: cmake_build run: | @@ -205,7 +205,7 @@ jobs: rm -r -f ./build/bin/output rm -r -f ./build/bin/config - - name: Upload artifacts + - name: Upload Artifacts if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/main' ) || github.event.inputs.create_release == 'true' }} uses: actions/upload-artifact@v4 with: @@ -303,7 +303,7 @@ jobs: Remove-Item -Path ".\build\bin\output" -Recurse -Force Remove-Item -Path ".\build\bin\config" -Recurse -Force - - name: Upload artifacts + - name: Upload Artifacts if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/main' ) || github.event.inputs.create_release == 'true' }} uses: actions/upload-artifact@v4 with: From 06ef725d323ef1ac7e2ba76245e58eb7b74e49b4 Mon Sep 17 00:00:00 2001 From: CircuitX Date: Fri, 27 Jun 2025 16:13:19 +0800 Subject: [PATCH 9/9] feat(ci): build baas_awfc as wasm with emsdk - build `baas_awfc` as `wasm` with `emsdk` - replace `windows-latest` with `ubuntu-latest` to solve env issues (cherry picked from commit e398af7902b69b464272883ca729692159d35195) --- .github/workflows/baas_afwc.yaml | 55 ++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/.github/workflows/baas_afwc.yaml b/.github/workflows/baas_afwc.yaml index b9a8f1e..d18cd0c 100644 --- a/.github/workflows/baas_afwc.yaml +++ b/.github/workflows/baas_afwc.yaml @@ -40,42 +40,57 @@ env: jobs: Windows-latest-cmake-x64: - name: 'Build Binary for Windows x64' - runs-on: windows-latest + name: 'Build Wasm' + runs-on: ubuntu-latest defaults: run: - working-directory: ./baas_cpp + working-directory: baas steps: - name: Clone Source Repo id: checkout_main uses: actions/checkout@v4 with: fetch-depth: 0 - path: "baas_cpp" + path: baas + + - name: Clone Emsdk Repo + id: clone_emsdk_repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + repository: "emscripten-core/emsdk" + ref: "main" + path: emsdk + + - name: Install Emsdk + id: install_emsdk + working-directory: emsdk + run: | + ./emsdk install latest - name: Install Build Dependencies id: install_build_depends run: | - choco install ninja - - - name: Setup MSVC Dev Cmd # Setup Developer Command Prompt for Microsotf Visual C++ - uses: TheMrMilchmann/setup-msvc-dev@v3 - with: - arch: x64 + sudo apt-get update + sudo apt-get install build-essential - name: Build id: cmake_build run: | - Write-Output "::group::Generate makefile" - cmake -S . -B build -DBUILD_BAAS_AW_CHECKER=${{env.BUILD_BAAS_AW_CHECKER}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -G Ninja # Hard encode command with env var before exec - Write-Output "::endgroup::" - Write-Output "::group::Build" - cmake --build build --config Release -j 4 # TODO: add number of threads - Write-Output "::endgroup::" - - - name: Upload artifacts + ../emsdk/emsdk activate latest + source ../emsdk/emsdk_env.sh + emcmake cmake -B build -DBUILD_BAAS_AW_CHECKER=$BUILD_BAAS_AW_CHECKER -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE="../emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" + cmake --build build --config Release --target BAAS_workflow_checker -j $(nproc) + + - name: Clean Up + id: clean_up + run: | + cd build/bin + ls | grep -v '\.js$' | grep -v '\.wasm$' | xargs rm -f -- + + - name: Upload Artifacts # if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/main' ) || github.event.inputs.create_release == 'true' }} uses: actions/upload-artifact@v4 with: - path: ./baas_cpp/build/bin - name: baas-afwc-bin-windows-x64 + path: baas/build/bin + name: baas-afwc-wasm