From dea0d66324bf6d746692e6e366acbe28a12b1718 Mon Sep 17 00:00:00 2001 From: Ganesh Patil <7030871503ganeshpatil@gmail.com> Date: Mon, 9 Feb 2026 17:21:34 +0530 Subject: [PATCH 1/3] ci: add basic testing and linting GitHub Actions workflow --- .github/workflows/ci.yml | 60 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..e6614fb4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,60 @@ +name: CI + +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + cache: 'pip' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pytest ruff + + - name: Run linter (ruff) + run: | + ruff check . --select=E9,F63,F7,F82 --output-format=github \ + --exclude="Dockerfile.*" \ + --exclude="linktest/" \ + --exclude="measurements/" \ + --exclude="0mq/" \ + --exclude="ratc/" + # E9: Runtime errors (syntax errors, etc.) + # F63: Invalid print syntax + # F7: Syntax errors in type comments + # F82: Undefined names in __all__ + # Excludes: Dockerfiles (not Python), linktest (symlinks), + # measurements/0mq/ratc (config-dependent experimental scripts) + + - name: Run tests (pytest) + run: | + pytest --tb=short -q \ + --ignore=measurements/ \ + --ignore=0mq/ \ + --ignore=ratc/ \ + --ignore=linktest/ \ + || true + # Allow pytest to pass even if no tests are collected yet + # Remove "|| true" once proper tests are added + # Ignores: experimental/config-dependent scripts + + - name: Validate Dockerfile build + run: | + docker build -f Dockerfile.py -t concore-py-test . + # Validates that Dockerfile.py can be built successfully + # Does not push the image From d78da9de6e231fb612f4c44ac5dae830f508ae5f Mon Sep 17 00:00:00 2001 From: Ganesh Patil <7030871503ganeshpatil@gmail.com> Date: Mon, 9 Feb 2026 17:41:37 +0530 Subject: [PATCH 2/3] ci: address review feedback - optimize CI pipeline - Use minimal requirements-ci.txt (no tensorflow/heavy deps) - Handle pytest exit code 5 (no tests) vs real failures - Move Dockerfile build to separate job with path filter - Add pyzmq to CI deps (required by concore.py) --- .github/workflows/ci.yml | 40 ++++++++++++++++++++++++++++++++-------- requirements-ci.txt | 6 ++++++ 2 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 requirements-ci.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e6614fb4..6f140943 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: branches: [main, master] jobs: - test: + lint-and-test: runs-on: ubuntu-latest steps: @@ -23,8 +23,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt - pip install pytest ruff + pip install -r requirements-ci.txt + # Uses minimal CI requirements (no tensorflow/heavy packages) - name: Run linter (ruff) run: | @@ -47,13 +47,37 @@ jobs: --ignore=measurements/ \ --ignore=0mq/ \ --ignore=ratc/ \ - --ignore=linktest/ \ - || true - # Allow pytest to pass even if no tests are collected yet - # Remove "|| true" once proper tests are added - # Ignores: experimental/config-dependent scripts + --ignore=linktest/ + status=$? + # Allow success if no tests are collected (pytest exit code 5) + if [ "$status" -ne 0 ] && [ "$status" -ne 5 ]; then + exit "$status" + fi + # Fails on real test failures, passes on no tests collected + + docker-build: + runs-on: ubuntu-latest + # Only run when Dockerfile.py or related files change + if: | + github.event_name == 'push' || + (github.event_name == 'pull_request' && + contains(github.event.pull_request.changed_files, 'Dockerfile')) + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Check if Dockerfile.py changed + uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + dockerfile: + - 'Dockerfile.py' + - 'requirements.txt' - name: Validate Dockerfile build + if: steps.filter.outputs.dockerfile == 'true' run: | docker build -f Dockerfile.py -t concore-py-test . # Validates that Dockerfile.py can be built successfully diff --git a/requirements-ci.txt b/requirements-ci.txt new file mode 100644 index 00000000..1dc06cfb --- /dev/null +++ b/requirements-ci.txt @@ -0,0 +1,6 @@ +# Minimal dependencies for CI (linting and testing) +# Does not include heavyweight packages like tensorflow +pytest +ruff +pyzmq +numpy From 3c0201aac2b1456fa79159056b7287692dbb772e Mon Sep 17 00:00:00 2001 From: Ganesh Patil <7030871503ganeshpatil@gmail.com> Date: Tue, 10 Feb 2026 00:07:46 +0530 Subject: [PATCH 3/3] ci: fix pytest exit code handling, add dev branch trigger - Add set +e before pytest to prevent bash -e from exiting on code 5 - Add dev branch to push/pull_request triggers per maintainer request --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f140943..1100ba9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,9 @@ name: CI on: push: - branches: [main, master] + branches: [main, master, dev] pull_request: - branches: [main, master] + branches: [main, master, dev] jobs: lint-and-test: @@ -43,12 +43,14 @@ jobs: - name: Run tests (pytest) run: | + set +e pytest --tb=short -q \ --ignore=measurements/ \ --ignore=0mq/ \ --ignore=ratc/ \ --ignore=linktest/ status=$? + set -e # Allow success if no tests are collected (pytest exit code 5) if [ "$status" -ne 0 ] && [ "$status" -ne 5 ]; then exit "$status"