From 20351b4cdc33bddf985e8ec058b1bdc971f4504e Mon Sep 17 00:00:00 2001 From: Nir Soffer Date: Thu, 19 Sep 2024 21:05:15 +0300 Subject: [PATCH] Run drenv cluster tests On macos-13 runner we can run the test cluster using nested virtualization. Build and install lima and socket_vmnet, and add the missing steps to start the test cluster and run all the tests, including cluster tests. The test cluster is more than 3 times slower on github (10 minutes on github vs 3 minutes locally). The total time of the job is about 15 minutes. Signed-off-by: Nir Soffer --- .github/workflows/ci.yaml | 68 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f58fcf08b..eaa4d847a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -186,8 +186,8 @@ jobs: strategy: matrix: os: - # arm64, 3 cpus (M1), 7 GiB RAM, no nested virtalization. - - macos-14 + # amd64, 4 cpus, 14 GiB RAM, nested virtalization + - macos-13 python-version: - "3.12" runs-on: ${{ matrix.os }} @@ -195,11 +195,52 @@ jobs: - name: Checkout ramen uses: actions/checkout@v4 + - name: Checkout lima + uses: actions/checkout@v4 + with: + repository: lima-vm/lima + path: lima + + - name: Checkout socket_vmnet + uses: actions/checkout@v4 + with: + repository: lima-vm/socket_vmnet + path: socket_vmnet + - name: Setup python uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Setup go for lima + uses: actions/setup-go@v5 + with: + go-version: "1.23" # used by lima-ci + + - name: Install lima + run: | + cd lima + + # Miniaml build is 3 times faster than full make.. + make minimal + + # But it adds only the default template, so lets fix it: + rm -rf _output/share/lima/templates + cp -aL examples _output/share/lima/templates + ln -sf templates _output/share/lima/examples + + # And install + sudo make install + limactl --version + + - name: Install socket_vmnet + run: | + cd socket_vmnet + make + sudo make install.bin + sudo make install.launchd + /opt/socket_vmnet/bin/socket_vmnet --version + - name: Install Homebrew packages run: brew install kubectl @@ -224,15 +265,34 @@ jobs: run: make black working-directory: test + - name: Start test cluster + run: make cluster + working-directory: test + timeout-minutes: 20 # Starts in ~10 minutes + + - name: Show logs on error + if: failure() + run: | + export DIR=$(limactl list --format '{{.Dir}}') + # Don't fail entire step if one log is missing. + for f in ha.stdout.log ha.stderr.log copied-from-guest/kubectl.yaml; do + echo + echo "=== $DIR/$f ===" + cat $DIR/$f || true + done + - name: Run tests - # We cannot run the test cluster on macOS. - run: make unit-test + run: make test working-directory: test - name: Report test coverage run: make coverage working-directory: test + - name: Clean up + run: make clean + working-directory: test + ramenctl: name: ramenctl strategy: