forked from mtusi2026/mtusi2026lab7
База lab7: контракт 1.7.0 и реализация lab1–lab6
Перенесены cmd/internal/config, compose.yaml, Dockerfile, скрипты, student-tests и evidence из mtusi-messenger (master, lab6). Skeleton lab7 (openapi/infrastructure 1.7.0, trust-matrix.md, security/THREAT_MODEL.md, infra/openbao, tests/security.py) сохранён; make test-security добавлен в Makefile.
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
name: Application
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
GO_VERSION: "1.27.0"
|
||||
GOLANGCI_LINT_VERSION: v2.13.2
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
cache: true
|
||||
- run: make lint
|
||||
|
||||
unit-test:
|
||||
name: Unit tests
|
||||
needs: lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
cache: true
|
||||
- run: make unit-test
|
||||
|
||||
build:
|
||||
name: Docker build
|
||||
needs: unit-test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
- uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
tags: mtusi-messenger:ci
|
||||
|
||||
stand:
|
||||
name: Lab6 stand scenario (lab5 base)
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: cp .env.example .env && sed -i 's/^TELEMETRY_ENABLED=.*/TELEMETRY_ENABLED=0/' .env
|
||||
- run: ./scripts/init-secrets.sh
|
||||
- run: docker compose --env-file .env config --quiet
|
||||
- run: docker compose --env-file .env up -d --build
|
||||
- name: Wait for readiness through the load balancer
|
||||
run: |
|
||||
for attempt in $(seq 1 60); do
|
||||
if curl -fsS -o /dev/null http://localhost:8080/health/ready; then exit 0; fi
|
||||
sleep 2
|
||||
done
|
||||
docker compose --env-file .env ps
|
||||
exit 1
|
||||
- name: Public smoke through the LB
|
||||
run: make test
|
||||
- name: Attachment negative scenarios
|
||||
run: make test-attachments
|
||||
- name: Presigned direct upload (async complete)
|
||||
run: make test-presign
|
||||
- name: Worker process is separate and healthy
|
||||
run: docker compose --env-file .env ps worker relay broker
|
||||
- name: Async worker and broker durability
|
||||
run: make test-queue
|
||||
- name: Track 2 duplicate and stale-version harness
|
||||
run: python3 scripts/lab5_track2.py --reps 1
|
||||
- name: Parallel idempotency through the LB
|
||||
run: python3 student-tests/idempotency_parallel.py --base-url http://localhost:8080
|
||||
- name: LB removes a not-ready replica
|
||||
run: make test-lb-readiness
|
||||
- name: Upload, stop the serving replica, download through another
|
||||
run: python3 student-tests/attachment_failover.py --base-url http://localhost:8080
|
||||
- name: Stop one API replica and keep writing
|
||||
run: make test-failover ACTION_SCRIPT=scripts/stop-one.sh
|
||||
- name: Logs on failure
|
||||
if: failure()
|
||||
run: docker compose --env-file .env logs --tail 100 api worker relay
|
||||
- if: always()
|
||||
run: docker compose --env-file .env down -v
|
||||
|
||||
observability:
|
||||
name: Lab6 observability stand
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 25
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: cp .env.example .env
|
||||
- run: ./scripts/init-secrets.sh
|
||||
- run: docker compose --env-file .env --profile telemetry config --quiet
|
||||
- run: docker compose --env-file .env --profile telemetry up -d --build
|
||||
- name: Validate Prometheus configuration and rules
|
||||
run: |
|
||||
docker compose --env-file .env --profile telemetry exec -T prometheus promtool check config /etc/prometheus/prometheus.yml
|
||||
docker compose --env-file .env --profile telemetry exec -T prometheus sh -c 'promtool check rules /etc/prometheus/rules/*.yml'
|
||||
- name: Wait for readiness through the LB
|
||||
run: |
|
||||
for attempt in $(seq 1 60); do
|
||||
if curl -fsS -o /dev/null http://localhost:8080/health/ready; then exit 0; fi
|
||||
sleep 2
|
||||
done
|
||||
docker compose --env-file .env ps
|
||||
exit 1
|
||||
- name: Public smoke with telemetry enabled
|
||||
run: make test
|
||||
- name: Observability and privacy checks
|
||||
run: make test-observability
|
||||
- name: Logs on failure
|
||||
if: failure()
|
||||
run: docker compose --env-file .env --profile telemetry logs --tail 120 api worker relay otel-collector prometheus loki tempo grafana
|
||||
- if: always()
|
||||
run: docker compose --env-file .env --profile telemetry down -v
|
||||
Reference in New Issue
Block a user