|
| 1 | +name: VM Integration Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, develop, v2-refactor ] |
| 6 | + pull_request: |
| 7 | + branches: [ main, develop ] |
| 8 | + workflow_dispatch: # Manual trigger |
| 9 | + schedule: |
| 10 | + - cron: '0 2 * * 0' # Weekly on Sunday at 2 AM |
| 11 | + |
| 12 | +jobs: |
| 13 | + # Fast Docker tests run first (gate for VM tests) |
| 14 | + docker-tests: |
| 15 | + name: Docker Tests (Quick Gate) |
| 16 | + runs-on: ubuntu-22.04 |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Run Docker Tests |
| 21 | + run: ./tests/docker/run-docker-tests.sh |
| 22 | + |
| 23 | + # Full VM tests with multiple OS versions (run in parallel) |
| 24 | + vm-tests: |
| 25 | + name: VM Tests - ${{ matrix.os }} |
| 26 | + needs: docker-tests # Only run if Docker tests pass |
| 27 | + runs-on: ubuntu-latest |
| 28 | + strategy: |
| 29 | + fail-fast: false # Continue testing other OSes even if one fails |
| 30 | + matrix: |
| 31 | + os: |
| 32 | + - ubuntu-22.04 |
| 33 | + - ubuntu-24.04 |
| 34 | + - debian-11 |
| 35 | + - debian-12 |
| 36 | + |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v4 |
| 39 | + |
| 40 | + - name: Set up QEMU |
| 41 | + uses: docker/setup-qemu-action@v3 |
| 42 | + |
| 43 | + - name: Install VM dependencies |
| 44 | + run: | |
| 45 | + sudo apt-get update |
| 46 | + sudo apt-get install -y qemu-system-x86 qemu-utils cloud-image-utils |
| 47 | + |
| 48 | + - name: Cache VM images |
| 49 | + uses: actions/cache@v3 |
| 50 | + with: |
| 51 | + path: ~/.cache/vm-images |
| 52 | + key: vm-images-${{ matrix.os }}-${{ hashFiles('tests/vm/Vagrantfile') }} |
| 53 | + |
| 54 | + - name: Download cloud image |
| 55 | + run: | |
| 56 | + mkdir -p ~/.cache/vm-images |
| 57 | + ./tests/vm/download-image.sh ${{ matrix.os }} |
| 58 | + |
| 59 | + - name: Run VM tests |
| 60 | + timeout-minutes: 15 |
| 61 | + run: | |
| 62 | + ./tests/vm/run-vm-tests.sh ${{ matrix.os }} |
| 63 | + |
| 64 | + - name: Upload test results |
| 65 | + if: always() |
| 66 | + uses: actions/upload-artifact@v3 |
| 67 | + with: |
| 68 | + name: vm-test-results-${{ matrix.os }} |
| 69 | + path: tests/vm/results/ |
| 70 | + |
| 71 | + - name: Cleanup |
| 72 | + if: always() |
| 73 | + run: ./tests/vm/cleanup.sh |
| 74 | + |
| 75 | + # Summary job |
| 76 | + test-summary: |
| 77 | + name: Test Summary |
| 78 | + needs: [docker-tests, vm-tests] |
| 79 | + if: always() |
| 80 | + runs-on: ubuntu-latest |
| 81 | + steps: |
| 82 | + - name: Check test results |
| 83 | + run: | |
| 84 | + echo "Docker Tests: ${{ needs.docker-tests.result }}" |
| 85 | + echo "VM Tests: ${{ needs.vm-tests.result }}" |
| 86 | + |
| 87 | + if [ "${{ needs.docker-tests.result }}" != "success" ]; then |
| 88 | + echo "❌ Docker tests failed" |
| 89 | + exit 1 |
| 90 | + fi |
| 91 | + |
| 92 | + if [ "${{ needs.vm-tests.result }}" != "success" ]; then |
| 93 | + echo "⚠️ Some VM tests failed (check matrix)" |
| 94 | + exit 1 |
| 95 | + fi |
| 96 | + |
| 97 | + echo "✅ All tests passed!" |
0 commit comments