Repository navigation
104 lines (104 loc) · 3.59 KB
/
Copy pathcloud-hypervisor.yml
File metadata and controls
104 lines (104 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: cloud-hypervisor
on:
workflow_dispatch:
inputs:
ch_ref:
description: cloud-hypervisor git ref (commit/tag/branch) to build
required: true
default: main
permissions:
contents: read
env:
CH_REPO: cloud-hypervisor/cloud-hypervisor
CH_REF: ${{ inputs.ch_ref }}
RELEASE_TAG: cloud-hypervisor-fw_cfg
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runs-on: ubuntu-latest
target: x86_64-unknown-linux-musl
suffix: ""
- arch: aarch64
runs-on: ubuntu-24.04-arm
target: aarch64-unknown-linux-musl
suffix: "-aarch64"
runs-on: ${{ matrix.runs-on }}
defaults:
run:
shell: bash
steps:
- name: Checkout cloud-hypervisor
uses: actions/checkout@v7
with:
repository: ${{ env.CH_REPO }}
ref: ${{ env.CH_REF }}
fetch-depth: 0
persist-credentials: false
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get -y install build-essential pkg-config musl-tools
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build cloud-hypervisor (--features fw_cfg)
run: |
# cloud-hypervisor's default features (io_uring, kvm) plus fw_cfg,
# built as a static musl binary for portability.
cargo build --release --target ${{ matrix.target }} \
--bin cloud-hypervisor --features fw_cfg
BIN_DIR="target/${{ matrix.target }}/release"
ls -l "$BIN_DIR/cloud-hypervisor"
"$BIN_DIR/cloud-hypervisor" --version
# cloud-hypervisor built with --features fw_cfg exposes --fw-cfg-config.
"$BIN_DIR/cloud-hypervisor" --help | grep -q fw-cfg-config
- name: Stage artifacts
run: |
BIN_DIR="target/${{ matrix.target }}/release"
mkdir -p out
cp "$BIN_DIR/cloud-hypervisor" "out/cloud-hypervisor-static${{ matrix.suffix }}"
- uses: actions/upload-artifact@v7
with:
name: ch-${{ matrix.arch }}
path: out/*
release:
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- name: Publish release
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ls -l dist
RELEASE_NOTES=$(mktemp)
{
echo "cloud-hypervisor built with \`--features fw_cfg\` for the cloud-hypervisor-provider."
echo ""
echo '```'
echo "repo: ${CH_REPO}"
echo "ref: ${CH_REF}"
echo '```'
echo ""
echo "Built by GitHub actions run [${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})."
echo ""
echo "Upstream cloud-hypervisor is licensed under Apache-2.0 / BSD-3-Clause; see https://github.com/cloud-hypervisor/cloud-hypervisor."
} > "$RELEASE_NOTES"
# Recreate the (non-latest) release so the tag always points at the newest build.
gh release delete "${RELEASE_TAG}" --yes --cleanup-tag 2>/dev/null || true
gh release create "${RELEASE_TAG}" \
--latest=false \
--title "cloud-hypervisor (fw_cfg) ${CH_REF}" \
--notes-file "$RELEASE_NOTES" \
dist/*