diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 3e0753c..c72de32 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,5 +1,5 @@ name: check -on: [push, pull_request] +on: [push, pull_request, merge_group] jobs: fmt: name: fmt diff --git a/.github/workflows/client.yml b/.github/workflows/client.yml index ff84d63..44cb0a7 100644 --- a/.github/workflows/client.yml +++ b/.github/workflows/client.yml @@ -1,5 +1,5 @@ name: client -on: [push, pull_request] +on: [push, pull_request, merge_group] jobs: build: strategy: diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 02621e4..95da3d7 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -8,6 +8,8 @@ on: paths: - "kernel/**" - "hack/ci/**" + merge_group: + jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 6dbe573..34d4426 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -16,8 +16,6 @@ jobs: TARGET_ARCH: "${{ matrix.arch }}" name: server ${{ matrix.arch }} steps: - - run: git config --global core.autocrlf false && git config --global core.eol lf - if: ${{ matrix.platform.os == 'windows' }} - uses: actions/checkout@v4 with: submodules: recursive @@ -77,6 +75,8 @@ jobs: run: shell: bash steps: + - run: git config --global core.autocrlf false && git config --global core.eol lf + if: ${{ matrix.platform.os == 'windows' }} - uses: actions/checkout@v4 with: submodules: recursive @@ -93,4 +93,10 @@ jobs: - uses: actions/upload-artifact@v4 with: name: kratactl-${{ matrix.platform.os }}-${{ matrix.platform.arch }} - path: "target/*/release/kratactl*" + path: "target/*/release/kratactl" + if: ${{ matrix.platform.os != 'windows' }} + - uses: actions/upload-artifact@v4 + with: + name: kratactl-${{ matrix.platform.os }}-${{ matrix.platform.arch }} + path: "target/*/release/kratactl.exe" + if: ${{ matrix.platform.os == 'windows' }} diff --git a/.github/workflows/os.yml b/.github/workflows/os.yml index bad94e6..edd41ae 100644 --- a/.github/workflows/os.yml +++ b/.github/workflows/os.yml @@ -10,6 +10,7 @@ on: - "os/**" - "hack/os/**" - "hack/ci/**" + merge_group: jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml new file mode 100644 index 0000000..edd5c21 --- /dev/null +++ b/.github/workflows/release-binaries.yml @@ -0,0 +1,91 @@ +name: release-binaries +permissions: + contents: write +on: + release: + types: + - published +env: + CARGO_INCREMENTAL: 0 + CARGO_NET_GIT_FETCH_WITH_CLI: true + CARGO_NET_RETRY: 10 + CARGO_TERM_COLOR: always + RUST_BACKTRACE: 1 + RUSTUP_MAX_RETRIES: 10 +jobs: + server: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + arch: + - x86_64 + - aarch64 + env: + TARGET_ARCH: "${{ matrix.arch }}" + name: server ${{ matrix.arch }} + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: dtolnay/rust-toolchain@stable + with: + targets: "${{ matrix.arch }}-unknown-linux-gnu,${{ matrix.arch }}-unknown-linux-musl" + - run: ./hack/ci/install-linux-deps.sh + - run: ./hack/dist/bundle.sh + env: + KRATA_KERNEL_BUILD_JOBS: "5" + - run: "./hack/ci/assemble-release-assets.sh bundle-systemd ${{ github.event.release.tag_name }} ${{ matrix.arch }} target/dist/bundle-systemd-${{ matrix.arch }}.tgz" + - run: ./hack/dist/deb.sh + env: + KRATA_KERNEL_BUILD_SKIP: "1" + - run: "./hack/ci/assemble-release-assets.sh debian ${{ github.event.release.tag_name }} ${{ matrix.arch }} target/dist/*.deb" + - run: ./hack/dist/apk.sh + env: + KRATA_KERNEL_BUILD_SKIP: "1" + - run: "./hack/ci/assemble-release-assets.sh alpine ${{ github.event.release.tag_name }} ${{ matrix.arch }} target/dist/*_${{ matrix.arch }}.apk" + - run: ./hack/os/build.sh + env: + KRATA_KERNEL_BUILD_SKIP: "1" + - run: "./hack/ci/assemble-release-assets.sh os ${{ github.event.release.tag_name }} ${{ matrix.arch }} target/os/krata-${{ matrix.arch }}.qcow2" + client: + strategy: + fail-fast: false + matrix: + platform: + - { os: linux, arch: x86_64, on: ubuntu-latest, deps: linux } + - { os: linux, arch: aarch64, on: ubuntu-latest, deps: linux } + - { os: darwin, arch: x86_64, on: macos-14, deps: darwin } + - { os: darwin, arch: aarch64, on: macos-14, deps: darwin } + - { os: freebsd, arch: x86_64, on: ubuntu-latest, deps: linux } + - { os: windows, arch: x86_64, on: windows-latest, deps: windows } + env: + TARGET_OS: "${{ matrix.platform.os }}" + TARGET_ARCH: "${{ matrix.platform.arch }}" + runs-on: "${{ matrix.platform.on }}" + name: client ${{ matrix.platform.os }}-${{ matrix.platform.arch }} + defaults: + run: + shell: bash + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: dtolnay/rust-toolchain@stable + if: ${{ matrix.platform.os != 'darwin' }} + - uses: dtolnay/rust-toolchain@stable + with: + targets: "${{ matrix.platform.arch }}-apple-darwin" + if: ${{ matrix.platform.os == 'darwin' }} + - uses: homebrew/actions/setup-homebrew@master + if: ${{ matrix.platform.os == 'darwin' }} + - run: ./hack/ci/install-${{ matrix.platform.deps }}-deps.sh + - run: ./hack/build/cargo.sh build --release --bin kratactl + - run: "./hack/ci/assemble-release-assets.sh kratactl ${{ github.event.release.tag_name }} ${{ matrix.platform.os }}-${{ matrix.platform.arch }} target/*/release/kratactl" + if: ${{ matrix.platform.os != 'windows' }} + - run: "./hack/ci/assemble-release-assets.sh kratactl ${{ github.event.release.tag_name }} ${{ matrix.platform.os }}-${{ matrix.platform.arch }} target/*/release/kratactl.exe" + if: ${{ matrix.platform.os == 'windows' }} + - run: "./hack/ci/upload-release-assets.sh ${{ github.event.release.tag_name }}" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/release-plz.yml b/.github/workflows/release-plz.yml new file mode 100644 index 0000000..b9e7af8 --- /dev/null +++ b/.github/workflows/release-plz.yml @@ -0,0 +1,29 @@ +name: release-plz + +permissions: + pull-requests: write + contents: write + +on: + push: + branches: + - release-test + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + +jobs: + release-plz: + name: release-plz + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + - uses: dtolnay/rust-toolchain@stable + - name: release-plz + uses: MarcoIeni/release-plz-action@v0.5 + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/server.yml b/.github/workflows/server.yml index 1120dd3..5d7da42 100644 --- a/.github/workflows/server.yml +++ b/.github/workflows/server.yml @@ -1,5 +1,5 @@ name: server -on: [push, pull_request] +on: [push, pull_request, merge_group] jobs: build: runs-on: ubuntu-latest diff --git a/crates/ctl/Cargo.toml b/crates/ctl/Cargo.toml index a08e01b..8e1170b 100644 --- a/crates/ctl/Cargo.toml +++ b/crates/ctl/Cargo.toml @@ -2,7 +2,7 @@ name = "krata-ctl" description = "Command-line tool to control the krata hypervisor" license.workspace = true -version= "0.0.3" +version.workspace = true homepage.workspace = true repository.workspace = true edition = "2021" diff --git a/crates/daemon/Cargo.toml b/crates/daemon/Cargo.toml index 2d3a3d6..806cfd3 100644 --- a/crates/daemon/Cargo.toml +++ b/crates/daemon/Cargo.toml @@ -2,7 +2,7 @@ name = "krata-daemon" description = "Daemon for the krata hypervisor." license.workspace = true -version= "0.0.3" +version.workspace = true homepage.workspace = true repository.workspace = true edition = "2021" diff --git a/crates/guest/Cargo.toml b/crates/guest/Cargo.toml index ecb86c6..fa49261 100644 --- a/crates/guest/Cargo.toml +++ b/crates/guest/Cargo.toml @@ -2,7 +2,7 @@ name = "krata-guest" description = "Guest services for the krata hypervisor." license.workspace = true -version= "0.0.3" +version.workspace = true homepage.workspace = true repository.workspace = true edition = "2021" diff --git a/crates/krata/Cargo.toml b/crates/krata/Cargo.toml index 5232223..a845dcb 100644 --- a/crates/krata/Cargo.toml +++ b/crates/krata/Cargo.toml @@ -2,7 +2,7 @@ name = "krata" description = "Client library and common services for the krata hypervisor." license.workspace = true -version= "0.0.3" +version.workspace = true homepage.workspace = true repository.workspace = true edition = "2021" diff --git a/crates/network/Cargo.toml b/crates/network/Cargo.toml index b58c6c5..8a053cb 100644 --- a/crates/network/Cargo.toml +++ b/crates/network/Cargo.toml @@ -2,7 +2,7 @@ name = "krata-network" description = "Networking services for the krata hypervisor." license.workspace = true -version= "0.0.3" +version.workspace = true homepage.workspace = true repository.workspace = true edition = "2021" diff --git a/crates/oci/Cargo.toml b/crates/oci/Cargo.toml index c60284d..108f477 100644 --- a/crates/oci/Cargo.toml +++ b/crates/oci/Cargo.toml @@ -2,7 +2,7 @@ name = "krata-oci" description = "OCI services for the krata hypervisor." license.workspace = true -version= "0.0.3" +version.workspace = true homepage.workspace = true repository.workspace = true edition = "2021" diff --git a/crates/runtime/Cargo.toml b/crates/runtime/Cargo.toml index 19fd959..7b2bfa6 100644 --- a/crates/runtime/Cargo.toml +++ b/crates/runtime/Cargo.toml @@ -2,7 +2,7 @@ name = "krata-runtime" description = "Runtime for running guests on the krata hypervisor." license.workspace = true -version= "0.0.3" +version.workspace = true homepage.workspace = true repository.workspace = true edition = "2021" diff --git a/crates/xen/xencall/Cargo.toml b/crates/xen/xencall/Cargo.toml index 1c91443..a3557e4 100644 --- a/crates/xen/xencall/Cargo.toml +++ b/crates/xen/xencall/Cargo.toml @@ -2,7 +2,7 @@ name = "krata-xencall" description = "An implementation of direct interfacing to xen privcmd for krata." license.workspace = true -version= "0.0.3" +version.workspace = true homepage.workspace = true repository.workspace = true edition = "2021" diff --git a/crates/xen/xenclient/Cargo.toml b/crates/xen/xenclient/Cargo.toml index e2d0dec..356e170 100644 --- a/crates/xen/xenclient/Cargo.toml +++ b/crates/xen/xenclient/Cargo.toml @@ -2,7 +2,7 @@ name = "krata-xenclient" description = "An implementation of Xen userspace for krata." license.workspace = true -version= "0.0.3" +version.workspace = true homepage.workspace = true repository.workspace = true edition = "2021" diff --git a/crates/xen/xenevtchn/Cargo.toml b/crates/xen/xenevtchn/Cargo.toml index 86572cb..644d928 100644 --- a/crates/xen/xenevtchn/Cargo.toml +++ b/crates/xen/xenevtchn/Cargo.toml @@ -2,7 +2,7 @@ name = "krata-xenevtchn" description = "An implementation of xen evtchn for krata." license.workspace = true -version= "0.0.3" +version.workspace = true homepage.workspace = true repository.workspace = true edition = "2021" diff --git a/crates/xen/xengnt/Cargo.toml b/crates/xen/xengnt/Cargo.toml index 4ace39c..9b4c8aa 100644 --- a/crates/xen/xengnt/Cargo.toml +++ b/crates/xen/xengnt/Cargo.toml @@ -2,7 +2,7 @@ name = "krata-xengnt" description = "An implementation of xen grant interfaces for krata." license.workspace = true -version= "0.0.3" +version.workspace = true homepage.workspace = true repository.workspace = true edition = "2021" diff --git a/crates/xen/xenstore/Cargo.toml b/crates/xen/xenstore/Cargo.toml index 8b4e75b..9295437 100644 --- a/crates/xen/xenstore/Cargo.toml +++ b/crates/xen/xenstore/Cargo.toml @@ -2,7 +2,7 @@ name = "krata-xenstore" description = "A client that interacts with xenstore for krata." license.workspace = true -version= "0.0.3" +version.workspace = true homepage.workspace = true repository.workspace = true edition = "2021" diff --git a/hack/ci/assemble-release-assets.sh b/hack/ci/assemble-release-assets.sh new file mode 100755 index 0000000..90f948c --- /dev/null +++ b/hack/ci/assemble-release-assets.sh @@ -0,0 +1,57 @@ +#!/bin/sh +set -e + +checksum_sha256() { + if type sha256sum > /dev/null 2>&1 + then + sha256sum "${1}" + else + shasum -a 256 "${1}" + fi +} + +asset() { + cp "${1}" "${2}" + PREVIOUS="${PWD}" + cd "$(dirname "${2}")" + BASE_FILE_NAME="$(basename "${2}")" + checksum_sha256 "${BASE_FILE_NAME}" > "${BASE_FILE_NAME}.sha256" + cd "${PREVIOUS}" +} + +FORM="${1}" +shift +TAG_NAME="${1}" +shift +PLATFORM="${1}" +shift + +mkdir -p target/assets + +for SOURCE_FILE_PATH in "${@}" +do + if [ "${FORM}" = "kratactl" ] + then + SUFFIX="" + if echo "${PLATFORM}" | grep "^windows-" > /dev/null + then + SUFFIX=".exe" + fi + asset "${SOURCE_FILE_PATH}" "target/assets/kratactl_${TAG_NAME}_${PLATFORM}${SUFFIX}" + elif [ "${FORM}" = "debian" ] + then + asset "${SOURCE_FILE_PATH}" "target/assets/krata_${TAG_NAME}_${PLATFORM}.deb" + elif [ "${FORM}" = "alpine" ] + then + asset "${SOURCE_FILE_PATH}" "target/assets/krata_${TAG_NAME}_${PLATFORM}.deb" + elif [ "${FORM}" = "bundle-systemd" ] + then + asset "${SOURCE_FILE_PATH}" "target/assets/krata-systemd_${TAG_NAME}_${PLATFORM}.tgz" + elif [ "${FORM}" = "os" ] + then + asset "${SOURCE_FILE_PATH}" "target/assets/krata_${TAG_NAME}_${PLATFORM}.qcow2" + else + echo "ERROR: Unknown form '${FORM}'" + exit 1 + fi +done diff --git a/hack/ci/install-windows-deps.sh b/hack/ci/install-windows-deps.sh old mode 100644 new mode 100755 diff --git a/hack/ci/upload-release-assets.sh b/hack/ci/upload-release-assets.sh new file mode 100755 index 0000000..6d33d03 --- /dev/null +++ b/hack/ci/upload-release-assets.sh @@ -0,0 +1,22 @@ +#!/bin/sh +set -e + +retry() { + for i in $(seq 1 10) + do + if "${@}" + then + return 0 + else + sleep "${i}" + fi + done + "${@}" +} + +TAG="${1}" +shift + +cd target/assets + +retry gh release upload "${TAG}" --clobber ./* diff --git a/release-plz.toml b/release-plz.toml new file mode 100644 index 0000000..f1989e0 --- /dev/null +++ b/release-plz.toml @@ -0,0 +1,21 @@ +[workspace] +git_release_enable = false +git_tag_enable = false +changelog_update = false +publish = false + +[[package]] +name = "krata" +git_tag_name = "v${version}" +git_tag_enable = true +git_release_enable = true +changelog_update = true +changelog_path = "./CHANGELOG.md" +changelog_include = [ + "krata-daemon", + "krata-ctl", + "krata-guest", + "krata-network", + "krata-runtime", + "krata-oci" +]