Files
mtusi2026lab2/.github/workflows/app.yml
T

54 lines
1.7 KiB
YAML

name: Application
on: [push, pull_request]
permissions:
contents: read
defaults:
run:
# Explicit bash turns on `-eo pipefail`, so a failing check behind `| tee` fails the job.
shell: bash
env:
BASE_URL: http://localhost:8080
CONTAINER: mtusi-messenger-lab2
jobs:
unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.27.1'
- run: go vet ./...
- run: go test -race -count=1 ./...
e2e:
runs-on: ubuntu-latest
needs: unit
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.27.1'
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: docker build -t mtusi-messenger:lab2 .
- run: docker run -d --name "$CONTAINER" -p 127.0.0.1:8080:8080 --env-file .env.example mtusi-messenger:lab2
- run: sh student-tests/wait-ready.sh
- run: mkdir -p evidence-ci
- name: Public smoke
run: make test PYTHON=python BASE_URL="$BASE_URL" | tee evidence-ci/smoke.txt
- name: Concurrency check
run: go run ./tools/concurrency --base-url "$BASE_URL" --output evidence-ci/concurrency.json
- name: SIGTERM and restart
run: sh student-tests/lifecycle.sh | tee evidence-ci/lifecycle.txt
- name: Container logs
if: always()
run: docker logs "$CONTAINER" > evidence-ci/container.log 2>&1 || true
- name: Cleanup
if: always()
run: docker rm -f "$CONTAINER" || true
- uses: actions/upload-artifact@v4
if: always()
with:
name: evidence
path: evidence-ci