|
| 1 | +name: "🧪 Tests" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +jobs: |
| 8 | + unit: |
| 9 | + name: "🧪 Unit | Py${{ matrix.python-version }} on ${{ matrix.os }}" |
| 10 | + runs-on: ${{ matrix.os }} |
| 11 | + strategy: |
| 12 | + fail-fast: false |
| 13 | + matrix: |
| 14 | + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] |
| 15 | + os: [ubuntu-22.04, windows-latest] |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: "📥 Checkout" |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: "🐍 Set up Python" |
| 22 | + uses: actions/setup-python@v5 |
| 23 | + with: |
| 24 | + python-version: ${{ matrix.python-version }} |
| 25 | + |
| 26 | + - name: "📦 Install unit test dependencies" |
| 27 | + run: python -m pip install --upgrade pip pytest httpx requests pyyaml |
| 28 | + |
| 29 | + - name: "🧪 Run unit tests" |
| 30 | + run: pytest -q tests/test_mellophone.py |
| 31 | + |
| 32 | + integration: |
| 33 | + name: "🐳 Integration | Py3.13 on ubuntu-22.04" |
| 34 | + runs-on: ubuntu-22.04 |
| 35 | + |
| 36 | + steps: |
| 37 | + - name: "📥 Checkout" |
| 38 | + uses: actions/checkout@v4 |
| 39 | + |
| 40 | + - name: "🐍 Set up Python" |
| 41 | + uses: actions/setup-python@v5 |
| 42 | + with: |
| 43 | + python-version: '3.13' |
| 44 | + |
| 45 | + - name: "📦 Install integration test dependencies" |
| 46 | + run: python -m pip install --upgrade pip pytest httpx requests pyyaml |
| 47 | + |
| 48 | + - name: "🐳 Start DB and Mellophone" |
| 49 | + run: docker compose up -d db mellophone |
| 50 | + |
| 51 | + - name: "⏳ Wait for Mellophone" |
| 52 | + shell: bash |
| 53 | + run: | |
| 54 | + for i in {1..20}; do |
| 55 | + if curl -fsS "http://localhost:8082/mellophone/authentication.gif?sesid=ci-smoke" >/dev/null; then |
| 56 | + echo "Mellophone is reachable" |
| 57 | + exit 0 |
| 58 | + fi |
| 59 | + sleep 2 |
| 60 | + done |
| 61 | + docker compose logs |
| 62 | + exit 1 |
| 63 | +
|
| 64 | + - name: "🧪 Run integration tests" |
| 65 | + run: pytest -q tests/test_integration_mellophone.py |
| 66 | + |
| 67 | + - name: "🧹 Stop services" |
| 68 | + if: always() |
| 69 | + run: docker compose down -v |
0 commit comments