From 4afb278fe2c60ac59b20dc104b932c1f9be96466 Mon Sep 17 00:00:00 2001 From: Eric Ernst Date: Fri, 25 Feb 2022 14:06:56 -0800 Subject: [PATCH] ci: add github action to exercise darwin build, unit tests There are a few outstanding changes required to build the runtime on Darwin. Let's add a GitHub action to exercise build and unit tests of the packages which we do expect to work. Eventually this should be dropped and we can run any Darwin specific tests, or just add MacOS to the matrix for our static check OSes. Fixes: #3778 Signed-off-by: Eric Ernst --- .github/workflows/darwin-tests.yaml | 25 +++++++++++++++++ ci/darwin-test.sh | 42 +++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 .github/workflows/darwin-tests.yaml create mode 100755 ci/darwin-test.sh diff --git a/.github/workflows/darwin-tests.yaml b/.github/workflows/darwin-tests.yaml new file mode 100644 index 0000000000..5a83add32d --- /dev/null +++ b/.github/workflows/darwin-tests.yaml @@ -0,0 +1,25 @@ +on: + pull_request: + types: + - opened + - edited + - reopened + - synchronize + +name: Darwin tests +jobs: + test: + strategy: + matrix: + go-version: [1.16.x, 1.17.x] + os: [macos-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v2 + - name: Build utils + run: ./ci/darwin-test.sh diff --git a/ci/darwin-test.sh b/ci/darwin-test.sh new file mode 100755 index 0000000000..92317653be --- /dev/null +++ b/ci/darwin-test.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2022 Apple Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +set -e + +cidir=$(dirname "$0") +runtimedir=$cidir/../src/runtime + +build_working_packages() { + # working packages: + device_api=$runtimedir/virtcontainers/device/api + device_config=$runtimedir/virtcontainers/device/config + device_drivers=$runtimedir/virtcontainers/device/drivers + device_manager=$runtimedir/virtcontainers/device/manager + rc_pkg_dir=$runtimedir/pkg/resourcecontrol/ + utils_pkg_dir=$runtimedir/virtcontainers/utils + + # broken packages :( : + #katautils=$runtimedir/pkg/katautils + #oci=$runtimedir/pkg/oci + #vc=$runtimedir/virtcontainers + + pkgs=( + "$device_api" + "$device_config" + "$device_drivers" + "$device_manager" + "$utils_pkg_dir" + "$rc_pkg_dir") + for pkg in "${pkgs[@]}"; do + echo building "$pkg" + pushd "$pkg" &>/dev/null + go build + go test + popd &>/dev/null + done +} + +build_working_packages