2020-04-23 10:59:18 +00:00
|
|
|
name: Cloud Hypervisor Release
|
2024-02-28 13:16:18 +00:00
|
|
|
on: [create, merge_group]
|
2024-02-28 15:17:57 +00:00
|
|
|
concurrency:
|
2024-03-01 14:38:17 +00:00
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
2024-02-28 15:17:57 +00:00
|
|
|
cancel-in-progress: true
|
2024-03-20 16:43:36 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ github.token }}
|
2020-04-23 10:59:18 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
release:
|
2024-02-28 13:16:18 +00:00
|
|
|
if: (github.event_name == 'create' && github.event.ref_type == 'tag') || github.event_name == 'merge_group'
|
2024-03-20 16:43:36 +00:00
|
|
|
name: Release ${{ matrix.platform.target }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
platform:
|
|
|
|
- target: x86_64-unknown-linux-gnu
|
|
|
|
args: --all --release --features mshv
|
|
|
|
name_ch: cloud-hypervisor
|
|
|
|
name_ch_remote: ch-remote
|
|
|
|
- target: x86_64-unknown-linux-musl
|
|
|
|
args: --all --release --features mshv
|
|
|
|
name_ch: cloud-hypervisor-static
|
|
|
|
name_ch_remote: ch-remote-static
|
|
|
|
- target: aarch64-unknown-linux-musl
|
|
|
|
args: --all --release
|
|
|
|
name_ch: cloud-hypervisor-static-aarch64
|
|
|
|
name_ch_remote: ch-remote-static-aarch64
|
2020-04-23 10:59:18 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Code checkout
|
2023-12-11 11:56:22 +00:00
|
|
|
uses: actions/checkout@v4
|
2022-03-03 15:20:20 +00:00
|
|
|
- name: Install musl-gcc
|
2024-03-20 16:43:36 +00:00
|
|
|
if: contains(matrix.platform.target, 'musl')
|
2023-01-13 13:48:27 +00:00
|
|
|
run: sudo apt install -y musl-tools
|
2021-10-14 15:51:35 +00:00
|
|
|
- name: Create release directory
|
2024-03-20 16:43:36 +00:00
|
|
|
if: |
|
|
|
|
github.event_name == 'create' && github.event.ref_type == 'tag' &&
|
|
|
|
matrix.platform.target == 'x86_64-unknown-linux-gnu'
|
2021-10-14 15:51:35 +00:00
|
|
|
run: rsync -rv --exclude=.git . ../cloud-hypervisor-${{ github.event.ref }}
|
2024-03-20 16:43:36 +00:00
|
|
|
- name: Build ${{ matrix.platform.target }}
|
|
|
|
uses: houseabsolute/actions-rust-cross@v0
|
2020-04-23 10:59:18 +00:00
|
|
|
with:
|
2023-01-13 13:48:27 +00:00
|
|
|
command: build
|
2024-03-20 16:43:36 +00:00
|
|
|
target: ${{ matrix.platform.target }}
|
|
|
|
args: ${{ matrix.platform.args }}
|
|
|
|
strip: true
|
2024-05-14 11:08:05 +00:00
|
|
|
toolchain: "1.77.0"
|
2024-03-20 16:43:36 +00:00
|
|
|
- name: Copy Release Binaries
|
2023-01-13 13:48:27 +00:00
|
|
|
if: github.event_name == 'create' && github.event.ref_type == 'tag'
|
2024-03-20 16:43:36 +00:00
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
cp target/${{ matrix.platform.target }}/release/cloud-hypervisor ./${{ matrix.platform.name_ch }}
|
|
|
|
cp target/${{ matrix.platform.target }}/release/ch-remote ./${{ matrix.platform.name_ch_remote }}
|
|
|
|
- name: Upload Release Artifacts
|
2023-01-13 13:48:27 +00:00
|
|
|
if: github.event_name == 'create' && github.event.ref_type == 'tag'
|
2024-03-20 16:43:36 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-09-09 13:52:29 +00:00
|
|
|
with:
|
2024-03-20 16:43:36 +00:00
|
|
|
name: Artifacts for ${{ matrix.platform.target }}
|
|
|
|
path: |
|
|
|
|
./${{ matrix.platform.name_ch }}
|
|
|
|
./${{ matrix.platform.name_ch_remote }}
|
2023-01-14 11:50:02 +00:00
|
|
|
- name: Vendor
|
2024-03-20 16:43:36 +00:00
|
|
|
if: |
|
|
|
|
github.event_name == 'create' && github.event.ref_type == 'tag' &&
|
|
|
|
matrix.platform.target == 'x86_64-unknown-linux-gnu'
|
2023-01-14 11:50:02 +00:00
|
|
|
working-directory: ../cloud-hypervisor-${{ github.event.ref }}
|
|
|
|
run: |
|
|
|
|
mkdir ../vendor-cargo-home
|
|
|
|
export CARGO_HOME=$(realpath ../vendor-cargo-home)
|
|
|
|
mkdir .cargo
|
|
|
|
cargo vendor > .cargo/config.toml
|
|
|
|
- name: Create vendored source archive
|
2024-03-20 16:43:36 +00:00
|
|
|
if: |
|
|
|
|
github.event_name == 'create' && github.event.ref_type == 'tag' &&
|
|
|
|
matrix.platform.target == 'x86_64-unknown-linux-gnu'
|
|
|
|
run: tar cJf cloud-hypervisor-${{ github.event.ref }}.tar.xz ../cloud-hypervisor-${{ github.event.ref }}
|
2023-01-14 11:50:02 +00:00
|
|
|
- name: Upload cloud-hypervisor vendored source archive
|
2024-03-20 16:43:36 +00:00
|
|
|
if: |
|
|
|
|
github.event_name == 'create' && github.event.ref_type == 'tag' &&
|
|
|
|
matrix.platform.target == 'x86_64-unknown-linux-gnu'
|
2023-01-14 11:50:02 +00:00
|
|
|
id: upload-release-cloud-hypervisor-vendored-sources
|
2024-03-20 16:43:36 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
path: cloud-hypervisor-${{ github.event.ref }}.tar.xz
|
|
|
|
name: cloud-hypervisor-${{ github.event.ref }}.tar.xz
|
|
|
|
- name: Create GitHub Release
|
|
|
|
if: github.event_name == 'create' && github.event.ref_type == 'tag'
|
|
|
|
uses: softprops/action-gh-release@v1
|
2023-01-14 11:50:02 +00:00
|
|
|
with:
|
2024-04-27 14:18:48 +00:00
|
|
|
draft: true
|
2024-03-20 16:43:36 +00:00
|
|
|
files: |
|
|
|
|
./${{ matrix.platform.name_ch }}
|
|
|
|
./${{ matrix.platform.name_ch_remote }}
|
|
|
|
./cloud-hypervisor-${{ github.event.ref }}.tar.xz
|