Skip to content

Commit

Permalink
Merge pull request #2027 from utam0k/ci-kind
Browse files Browse the repository at this point in the history
Add the test with kind to github action
  • Loading branch information
utam0k authored Jun 11, 2023
2 parents a49d14c + 51ac26a commit 2bd6ebc
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 41 deletions.
41 changes: 20 additions & 21 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/integration_tests_validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
55 changes: 42 additions & 13 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
alias build := youki-release
alias youki := youki-dev

ROOT := `git rev-parse --show-toplevel`
KIND_CLUSTER_NAME := 'youki'

# build

Expand All @@ -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

Expand All @@ -43,20 +43,49 @@ 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
./scripts/rust_integration_tests.sh runc

# 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

Expand All @@ -79,7 +108,7 @@ format:

# cleans up generated artifacts
clean:
./scripts/clean.sh {{ ROOT }}
./scripts/clean.sh .

# install tools used in dev
dev-prepare:
Expand All @@ -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 \
Expand All @@ -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
6 changes: 4 additions & 2 deletions tests/k8s/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/

2 changes: 1 addition & 1 deletion tests/k8s/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ spec:
runtimeClassName: youki
containers:
- name: nginx
image: nginx:1.16.1
image: nginx:alpine
ports:
- containerPort: 80

0 comments on commit 2bd6ebc

Please # to comment.