xref: /cloud-hypervisor/.github/workflows/build.yaml (revision 7d7bfb2034001d4cb15df2ddc56d2d350c8da30f)
1name: Cloud Hypervisor Build
2on: [pull_request, create]
3
4jobs:
5  build:
6    if: github.event_name == 'pull_request'
7    name: Build
8    runs-on: ubuntu-latest
9    strategy:
10      fail-fast: false
11      matrix:
12        rust:
13          - stable
14          - beta
15          - nightly
16          - 1.56
17        target:
18          - x86_64-unknown-linux-gnu
19          - x86_64-unknown-linux-musl
20    steps:
21      - name: Code checkout
22        uses: actions/checkout@v2
23        with:
24          fetch-depth: 0
25
26      - name: Install musl-gcc
27        run: sudo apt install -y musl-tools
28
29      - name: Install Rust toolchain (${{ matrix.rust }})
30        uses: actions-rs/toolchain@v1
31        with:
32            toolchain: ${{ matrix.rust }}
33            target: ${{ matrix.target }}
34            override: true
35
36      - name: Debug Check (default features)
37        run: |
38          git rev-list origin/main..$GITHUB_SHA | xargs -t -I % sh -c 'git checkout %; cargo check --all --target=${{ matrix.target }}'
39          git checkout $GITHUB_SHA
40
41      - name: Build (default features)
42        run: cargo rustc --bin cloud-hypervisor -- -D warnings
43
44      - name: Build (common + kvm)
45        run: cargo rustc --bin cloud-hypervisor --no-default-features --features "common,kvm"  -- -D warnings
46
47      - name: Build (default features + tdx)
48        run: cargo rustc --bin cloud-hypervisor --features "tdx" -- -D warnings
49
50      - name: Build (default features + amx)
51        run: cargo rustc --bin cloud-hypervisor --features "amx" -- -D warnings
52
53      - name: Build (default features + gdb)
54        run: cargo rustc --bin cloud-hypervisor --features "gdb" -- -D warnings
55
56      - name: Build (common + mshv)
57        run: cargo rustc --bin cloud-hypervisor --no-default-features --features "common,mshv"  -- -D warnings
58
59      - name: Release Build (default features)
60        run: cargo build --all --release --target=${{ matrix.target }}
61
62      - name: Check build did not modify any files
63        run: test -z "$(git status --porcelain)"
64