From ec020399b947fce71e1f59ff862e62c06b125c2a Mon Sep 17 00:00:00 2001 From: Ruoqing He Date: Wed, 12 Feb 2025 18:14:41 +0800 Subject: [PATCH] ci: Enable partial components build-check on riscv Since we have RISC-V builders available now, let's start with `agent-ctl`, `trace-forwarder` and `genpolicy` components to run build-checks on these `riscv-builder`s, and gradually add the rest components when they are ready, to catch up with other architectures eventually. This workflow could be mannually triggered, `riscv-builder` will be the default instance when that is the case. Signed-off-by: Ruoqing He --- .../build-checks-preview-riscv64.yaml | 98 +++++++++++++++++++ .../workflows/static-checks-self-hosted.yaml | 12 +++ 2 files changed, 110 insertions(+) create mode 100644 .github/workflows/build-checks-preview-riscv64.yaml diff --git a/.github/workflows/build-checks-preview-riscv64.yaml b/.github/workflows/build-checks-preview-riscv64.yaml new file mode 100644 index 000000000..a1f3fef47 --- /dev/null +++ b/.github/workflows/build-checks-preview-riscv64.yaml @@ -0,0 +1,98 @@ +# This yaml is designed to be used until all components listed in +# `build-checks.yaml` are supported +on: + workflow_dispatch: + inputs: + instance: + default: "riscv-builder" + description: "Default instance when manually triggering" + workflow_call: + inputs: + instance: + required: true + type: string + +name: Build checks preview riscv64 +jobs: + check: + runs-on: ${{ inputs.instance }} + strategy: + fail-fast: false + matrix: + component: + - agent-ctl + - trace-forwarder + - genpolicy + command: + - "make vendor" + - "make check" + - "make test" + - "sudo -E PATH=\"$PATH\" make test" + include: + - component: agent-ctl + component-path: src/tools/agent-ctl + - component: trace-forwarder + component-path: src/tools/trace-forwarder + - install-libseccomp: no + - component: genpolicy + component-path: src/tools/genpolicy + 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: ${{ matrix.component == 'runtime' }} + run: | + ./tests/install_go.sh -f -p + echo "/usr/local/go/bin" >> "$GITHUB_PATH" + - name: Install rust + if: ${{ matrix.component != 'runtime' }} + run: | + ./tests/install_rust.sh + echo "${HOME}/.cargo/bin" >> "$GITHUB_PATH" + - name: Install musl-tools + if: ${{ matrix.component != 'runtime' }} + run: sudo apt-get -y install musl-tools + - name: Install devicemapper + if: ${{ matrix.command == 'make check' && matrix.component == 'agent' }} + run: sudo apt-get -y install libdevmapper-dev + - name: Install libseccomp + if: ${{ matrix.command != 'make vendor' && matrix.command != 'make check' && matrix.install-libseccomp == 'yes' }} + 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: ${{ matrix.command != 'make vendor' && (matrix.component == 'agent' || matrix.component == 'genpolicy' || matrix.component == 'agent-ctl') }} + run: sudo apt-get -y install protobuf-compiler + - name: Install clang + if: ${{ matrix.command == 'make check' && (matrix.component == 'agent' || matrix.component == 'agent-ctl') }} + run: sudo apt-get -y install clang + - name: Setup XDG_RUNTIME_DIR for the `runtime` tests + if: ${{ matrix.command != 'make vendor' && matrix.command != 'make check' && matrix.component == 'runtime' }} + 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: Running `${{ matrix.command }}` for ${{ matrix.component }} + run: | + cd ${{ matrix.component-path }} + ${{ matrix.command }} + env: + RUST_BACKTRACE: "1" + SKIP_GO_VERSION_CHECK: "1" diff --git a/.github/workflows/static-checks-self-hosted.yaml b/.github/workflows/static-checks-self-hosted.yaml index a4402603d..254e6dd7f 100644 --- a/.github/workflows/static-checks-self-hosted.yaml +++ b/.github/workflows/static-checks-self-hosted.yaml @@ -32,3 +32,15 @@ jobs: uses: ./.github/workflows/build-checks.yaml with: instance: ${{ matrix.instance }} + + build-checks-preview: + needs: skipper + if: ${{ needs.skipper.outputs.skip_static != 'yes' }} + strategy: + fail-fast: false + matrix: + instance: + - "riscv-builder" + uses: ./.github/workflows/build-checks-preview-riscv64.yaml + with: + instance: ${{ matrix.instance }}