on: workflow_call: inputs: instance: required: true type: string permissions: {} 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: libs path: src/libs 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 persist-credentials: false - 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" RUST_LIB_BACKTRACE: "0" SKIP_GO_VERSION_CHECK: "1"