mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-11 06:13:43 +00:00
Merge pull request #9020 from BbolroC/ok-to-test-static-checks-but-x86
gha: Run static-checks on self-hosted runners conditionally
This commit is contained in:
commit
058f068d67
113
.github/workflows/build-checks.yaml
vendored
Normal file
113
.github/workflows/build-checks.yaml
vendored
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
instance:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
name: Build checks
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
runs-on: ${{ inputs.instance }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
component:
|
||||||
|
- agent
|
||||||
|
- dragonball
|
||||||
|
- runtime
|
||||||
|
- runtime-rs
|
||||||
|
- agent-ctl
|
||||||
|
- kata-ctl
|
||||||
|
- runk
|
||||||
|
- trace-forwarder
|
||||||
|
- genpolicy
|
||||||
|
command:
|
||||||
|
- "make vendor"
|
||||||
|
- "make check"
|
||||||
|
- "make test"
|
||||||
|
- "sudo -E PATH=\"$PATH\" make test"
|
||||||
|
include:
|
||||||
|
- component: agent
|
||||||
|
component-path: src/agent
|
||||||
|
- component: dragonball
|
||||||
|
component-path: src/dragonball
|
||||||
|
- component: runtime
|
||||||
|
component-path: src/runtime
|
||||||
|
- component: runtime-rs
|
||||||
|
component-path: src/runtime-rs
|
||||||
|
- component: agent-ctl
|
||||||
|
component-path: src/tools/agent-ctl
|
||||||
|
- component: kata-ctl
|
||||||
|
component-path: src/tools/kata-ctl
|
||||||
|
- component: runk
|
||||||
|
component-path: src/tools/runk
|
||||||
|
- component: trace-forwarder
|
||||||
|
component-path: src/tools/trace-forwarder
|
||||||
|
- install-libseccomp: no
|
||||||
|
- component: agent
|
||||||
|
install-libseccomp: yes
|
||||||
|
- component: runk
|
||||||
|
install-libseccomp: yes
|
||||||
|
- 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/*
|
||||||
|
sudo rm -f /tmp/kata_hybrid* # Sometime we got leftover from test_setup_hvsock_failed()
|
||||||
|
if: ${{ inputs.instance != 'ubuntu-20.04' }}
|
||||||
|
|
||||||
|
- 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 check' && matrix.component == 'agent' }}
|
||||||
|
run: sudo apt-get -y install protobuf-compiler
|
||||||
|
- name: Install clang
|
||||||
|
if: ${{ matrix.command == 'make check' && matrix.component == 'agent' }}
|
||||||
|
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"
|
26
.github/workflows/static-checks-self-hosted.yaml
vendored
Normal file
26
.github/workflows/static-checks-self-hosted.yaml
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
- labeled # a workflow runs only when the 'ok-to-test' label is added
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
name: Static checks self-hosted
|
||||||
|
jobs:
|
||||||
|
build-checks:
|
||||||
|
if: ${{ contains(github.event.pull_request.labels.*.name, 'ok-to-test') }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
instance:
|
||||||
|
- "arm-no-k8s"
|
||||||
|
- "s390x"
|
||||||
|
- "ppc64le"
|
||||||
|
uses: ./.github/workflows/build-checks.yaml
|
||||||
|
with:
|
||||||
|
instance: ${{ matrix.instance }}
|
110
.github/workflows/static-checks.yaml
vendored
110
.github/workflows/static-checks.yaml
vendored
@ -35,113 +35,9 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
build-checks:
|
build-checks:
|
||||||
strategy:
|
uses: ./.github/workflows/build-checks.yaml
|
||||||
fail-fast: false
|
with:
|
||||||
matrix:
|
instance: ubuntu-20.04
|
||||||
component:
|
|
||||||
- agent
|
|
||||||
- dragonball
|
|
||||||
- runtime
|
|
||||||
- runtime-rs
|
|
||||||
- agent-ctl
|
|
||||||
- kata-ctl
|
|
||||||
- runk
|
|
||||||
- trace-forwarder
|
|
||||||
- genpolicy
|
|
||||||
command:
|
|
||||||
- "make vendor"
|
|
||||||
- "make check"
|
|
||||||
- "make test"
|
|
||||||
- "sudo -E PATH=\"$PATH\" make test"
|
|
||||||
include:
|
|
||||||
- component: agent
|
|
||||||
component-path: src/agent
|
|
||||||
- component: dragonball
|
|
||||||
component-path: src/dragonball
|
|
||||||
- component: runtime
|
|
||||||
component-path: src/runtime
|
|
||||||
- component: runtime-rs
|
|
||||||
component-path: src/runtime-rs
|
|
||||||
- component: agent-ctl
|
|
||||||
component-path: src/tools/agent-ctl
|
|
||||||
- component: kata-ctl
|
|
||||||
component-path: src/tools/kata-ctl
|
|
||||||
- component: runk
|
|
||||||
component-path: src/tools/runk
|
|
||||||
- component: trace-forwarder
|
|
||||||
component-path: src/tools/trace-forwarder
|
|
||||||
- install-libseccomp: no
|
|
||||||
- component: agent
|
|
||||||
install-libseccomp: yes
|
|
||||||
- component: runk
|
|
||||||
install-libseccomp: yes
|
|
||||||
- component: genpolicy
|
|
||||||
component-path: src/tools/genpolicy
|
|
||||||
instance:
|
|
||||||
- "ubuntu-20.04"
|
|
||||||
- "arm-no-k8s"
|
|
||||||
- "s390x"
|
|
||||||
- "ppc64le"
|
|
||||||
runs-on: ${{ matrix.instance }}
|
|
||||||
steps:
|
|
||||||
- name: Adjust a permission for repo
|
|
||||||
run: |
|
|
||||||
sudo chown -R $USER:$USER $GITHUB_WORKSPACE $HOME
|
|
||||||
sudo rm -rf $GITHUB_WORKSPACE/*
|
|
||||||
sudo rm -f /tmp/kata_hybrid* # Sometime we got leftover from test_setup_hvsock_failed()
|
|
||||||
if: ${{ matrix.instance != 'ubuntu-20.04' }}
|
|
||||||
|
|
||||||
- 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 check' && matrix.component == 'agent' }}
|
|
||||||
run: sudo apt-get -y install protobuf-compiler
|
|
||||||
- name: Install clang
|
|
||||||
if: ${{ matrix.command == 'make check' && matrix.component == 'agent' }}
|
|
||||||
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"
|
|
||||||
|
|
||||||
build-checks-depending-on-kvm:
|
build-checks-depending-on-kvm:
|
||||||
runs-on: garm-ubuntu-2004-smaller
|
runs-on: garm-ubuntu-2004-smaller
|
||||||
|
Loading…
Reference in New Issue
Block a user