mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-27 11:31:05 +00:00
Add apt/apt-get updates before we do apt/apt-get installs to try and help with issues where we fail to fetch packages Co-authored-by: Fabiano Fidêncio <fidencio@northflank.com> Signed-off-by: stevenhorsman <steven@uk.ibm.com>
126 lines
4.5 KiB
YAML
126 lines
4.5 KiB
YAML
on:
|
|
workflow_call:
|
|
inputs:
|
|
instance:
|
|
required: true
|
|
type: string
|
|
|
|
name: Build checks
|
|
jobs:
|
|
check:
|
|
runs-on: ${{ inputs.instance }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
command:
|
|
- "make vendor"
|
|
- "make check"
|
|
- "make test"
|
|
- "sudo -E PATH=\"$PATH\" make test"
|
|
component:
|
|
- name: agent
|
|
path: src/agent
|
|
needs:
|
|
- rust
|
|
- libdevmapper
|
|
- libseccomp
|
|
- protobuf-compiler
|
|
- clang
|
|
- name: dragonball
|
|
path: src/dragonball
|
|
needs:
|
|
- rust
|
|
- name: runtime
|
|
path: src/runtime
|
|
needs:
|
|
- golang
|
|
- XDG_RUNTIME_DIR
|
|
- name: runtime-rs
|
|
path: src/runtime-rs
|
|
needs:
|
|
- rust
|
|
- name: agent-ctl
|
|
path: src/tools/agent-ctl
|
|
needs:
|
|
- rust
|
|
- protobuf-compiler
|
|
- clang
|
|
- name: kata-ctl
|
|
path: src/tools/kata-ctl
|
|
needs:
|
|
- rust
|
|
- name: trace-forwarder
|
|
path: src/tools/trace-forwarder
|
|
needs:
|
|
- rust
|
|
- name: genpolicy
|
|
path: src/tools/genpolicy
|
|
needs:
|
|
- rust
|
|
- protobuf-compiler
|
|
|
|
steps:
|
|
- name: Adjust a permission for repo
|
|
run: |
|
|
sudo chown -R "$USER":"$USER" "$GITHUB_WORKSPACE" "$HOME"
|
|
sudo rm -rf "$GITHUB_WORKSPACE"/* || { sleep 10 && sudo rm -rf "$GITHUB_WORKSPACE"/*; }
|
|
sudo rm -f /tmp/kata_hybrid* # Sometime we got leftover from test_setup_hvsock_failed()
|
|
|
|
- name: Checkout the code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install yq
|
|
run: |
|
|
./ci/install_yq.sh
|
|
env:
|
|
INSTALL_IN_GOPATH: false
|
|
- name: Install golang
|
|
if: contains(matrix.component.needs, 'golang')
|
|
run: |
|
|
./tests/install_go.sh -f -p
|
|
echo "/usr/local/go/bin" >> "$GITHUB_PATH"
|
|
- name: Setup rust
|
|
if: contains(matrix.component.needs, 'rust')
|
|
run: |
|
|
./tests/install_rust.sh
|
|
echo "${HOME}/.cargo/bin" >> "$GITHUB_PATH"
|
|
if [ "$(uname -m)" == "x86_64" ] || [ "$(uname -m)" == "aarch64" ]; then
|
|
sudo apt-get update && sudo apt-get -y install musl-tools
|
|
fi
|
|
- name: Install devicemapper
|
|
if: contains(matrix.component.needs, 'libdevmapper') && matrix.command == 'make check'
|
|
run: sudo apt-get update && sudo apt-get -y install libdevmapper-dev
|
|
- name: Install libseccomp
|
|
if: contains(matrix.component.needs, 'libseccomp') && matrix.command != 'make vendor' && matrix.command != 'make check'
|
|
run: |
|
|
libseccomp_install_dir=$(mktemp -d -t libseccomp.XXXXXXXXXX)
|
|
gperf_install_dir=$(mktemp -d -t gperf.XXXXXXXXXX)
|
|
./ci/install_libseccomp.sh "${libseccomp_install_dir}" "${gperf_install_dir}"
|
|
echo "Set environment variables for the libseccomp crate to link the libseccomp library statically"
|
|
echo "LIBSECCOMP_LINK_TYPE=static" >> "$GITHUB_ENV"
|
|
echo "LIBSECCOMP_LIB_PATH=${libseccomp_install_dir}/lib" >> "$GITHUB_ENV"
|
|
- name: Install protobuf-compiler
|
|
if: contains(matrix.component.needs, 'protobuf-compiler') && matrix.command != 'make vendor'
|
|
run: sudo apt-get update && sudo apt-get -y install protobuf-compiler
|
|
- name: Install clang
|
|
if: contains(matrix.component.needs, 'clang') && matrix.command == 'make check'
|
|
run: sudo apt-get update && sudo apt-get -y install clang
|
|
- name: Setup XDG_RUNTIME_DIR
|
|
if: contains(matrix.component.needs, 'XDG_RUNTIME_DIR') && matrix.command != 'make check'
|
|
run: |
|
|
XDG_RUNTIME_DIR=$(mktemp -d "/tmp/kata-tests-$USER.XXX" | tee >(xargs chmod 0700))
|
|
echo "XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR}" >> "$GITHUB_ENV"
|
|
- name: Skip tests that depend on virtualization capable runners when needed
|
|
if: ${{ endsWith(inputs.instance, '-arm') }}
|
|
run: |
|
|
echo "GITHUB_RUNNER_CI_NON_VIRT=true" >> "$GITHUB_ENV"
|
|
- name: Running `${{ matrix.command }}` for ${{ matrix.component.name }}
|
|
run: |
|
|
cd ${{ matrix.component.path }}
|
|
${{ matrix.command }}
|
|
env:
|
|
RUST_BACKTRACE: "1"
|
|
SKIP_GO_VERSION_CHECK: "1"
|