1
0
Fork 0
mirror of https://github.com/containers/youki synced 2024-05-03 22:26:32 +02: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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
alias build := youki-release
alias youki := youki-dev
ROOT := `git rev-parse --show-toplevel`
KIND_CLUSTER_NAME := 'youki'
# build
@ -10,19 +10,19 @@ build-all: youki-release rust-oci-tests-bin runtimetest
# build youki in dev mode
youki-dev:
./scripts/build.sh -o {{ ROOT }} -c youki
{{ justfile_directory() }}/scripts/build.sh -o {{ justfile_directory() }} -c youki
# build youki in release mode
youki-release:
./scripts/build.sh -o {{ ROOT }} -r -c youki
{{ justfile_directory() }}/scripts/build.sh -o . -r -c youki
# build runtimetest binary
runtimetest:
./scripts/build.sh -o {{ ROOT }} -r -c runtimetest
{{ justfile_directory() }}/scripts/build.sh -o . -r -c runtimetest
# build rust oci tests binary
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
@ -43,11 +43,11 @@ featuretest:
# run oci integration tests
oci-tests:
./scripts/oci_integration_tests.sh {{ ROOT }}
./scripts/oci_integration_tests.sh {{ justfile_directory() }}
# run rust oci integration tests
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-runc: runtimetest rust-oci-tests-bin
@ -55,8 +55,37 @@ validate-rust-oci-runc: runtimetest rust-oci-tests-bin
# run containerd integration tests
containerd-test: youki-dev
VAGRANT_VAGRANTFILE=Vagrantfile.containerd2youki vagrant up
VAGRANT_VAGRANTFILE=Vagrantfile.containerd2youki vagrant provision --provision-with test
VAGRANT_VAGRANTFILE=Vagrantfile.containerd2youki vagrant up
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
@ -79,7 +108,7 @@ format:
# cleans up generated artifacts
clean:
./scripts/clean.sh {{ ROOT }}
./scripts/clean.sh .
# install tools used in dev
dev-prepare:
@ -95,8 +124,8 @@ ci-prepare:
source /etc/lsb-release
if [[ $DISTRIB_ID == "Ubuntu" ]]; then
echo "System is Ubuntu"
sudo apt-get -y update
sudo apt-get install -y \
apt-get -y update
apt-get install -y \
pkg-config \
libsystemd-dev \
libdbus-glib-1-dev \
@ -111,4 +140,4 @@ ci-prepare:
fi
echo "Unknown system. The CI is only configured for Ubuntu. You will need to forge your own path. Good luck!"
exit 1
exit 1

View File

@ -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
sed -i 's,SystemdCgroup = true,,' /etc/containerd/config.toml
EOF
COPY .github/scripts/dependency.sh .github/scripts/dependency.sh
RUN apt-get update && .github/scripts/dependency.sh
COPY justfile justfile
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/

View File

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