diff --git a/.github/workflows/baas_afwc.yaml b/.github/workflows/baas_afwc.yaml new file mode 100644 index 0000000..d18cd0c --- /dev/null +++ b/.github/workflows/baas_afwc.yaml @@ -0,0 +1,96 @@ +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 Wasm' + runs-on: ubuntu-latest + defaults: + run: + working-directory: baas + steps: + - name: Clone Source Repo + id: checkout_main + uses: actions/checkout@v4 + with: + fetch-depth: 0 + 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: | + sudo apt-get update + sudo apt-get install build-essential + + - name: Build + id: cmake_build + run: | + ../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/build/bin + name: baas-afwc-wasm diff --git a/.github/workflows/baas_app.yaml b/.github/workflows/baas_app.yaml new file mode 100644 index 0000000..91f3555 --- /dev/null +++ b/.github/workflows/baas_app.yaml @@ -0,0 +1,101 @@ +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 + 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: 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 -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 + 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 diff --git a/.github/workflows/build.yaml b/.github/workflows/baas_ocr.yaml similarity index 95% rename from .github/workflows/build.yaml rename to .github/workflows/baas_ocr.yaml index 07c00be..3e44fe0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/baas_ocr.yaml @@ -1,4 +1,4 @@ -name: CI +name: baas ocr ci/cd on: @@ -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: @@ -46,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 @@ -73,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: | @@ -198,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: @@ -296,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: 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(