From 382dba47492c855c6588b8321a5dc59ee479131e Mon Sep 17 00:00:00 2001 From: Ivan Khropachov Date: Fri, 7 Nov 2025 14:41:50 +0200 Subject: [PATCH 1/5] debug release workflow --- .github/workflows/{build.yml => release.yml} | 68 ++++++- .github/workflows/test.yml | 179 ------------------- 2 files changed, 64 insertions(+), 183 deletions(-) rename .github/workflows/{build.yml => release.yml} (80%) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/release.yml similarity index 80% rename from .github/workflows/build.yml rename to .github/workflows/release.yml index 80ab4893a8c..a60471cbe61 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: OSQuery Build and Push Latest +name: OSQuery Release permissions: contents: write @@ -10,14 +10,14 @@ permissions: on: push: - branches: [master] + branches: [master, feature/release] paths-ignore: - "**/*.md" - '.github/**' workflow_dispatch: inputs: - tag: - description: "Tag to release (e.g., v1.2.3)" + version: + description: "Version to Release (e.g., v1.2.3)" required: true type: string @@ -262,3 +262,63 @@ jobs: if-no-files-found: warn retention-days: 30 compression-level: 9 + + + release: + name: "Create Release" + needs: [build_macos, create_universal_macos, build_windows] + runs-on: ubuntu-latest + if: | + github.event_name == 'push' + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: release-artifacts + continue-on-error: true + + - name: Prepare release artifacts + run: | + set -e + ls -lR release-artifacts + mkdir -p final-artifacts/clients + + # macOS + if [ -d "release-artifacts/fleet-mac-universal" ]; then + tar -czf "final-artifacts/clients/fleet-macos-universal.tar.gz" \ + -C "release-artifacts/fleet-mac-universal" fleet + fi + # Windows + if [ -d "release-artifacts/fleet-windows-amd64" ]; then + (cd "release-artifacts/fleet-windows-amd64" && \ + zip "${GITHUB_WORKSPACE}/final-artifacts/clients/fleet-windows-amd64.zip" fleet.exe) + fi + + ls -lh final-artifacts/clients/ + + - name: Generate release header + run: | + cat > RELEASE_HEADER.md </dev/null 2>&1; then - echo "Installing Xcode Command Line Tools..." - xcode-select --install - # Wait for installation to complete - while ! xcode-select -p >/dev/null 2>&1; do - echo "Waiting for Xcode Command Line Tools installation..." - sleep 10 - done - fi - - - name: Cache Homebrew - uses: actions/cache@v4 - with: - path: | - ~/Library/Caches/Homebrew - /usr/local/Homebrew - /opt/homebrew - key: ${{ runner.os }}-${{ runner.arch }}-homebrew-${{ hashFiles('.github/workflows/*.yml') }} - restore-keys: | - ${{ runner.os }}-${{ runner.arch }}-homebrew- - - - name: Install macOS Dependencies - run: brew install ccache git git-lfs cmake python clang-format flex bison cppcheck - shell: bash - - - name: Cache CMake Build for faster rebuilds - uses: actions/cache@v4 - with: - path: | - build/ - ~/.ccache - key: ${{ runner.os }}-${{ matrix.os_arch }}-cmake-${{ hashFiles('CMakeLists.txt', '**/CMakeLists.txt') }}-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-${{ matrix.os_arch }}-cmake-${{ hashFiles('CMakeLists.txt', '**/CMakeLists.txt') }} - ${{ runner.os }}-${{ matrix.os_arch }}-cmake- - - - name: Setup Build Environment - run: | - echo "Setting up build environment for ${{ matrix.os_arch }}..." - export SDKROOT=$(xcrun --show-sdk-path) - export CFLAGS="-isysroot $SDKROOT" - export CXXFLAGS="-isysroot $SDKROOT" - - echo "SDKROOT=$SDKROOT" >> $GITHUB_ENV - echo "CFLAGS=-isysroot $SDKROOT" >> $GITHUB_ENV - echo "CXXFLAGS=-isysroot $SDKROOT" >> $GITHUB_ENV - - - name: Configure CMake - run: | - echo "Creating build directory and configuring..." - mkdir -p build && cd build - - cmake \ - -DCMAKE_OSX_DEPLOYMENT_TARGET=${{ env.CMAKE_OSX_DEPLOYMENT_TARGET }} \ - -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} \ - -DCMAKE_C_COMPILER=clang \ - -DCMAKE_CXX_COMPILER=clang++ \ - -DCMAKE_OSX_SYSROOT=$SDKROOT \ - -DCMAKE_OSX_ARCHITECTURES=${{ matrix.cmake_arch }} \ - -DOSQUERY_VERSION="5.9.1" \ - .. - - echo "CMake configuration completed" - - - name: Build Project - run: | - echo "Starting build for ${{ matrix.os_arch }}..." - cd build - - CPU_COUNT=$(sysctl -n hw.ncpu) - echo "Building with $CPU_COUNT parallel jobs" - time cmake --build . -j $CPU_COUNT - - echo "Build completed successfully" - - build_windows: - name: "Build C Client for (${{ matrix.os }} ${{ matrix.os_arch }})" - runs-on: ${{ matrix.os }} - if: github.event_name == 'pull_request' && !github.event.pull_request.draft - defaults: - run: - shell: cmd - strategy: - fail-fast: false - matrix: - include: - - name: "Windows x64" - os: windows-latest - os_arch: x64 - artifact_name: osquery-windows-x64 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Setup MSBuild - uses: microsoft/setup-msbuild@v2 - - - name: Setup Visual Studio Build Tools - uses: ilammy/msvc-dev-cmd@v1 - with: - arch: ${{ matrix.os_arch }} - - - name: Configure CMake for ${{ matrix.os }} - run: | - mkdir build - cd build - cmake -G "Visual Studio 17 2022" -A ${{ matrix.os_arch }} -DOSQUERY_VERSION="5.9.1" .. - - - name: Build OSQuery for Windows ${{ matrix.os_arch }} with MSBuild - run: | - cd build - cmake --build . --config RelWithDebInfo -j10 From 65281f1dd234d1be170867f019b7cca705d42157 Mon Sep 17 00:00:00 2001 From: Ivan Khropachov Date: Fri, 7 Nov 2025 14:44:32 +0200 Subject: [PATCH 2/5] debug release workflow --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a60471cbe61..cc96fc57896 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -321,4 +321,5 @@ jobs: # github.event_name == 'workflow_dispatch' && - # inputs.version != '' \ No newline at end of file + # inputs.version != '' + From 2823e1d2f7eac9bfc82d39b0e5ebce4c53e4dcd0 Mon Sep 17 00:00:00 2001 From: Ivan Khropachov Date: Fri, 7 Nov 2025 14:50:34 +0200 Subject: [PATCH 3/5] debug release workflow --- .github/workflows/release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cc96fc57896..9656ac08f27 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,7 +38,8 @@ jobs: name: "Build C Client for (${{ matrix.os }} ${{ matrix.os_arch }})" runs-on: ${{ matrix.os }} if: | - github.event_name == 'push' || github.event_name == 'workflow_dispatch' + github.event_name == 'push' || + github.event_name == 'workflow_dispatch' defaults: run: shell: bash @@ -215,7 +216,8 @@ jobs: name: "Build C Client for (${{ matrix.os }} ${{ matrix.os_arch }})" runs-on: ${{ matrix.os }} if: | - github.event_name == 'push' || github.event_name == 'workflow_dispatch' + github.event_name == 'push' || + github.event_name == 'workflow_dispatch' defaults: run: shell: cmd From fda463608199bade4063aa5d527a6b0f8a9d69d8 Mon Sep 17 00:00:00 2001 From: Ivan Khropachov Date: Fri, 7 Nov 2025 14:52:19 +0200 Subject: [PATCH 4/5] debug release workflow --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9656ac08f27..8edcab0a7c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,6 @@ on: branches: [master, feature/release] paths-ignore: - "**/*.md" - - '.github/**' workflow_dispatch: inputs: version: From 7550759bc61913f926ad3535e006dca7c313a086 Mon Sep 17 00:00:00 2001 From: Ivan Khropachov Date: Fri, 7 Nov 2025 16:03:19 +0200 Subject: [PATCH 5/5] debug release workflow --- .github/workflows/release.yml | 39 ++++---- .github/workflows/test.yml | 179 ++++++++++++++++++++++++++++++++++ 2 files changed, 197 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8edcab0a7c3..e1768360fbd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ permissions: on: push: - branches: [master, feature/release] + branches: [master] paths-ignore: - "**/*.md" workflow_dispatch: @@ -151,6 +151,7 @@ jobs: retention-days: 30 compression-level: 9 + create_universal_macos: name: "Create Universal macOS Binary" needs: [build_macos] @@ -206,11 +207,12 @@ jobs: - name: Upload Universal Binary uses: actions/upload-artifact@v4 with: - name: osquery-macos-universal + name: osquery-mac-universal path: artifacts/ retention-days: 30 compression-level: 9 + build_windows: name: "Build C Client for (${{ matrix.os }} ${{ matrix.os_arch }})" runs-on: ${{ matrix.os }} @@ -227,7 +229,7 @@ jobs: - name: "Windows x64" os: windows-latest os_arch: x64 - artifact_name: osquery-windows-x64 + artifact_name: osquery-windows-amd64 steps: - name: Checkout @@ -270,7 +272,8 @@ jobs: needs: [build_macos, create_universal_macos, build_windows] runs-on: ubuntu-latest if: | - github.event_name == 'push' + github.event_name == 'workflow_dispatch' && + inputs.version != '' steps: - name: Checkout uses: actions/checkout@v4 @@ -284,18 +287,17 @@ jobs: - name: Prepare release artifacts run: | set -e - ls -lR release-artifacts mkdir -p final-artifacts/clients # macOS - if [ -d "release-artifacts/fleet-mac-universal" ]; then - tar -czf "final-artifacts/clients/fleet-macos-universal.tar.gz" \ - -C "release-artifacts/fleet-mac-universal" fleet + if [ -d "release-artifacts/osquery-mac-universal" ]; then + tar -czf "final-artifacts/clients/osquery-macos-universal.tar.gz" \ + -C "release-artifacts/osquery-mac-universal" ${{ env.BINARY_NAME }} fi # Windows - if [ -d "release-artifacts/fleet-windows-amd64" ]; then - (cd "release-artifacts/fleet-windows-amd64" && \ - zip "${GITHUB_WORKSPACE}/final-artifacts/clients/fleet-windows-amd64.zip" fleet.exe) + if [ -d "release-artifacts/osquery-windows-amd64" ]; then + (cd "release-artifacts/osquery-windows-amd64" && \ + zip "${GITHUB_WORKSPACE}/final-artifacts/clients/osquery-windows-amd64.zip" ${{ env.BINARY_NAME }}.exe) fi ls -lh final-artifacts/clients/ @@ -303,24 +305,19 @@ jobs: - name: Generate release header run: | cat > RELEASE_HEADER.md </dev/null 2>&1; then + echo "Installing Xcode Command Line Tools..." + xcode-select --install + # Wait for installation to complete + while ! xcode-select -p >/dev/null 2>&1; do + echo "Waiting for Xcode Command Line Tools installation..." + sleep 10 + done + fi + + - name: Cache Homebrew + uses: actions/cache@v4 + with: + path: | + ~/Library/Caches/Homebrew + /usr/local/Homebrew + /opt/homebrew + key: ${{ runner.os }}-${{ runner.arch }}-homebrew-${{ hashFiles('.github/workflows/*.yml') }} + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-homebrew- + + - name: Install macOS Dependencies + run: brew install ccache git git-lfs cmake python clang-format flex bison cppcheck + shell: bash + + - name: Cache CMake Build for faster rebuilds + uses: actions/cache@v4 + with: + path: | + build/ + ~/.ccache + key: ${{ runner.os }}-${{ matrix.os_arch }}-cmake-${{ hashFiles('CMakeLists.txt', '**/CMakeLists.txt') }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-${{ matrix.os_arch }}-cmake-${{ hashFiles('CMakeLists.txt', '**/CMakeLists.txt') }} + ${{ runner.os }}-${{ matrix.os_arch }}-cmake- + + - name: Setup Build Environment + run: | + echo "Setting up build environment for ${{ matrix.os_arch }}..." + export SDKROOT=$(xcrun --show-sdk-path) + export CFLAGS="-isysroot $SDKROOT" + export CXXFLAGS="-isysroot $SDKROOT" + + echo "SDKROOT=$SDKROOT" >> $GITHUB_ENV + echo "CFLAGS=-isysroot $SDKROOT" >> $GITHUB_ENV + echo "CXXFLAGS=-isysroot $SDKROOT" >> $GITHUB_ENV + + - name: Configure CMake + run: | + echo "Creating build directory and configuring..." + mkdir -p build && cd build + + cmake \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=${{ env.CMAKE_OSX_DEPLOYMENT_TARGET }} \ + -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} \ + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=clang++ \ + -DCMAKE_OSX_SYSROOT=$SDKROOT \ + -DCMAKE_OSX_ARCHITECTURES=${{ matrix.cmake_arch }} \ + -DOSQUERY_VERSION="5.9.1" \ + .. + + echo "CMake configuration completed" + + - name: Build Project + run: | + echo "Starting build for ${{ matrix.os_arch }}..." + cd build + + CPU_COUNT=$(sysctl -n hw.ncpu) + echo "Building with $CPU_COUNT parallel jobs" + time cmake --build . -j $CPU_COUNT + + echo "Build completed successfully" + + build_windows: + name: "Build C Client for (${{ matrix.os }} ${{ matrix.os_arch }})" + runs-on: ${{ matrix.os }} + if: github.event_name == 'pull_request' && !github.event.pull_request.draft + defaults: + run: + shell: cmd + strategy: + fail-fast: false + matrix: + include: + - name: "Windows x64" + os: windows-latest + os_arch: x64 + artifact_name: osquery-windows-x64 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 + + - name: Setup Visual Studio Build Tools + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.os_arch }} + + - name: Configure CMake for ${{ matrix.os }} + run: | + mkdir build + cd build + cmake -G "Visual Studio 17 2022" -A ${{ matrix.os_arch }} -DOSQUERY_VERSION="5.9.1" .. + + - name: Build OSQuery for Windows ${{ matrix.os_arch }} with MSBuild + run: | + cd build + cmake --build . --config RelWithDebInfo -j10