Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions AgCloud/.github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @KamaTechOrg @SaraShimon @hadasaGIT @tamarmar @ExtraTech-helper
68 changes: 68 additions & 0 deletions AgCloud/.github/workflows/ci.yml.save
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI - Tests (unit + integration)

on:
push:
branches: ["**"]
pull_request:

jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: mqtt_images

env:

S3_ENDPOINT: http://localhost:9000
AWS_ACCESS_KEY_ID: minioadmin
AWS_SECRET_ACCESS_KEY: minioadmin
AWS_REGION: us-east-1
MQTT_HOST: localhost
MQTT_PORT: 1883

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install Python deps
run: |
python -m pip install --upgrade pip

if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi

if [ -f requirements.txt ]; then pip install -r requirements.txt || true; fi


- name: Docker Compose up (MinIO, Mosquitto, etc.)
run: |
docker compose -f docker-compose.yml up -d --build
echo ">> Wait for MinIO to be ready..."
for i in {1..60}; do
curl -fsS http://localhost:9000/minio/health/ready && break
sleep 2
done
echo ">> Compose services:"
docker compose -f docker-compose.yml ps

- name: Run tests (pytest)
run: |
pytest -q

# Show docker compose logs on failure – very useful for debugging
- name: Show docker compose logs on failure
if: failure()
run: docker compose -f docker-compose.yml logs --no-color
83 changes: 83 additions & 0 deletions AgCloud/.github/workflows/daily_pytest_slack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Daily Pytest + Slack (IL 01:00)

on:
schedule:
# 01:00 Israel time — 22:00 UTC (summer), 23:00 UTC (winter)
- cron: "0 22 * * *"
- cron: "0 23 * * *"
workflow_dispatch:

jobs:
run_pytests_and_notify:
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.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

- name: Run pytest (and keep log)
run: |
pytest -q --maxfail=50 --disable-warnings -rA \
--junitxml=pytest-report.xml > pytest.log 2>&1 || true

- name: Parse results
id: results
run: |
python - <<'PY'
import xml.etree.ElementTree as ET
import os
counts = dict(tests=0, failures=0, errors=0, skipped=0)
try:
tree = ET.parse("pytest-report.xml")
root = tree.getroot()
for suite in root.findall(".//testsuite"):
counts["tests"] += int(suite.attrib.get("tests", 0))
counts["failures"] += int(suite.attrib.get("failures", 0))
counts["errors"] += int(suite.attrib.get("errors", 0))
counts["skipped"] += int(suite.attrib.get("skipped", 0))
except Exception as e:
print("Parse error:", e)
counts["passed"] = counts["tests"] - counts["failures"] - counts["errors"] - counts["skipped"]
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
for k,v in counts.items():
f.write(f"{k}={v}\n")
f.write(f"has_failures={'true' if (counts['failures']>0 or counts['errors']>0) else 'false'}\n")
PY

- name: Send Slack notification (if failures)
if: steps.results.outputs.has_failures == 'true'
uses: slackapi/slack-github-action@v1.25.0
with:
payload: |
{
"channel": "#vast",
"username": "GitHub Actions",
"icon_emoji": ":rotating_light:",
"text": "🚨 *Pytest Failures Detected!*\n\nRepository: ${{ github.repository }}\nRun: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>\n\n*Passed:* ${{ steps.results.outputs.passed }} / ${{ steps.results.outputs.tests }}\n*Failed:* ${{ steps.results.outputs.failures }}\n*Errors:* ${{ steps.results.outputs.errors }}\n*Skipped:* ${{ steps.results.outputs.skipped }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

- name: Send Slack success notification
if: steps.results.outputs.has_failures == 'false'
uses: slackapi/slack-github-action@v1.25.0
with:
payload: |
{
"channel": "#vast",
"username": "GitHub Actions",
"icon_emoji": ":white_check_mark:",
"text": "✅ All tests passed successfully!\n\nRepository: ${{ github.repository }}\nRun: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>\n\nTotal tests: ${{ steps.results.outputs.tests }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
Loading