1
0
mirror of https://github.com/containers/youki synced 2024-11-22 17:02:00 +01:00

Add the test with kind to github action

Signed-off-by: utam0k <k0ma@utam0k.jp>
This commit is contained in:
utam0k 2023-06-09 12:55:03 +00:00
parent a49d14cca9
commit 51ac26a0ca
No known key found for this signature in database
GPG Key ID: 2DB29D2A21B41E0E
6 changed files with 71 additions and 41 deletions

@ -19,7 +19,7 @@ jobs:
- name: Install just - name: Install just
uses: taiki-e/install-action@just uses: taiki-e/install-action@just
- name: Install requirements - name: Install requirements
run: just ci-prepare run: sudo env PATH=$PATH just ci-prepare
- name: Build youki - name: Build youki
run: just youki-release run: just youki-release
- name: Upload youki binary - name: Upload youki binary
@ -59,24 +59,23 @@ jobs:
runc --version runc --version
- name: Integration Test - name: Integration Test
run: sudo make TEST_RUNTIME=io.containerd.runc.v2 TESTFLAGS="-timeout 40m" integration run: sudo make TEST_RUNTIME=io.containerd.runc.v2 TESTFLAGS="-timeout 40m" integration
#
# k8s-tests: k8s-tests:
# runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
# needs: [youki-build] needs: [youki-build]
# timeout-minutes: 40 timeout-minutes: 40
# steps: steps:
# - uses: actions/checkout@v3 - uses: actions/checkout@v3
# - name: Download youki binary - name: Download youki binary
# uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
# with: with:
# name: youki name: youki
# - name: Add the permission to run - name: Add the permission to run
# run: chmod +x ./youki run: chmod +x ./youki
# - name: test/k8s/deploy - name: Install just
# run: make test/k8s/deploy uses: taiki-e/install-action@just
# # - name: Debug - name: test/k8s/deploy
# # if: ${{ always() }} run: just test-kind
# # uses: mxschmitt/action-tmate@v3
oci-validation-go: oci-validation-go:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
@ -117,7 +116,7 @@ jobs:
- name: Install just - name: Install just
uses: taiki-e/install-action@just uses: taiki-e/install-action@just
- name: Install requirements - name: Install requirements
run: just ci-prepare run: sudo env PATH=$PATH just ci-prepare
- name: Download youki binary - name: Download youki binary
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
@ -127,4 +126,4 @@ jobs:
- name: Build - name: Build
run: just runtimetest rust-oci-tests-bin run: just runtimetest rust-oci-tests-bin
- name: Validate tests on youki - name: Validate tests on youki
run: just rust-oci-tests run: just rust-oci-tests

@ -40,7 +40,7 @@ jobs:
- name: Install just - name: Install just
uses: taiki-e/install-action@just uses: taiki-e/install-action@just
- name: Install requirements - name: Install requirements
run: just ci-prepare run: sudo env PATH=$PATH just ci-prepare
- name: Install runc 1.1.0 - name: Install runc 1.1.0
run: | run: |
wget -q https://github.com/opencontainers/runc/releases/download/v1.1.0/runc.amd64 wget -q https://github.com/opencontainers/runc/releases/download/v1.1.0/runc.amd64

@ -45,7 +45,7 @@ jobs:
- uses: taiki-e/install-action@just - uses: taiki-e/install-action@just
- name: Install requirements - name: Install requirements
run: just ci-prepare run: sudo env PATH=$PATH just ci-prepare
- name: Check formatting and lints - name: Check formatting and lints
run: just lint run: just lint
@ -61,7 +61,7 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1 uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: taiki-e/install-action@just - uses: taiki-e/install-action@just
- name: Install requirements - name: Install requirements
run: just ci-prepare run: sudo env PATH=$PATH just ci-prepare
- name: Run tests - name: Run tests
run: | run: |
export LD_LIBRARY_PATH=$HOME/.wasmedge/lib export LD_LIBRARY_PATH=$HOME/.wasmedge/lib
@ -85,7 +85,7 @@ jobs:
tool: cargo-llvm-cov@0.4.0 tool: cargo-llvm-cov@0.4.0
- uses: taiki-e/install-action@just - uses: taiki-e/install-action@just
- name: Install requirements - name: Install requirements
run: just ci-prepare run: sudo env PATH=$PATH just ci-prepare
- name: Run Test Coverage for youki - name: Run Test Coverage for youki
run: | run: |
cargo llvm-cov clean --workspace cargo llvm-cov clean --workspace

@ -1,7 +1,7 @@
alias build := youki-release alias build := youki-release
alias youki := youki-dev alias youki := youki-dev
ROOT := `git rev-parse --show-toplevel` KIND_CLUSTER_NAME := 'youki'
# build # build
@ -10,19 +10,19 @@ build-all: youki-release rust-oci-tests-bin runtimetest
# build youki in dev mode # build youki in dev mode
youki-dev: youki-dev:
./scripts/build.sh -o {{ ROOT }} -c youki {{ justfile_directory() }}/scripts/build.sh -o {{ justfile_directory() }} -c youki
# build youki in release mode # build youki in release mode
youki-release: youki-release:
./scripts/build.sh -o {{ ROOT }} -r -c youki {{ justfile_directory() }}/scripts/build.sh -o . -r -c youki
# build runtimetest binary # build runtimetest binary
runtimetest: runtimetest:
./scripts/build.sh -o {{ ROOT }} -r -c runtimetest {{ justfile_directory() }}/scripts/build.sh -o . -r -c runtimetest
# build rust oci tests binary # build rust oci tests binary
rust-oci-tests-bin: rust-oci-tests-bin:
./scripts/build.sh -o {{ ROOT }} -r -c integration-test {{ justfile_directory() }}/scripts/build.sh -o {{ justfile_directory() }} -r -c integration-test
# Tests # Tests
@ -43,11 +43,11 @@ featuretest:
# run oci integration tests # run oci integration tests
oci-tests: oci-tests:
./scripts/oci_integration_tests.sh {{ ROOT }} ./scripts/oci_integration_tests.sh {{ justfile_directory() }}
# run rust oci integration tests # run rust oci integration tests
rust-oci-tests: youki-release runtimetest rust-oci-tests-bin rust-oci-tests: youki-release runtimetest rust-oci-tests-bin
./scripts/rust_integration_tests.sh {{ ROOT }}/youki ./scripts/rust_integration_tests.sh ./youki
# validate rust oci integration tests on runc # validate rust oci integration tests on runc
validate-rust-oci-runc: runtimetest rust-oci-tests-bin validate-rust-oci-runc: runtimetest rust-oci-tests-bin
@ -55,8 +55,37 @@ validate-rust-oci-runc: runtimetest rust-oci-tests-bin
# run containerd integration tests # run containerd integration tests
containerd-test: youki-dev containerd-test: youki-dev
VAGRANT_VAGRANTFILE=Vagrantfile.containerd2youki vagrant up VAGRANT_VAGRANTFILE=Vagrantfile.containerd2youki vagrant up
VAGRANT_VAGRANTFILE=Vagrantfile.containerd2youki vagrant provision --provision-with test VAGRANT_VAGRANTFILE=Vagrantfile.containerd2youki vagrant provision --provision-with test
[private]
kind-cluster: bin-kind
#!/usr/bin/env bash
set -euxo pipefail
mkdir -p tests/k8s/_out/
docker buildx build -f tests/k8s/Dockerfile --iidfile=tests/k8s/_out/img --load .
image=$(cat tests/k8s/_out/img)
bin/kind create cluster --name {{ KIND_CLUSTER_NAME }} --image=$image
# run youki with kind
test-kind: kind-cluster
kubectl --context=kind-{{ KIND_CLUSTER_NAME }} apply -f tests/k8s/deploy.yaml
kubectl --context=kind-{{ KIND_CLUSTER_NAME }} wait deployment nginx-deployment --for condition=Available=True --timeout=90s
kubectl --context=kind-{{ KIND_CLUSTER_NAME }} get pods -o wide
kubectl --context=kind-{{ KIND_CLUSTER_NAME }} delete -f tests/k8s/deploy.yaml
# Bin
[private]
bin-kind:
docker buildx build --output=bin/ -f tests/k8s/Dockerfile --target kind-bin .
# Clean
# Clean kind test env
clean-test-kind:
kind delete cluster --name {{ KIND_CLUSTER_NAME }}
# misc # misc
@ -79,7 +108,7 @@ format:
# cleans up generated artifacts # cleans up generated artifacts
clean: clean:
./scripts/clean.sh {{ ROOT }} ./scripts/clean.sh .
# install tools used in dev # install tools used in dev
dev-prepare: dev-prepare:
@ -95,8 +124,8 @@ ci-prepare:
source /etc/lsb-release source /etc/lsb-release
if [[ $DISTRIB_ID == "Ubuntu" ]]; then if [[ $DISTRIB_ID == "Ubuntu" ]]; then
echo "System is Ubuntu" echo "System is Ubuntu"
sudo apt-get -y update apt-get -y update
sudo apt-get install -y \ apt-get install -y \
pkg-config \ pkg-config \
libsystemd-dev \ libsystemd-dev \
libdbus-glib-1-dev \ libdbus-glib-1-dev \
@ -111,4 +140,4 @@ ci-prepare:
fi fi
echo "Unknown system. The CI is only configured for Ubuntu. You will need to forge your own path. Good luck!" echo "Unknown system. The CI is only configured for Ubuntu. You will need to forge your own path. Good luck!"
exit 1 exit 1

@ -30,7 +30,9 @@ echo ' [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.youki.options]
echo ' BinaryName = "/usr/local/bin/youki"' >> /etc/containerd/config.toml echo ' BinaryName = "/usr/local/bin/youki"' >> /etc/containerd/config.toml
sed -i 's,SystemdCgroup = true,,' /etc/containerd/config.toml sed -i 's,SystemdCgroup = true,,' /etc/containerd/config.toml
EOF EOF
COPY .github/scripts/dependency.sh .github/scripts/dependency.sh COPY justfile justfile
RUN apt-get update && .github/scripts/dependency.sh RUN curl -o just.tar.gz -L https://github.com/casey/just/releases/download/1.14.0/just-1.14.0-x86_64-unknown-linux-musl.tar.gz
RUN tar zxvf just.tar.gz just
RUN ./just ci-prepare
COPY --link --from=shim /* /usr/local/bin/ COPY --link --from=shim /* /usr/local/bin/

@ -21,6 +21,6 @@ spec:
runtimeClassName: youki runtimeClassName: youki
containers: containers:
- name: nginx - name: nginx
image: nginx:1.16.1 image: nginx:alpine
ports: ports:
- containerPort: 80 - containerPort: 80