From a2a89573144999e92ef2e7cd2dd043567befd808 Mon Sep 17 00:00:00 2001 From: Prakriti Gupta Date: Fri, 17 Apr 2026 10:34:24 -0700 Subject: [PATCH 1/3] Update CMake workflow for instruments --- .github/workflows/cmake-workflow.yml | 140 +++++++++++++++++++++------ .github/workflows/install-deps.sh | 9 +- 2 files changed, 121 insertions(+), 28 deletions(-) diff --git a/.github/workflows/cmake-workflow.yml b/.github/workflows/cmake-workflow.yml index 9a6be648..72f1c2f8 100644 --- a/.github/workflows/cmake-workflow.yml +++ b/.github/workflows/cmake-workflow.yml @@ -2,35 +2,121 @@ name: CMake workflow on: push: - branches: [ "main" ] + branches: ["main", "camera-2.0"] pull_request: - branches: [ "main" ] + branches: ["main", "camera-2.0"] + workflow_dispatch: + inputs: + target: + description: "Optional build target or instrument name (leave blank for default build)" + required: false + default: "" + type: string + jobs: - Archon-build: + build: runs-on: ubuntu-latest + timeout-minutes: 30 + + env: + BUILD_TYPE: Release steps: - - uses: actions/checkout@v4 - - - name: Install dependencies - run: | - ls -l - .github/workflows/install-deps.sh - shell: bash - - - name: Configure CMake for Archon Interface - run: | - mkdir ${{github.workspace}}/build - cd ${{github.workspace}}/build - cmake .. - - - name: Build - run: | - cd ${{github.workspace}}/build - make - make run_unit_tests - - - name: Run Unit Tests - run: | - cd ${{github.workspace}} - bin/run_unit_tests + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Resolve requested target + shell: bash + run: | + TARGET_NAME="${{ github.event.inputs.target }}" + echo "TARGET_NAME=${TARGET_NAME}" >> "$GITHUB_ENV" + if [[ -z "$TARGET_NAME" ]]; then + echo "Default build requested" + else + echo "Requested target: $TARGET_NAME" + fi + + - name: Install dependencies + shell: bash + run: | + bash .github/workflows/install-deps.sh + + - name: Build and install zmqpp from source + shell: bash + run: | + git clone --depth 1 https://github.com/zeromq/zmqpp.git /tmp/zmqpp + cmake -S /tmp/zmqpp -B /tmp/zmqpp/build + cmake --build /tmp/zmqpp/build -j"$(nproc)" + sudo cmake --install /tmp/zmqpp/build + sudo ldconfig + + - name: Rewrite GitHub SSH URLs for submodules + shell: bash + run: | + git config --global url."https://github.com/".insteadOf "git@github.com:" + git submodule sync --recursive + + - name: Update matching submodule + if: env.TARGET_NAME != '' && env.TARGET_NAME != 'emulator' + shell: bash + run: | + if [[ ! -f .gitmodules ]]; then + echo "No .gitmodules file found; skipping submodule update." + exit 0 + fi + + MATCH_PATH=$(git config -f .gitmodules --get-regexp '^submodule\..*\.path$' | awk -v target="$TARGET_NAME" ' + $2 == target { print $2; exit } + $2 ~ "/" target "$" { print $2; exit } + ') + + if [[ -z "$MATCH_PATH" ]]; then + echo "No submodule path matched '$TARGET_NAME'; continuing without submodule update." + exit 0 + fi + + echo "Matched submodule path: $MATCH_PATH" + git submodule sync -- "$MATCH_PATH" + git submodule update --init --recursive --remote -- "$MATCH_PATH" + + - name: Configure CMake + shell: bash + run: | + mkdir -p build + cd build + + CMAKE_ARGS=( + -G Ninja + -DCMAKE_BUILD_TYPE=${BUILD_TYPE} + ) + + if [[ -n "$TARGET_NAME" && "$TARGET_NAME" != "emulator" ]]; then + CMAKE_ARGS+=("-DINSTR=${TARGET_NAME}") + fi + + cmake "${CMAKE_ARGS[@]}" .. + + - name: Build default + if: env.TARGET_NAME == '' + shell: bash + run: | + cmake --build build -j"$(nproc)" + if cmake --build build --target run_unit_tests -j"$(nproc)"; then + ./bin/run_unit_tests + else + echo "run_unit_tests target not available; skipping unit tests." + fi + + - name: Build emulator target + if: env.TARGET_NAME == 'emulator' + shell: bash + run: | + cmake --build build --target emulator -j"$(nproc)" + + - name: Build named target + if: env.TARGET_NAME != '' && env.TARGET_NAME != 'emulator' + shell: bash + run: | + cmake --build build -j"$(nproc)" diff --git a/.github/workflows/install-deps.sh b/.github/workflows/install-deps.sh index 07448368..1c5d6ad1 100755 --- a/.github/workflows/install-deps.sh +++ b/.github/workflows/install-deps.sh @@ -1,5 +1,12 @@ +set -euo pipefail + sudo apt-get update && sudo apt-get install libccfits-dev && sudo apt-get install libcfitsio-dev && sudo apt-get install libcurl4-openssl-dev && -sudo apt-get install libgtest-dev +sudo apt-get install libgtest-dev && +sudo build-essential && +sudo cmake && +sudo ninja-build && +sudo nlohmann-json3-dev && +sudo libzmq3-dev From e95336c2e5083c75dcd25077493ba2764a4d9638 Mon Sep 17 00:00:00 2001 From: Prakriti Gupta Date: Fri, 17 Apr 2026 10:41:22 -0700 Subject: [PATCH 2/3] Update install deps --- .github/workflows/install-deps.sh | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/workflows/install-deps.sh b/.github/workflows/install-deps.sh index 1c5d6ad1..d0b8f085 100755 --- a/.github/workflows/install-deps.sh +++ b/.github/workflows/install-deps.sh @@ -1,12 +1,21 @@ +#!/usr/bin/env bash set -euo pipefail -sudo apt-get update && -sudo apt-get install libccfits-dev && -sudo apt-get install libcfitsio-dev && -sudo apt-get install libcurl4-openssl-dev && -sudo apt-get install libgtest-dev && -sudo build-essential && -sudo cmake && -sudo ninja-build && -sudo nlohmann-json3-dev && -sudo libzmq3-dev +sudo apt-get update + +packages=( + build-essential + cmake + ninja-build + libccfits-dev + libcfitsio-dev + libcurl4-openssl-dev + libgtest-dev + nlohmann-json3-dev + libzmq3-dev + libopencv-dev + libboost-thread-dev + libboost-chrono-dev +) + +sudo apt-get install -y "${packages[@]}" \ No newline at end of file From 0955128b6c07c9530bb6dd5cda0f886529c26ba3 Mon Sep 17 00:00:00 2001 From: Prakriti Gupta Date: Fri, 17 Apr 2026 13:03:46 -0700 Subject: [PATCH 3/3] add controller --- .github/workflows/cmake-workflow.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake-workflow.yml b/.github/workflows/cmake-workflow.yml index 72f1c2f8..538c8136 100644 --- a/.github/workflows/cmake-workflow.yml +++ b/.github/workflows/cmake-workflow.yml @@ -90,10 +90,11 @@ jobs: CMAKE_ARGS=( -G Ninja -DCMAKE_BUILD_TYPE=${BUILD_TYPE} + -DCONTROLLER=archon ) if [[ -n "$TARGET_NAME" && "$TARGET_NAME" != "emulator" ]]; then - CMAKE_ARGS+=("-DINSTR=${TARGET_NAME}") + CMAKE_ARGS+=("-DINSTRUMENT=${TARGET_NAME}") fi cmake "${CMAKE_ARGS[@]}" ..