|
| 1 | +name: PR Tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + |
| 6 | +env: |
| 7 | + CARGO_TERM_COLOR: always |
| 8 | + |
| 9 | +jobs: |
| 10 | + rust-unit-tests: |
| 11 | + name: Rust Unit Tests |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - name: Checkout repository |
| 15 | + uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Set up Rust |
| 18 | + uses: dtolnay/rust-toolchain@stable |
| 19 | + |
| 20 | + - name: Run unit tests |
| 21 | + run: cargo test --workspace |
| 22 | + |
| 23 | + - name: Run doc tests |
| 24 | + run: cargo test --workspace --doc |
| 25 | + |
| 26 | + build: |
| 27 | + name: Build |
| 28 | + runs-on: ubuntu-latest |
| 29 | + steps: |
| 30 | + - name: Checkout repository |
| 31 | + uses: actions/checkout@v4 |
| 32 | + |
| 33 | + - name: Set up Rust |
| 34 | + uses: dtolnay/rust-toolchain@stable |
| 35 | + with: |
| 36 | + components: clippy |
| 37 | + |
| 38 | + - name: Build release |
| 39 | + run: cargo build --release --workspace |
| 40 | + |
| 41 | + - name: Clippy |
| 42 | + run: cargo clippy --workspace --all-targets -- -D warnings |
| 43 | + |
| 44 | + functional-tests: |
| 45 | + name: Functional Tests |
| 46 | + runs-on: ubuntu-latest |
| 47 | + needs: build |
| 48 | + steps: |
| 49 | + - name: Checkout repository |
| 50 | + uses: actions/checkout@v4 |
| 51 | + |
| 52 | + - name: Set up Python |
| 53 | + uses: actions/setup-python@v5 |
| 54 | + with: |
| 55 | + python-version: "3.11" |
| 56 | + |
| 57 | + - name: Install Python dependencies |
| 58 | + run: | |
| 59 | + pip install pytest pytest-timeout pytest-json-report requests psutil tenacity filelock "urllib3<2.0" requests-unixsocket aws-embedded-metrics |
| 60 | +
|
| 61 | + - name: Set up Rust |
| 62 | + uses: dtolnay/rust-toolchain@stable |
| 63 | + |
| 64 | + - name: Build Firecracker release |
| 65 | + run: cargo build --release |
| 66 | + |
| 67 | + - name: Check KVM availability |
| 68 | + id: check_kvm |
| 69 | + run: | |
| 70 | + if [ -c /dev/kvm ] && [ -r /dev/kvm ] && [ -w /dev/kvm ]; then |
| 71 | + echo "kvm_available=true" >> $GITHUB_OUTPUT |
| 72 | + else |
| 73 | + echo "kvm_available=false" >> $GITHUB_OUTPUT |
| 74 | + echo "⚠️ KVM not available - functional tests will skip" |
| 75 | + fi |
| 76 | +
|
| 77 | + - name: Run functional tests |
| 78 | + if: steps.check_kvm.outputs.kvm_available == 'true' |
| 79 | + run: | |
| 80 | + cd tests |
| 81 | + sudo env PATH="$PATH" PYTHONPATH=. pytest -m 'not nonci and not no_block_pr' integration_tests/functional/ |
| 82 | + continue-on-error: true |
| 83 | + |
| 84 | + - name: Collect functional tests (dry run) |
| 85 | + if: steps.check_kvm.outputs.kvm_available == 'false' |
| 86 | + run: | |
| 87 | + cd tests |
| 88 | + pytest --collect-only -m 'not nonci and not no_block_pr' integration_tests/functional/ |
0 commit comments