From 0e5ed3f551f31a5ef86273861dd4856d4e29717c Mon Sep 17 00:00:00 2001 From: Nir Soffer Date: Thu, 12 Sep 2024 22:40:35 +0300 Subject: [PATCH] Add macOS CI Add basic tests for drenv skipping the tests requiring a test cluster which we cannot use yet. Github provides Intel based macOS runners supporting nested virtualization. We can start a lima vm but it always get stuck waiting for ssh connection to the guest. We can try to fix this later, but for now we can run all the test that do not require a test cluster by skipping the tests. Signed-off-by: Nir Soffer --- .github/workflows/ci.yaml | 74 ++++++++++++++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8b99fe290..3c6a6eaf8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -27,7 +27,6 @@ env: IMAGE_REGISTRY: "quay.io" IMAGE_TAG: "ci" DOCKERCMD: "podman" - DRIVER: "container" defaults: run: shell: bash @@ -109,17 +108,21 @@ jobs: - name: Run unit tests run: make test - drenv-test: - name: drenv tests - runs-on: ubuntu-22.04 + drenv-linux: + name: drenv strategy: matrix: + os: + - ubuntu-22.04 python-version: - "3.9" - "3.10" - "3.11" - "3.12" - "3.13-dev" + runs-on: ${{ matrix.os }} + env: + DRIVER: "container" steps: - name: Checkout source uses: actions/checkout@v4 @@ -178,17 +181,72 @@ jobs: run: make clean working-directory: test - ramenctl-test: - name: ramenctl tests - runs-on: ubuntu-22.04 + drenv-macos: + name: drenv + strategy: + matrix: + os: + # arm64, 3 cpus (M1), 7 GiB RAM, no nested virtalization. + - macos-14 + python-version: + - "3.12" + runs-on: ${{ matrix.os }} + steps: + - name: Checkout ramen + uses: actions/checkout@v4 + + - name: Setup python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install python packages + run: pip install -r requirements.txt + + - name: Enable coverage for child processes + run: cp coverage.pth $(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])') + + - name: Install drenv + run: pip install -e test + + - name: Run flake8 + run: make flake8 + working-directory: test + + - name: Run pylint + run: make pylint + working-directory: test + + - name: Run black + run: make black + working-directory: test + + - name: Run tests + # We cannot run the test cluster on macOS. + run: make unit-test + working-directory: test + + - name: Report test coverage + run: make coverage + working-directory: test + + ramenctl: + name: ramenctl strategy: matrix: + os: + - ubuntu-22.04 python-version: - "3.9" - "3.10" - "3.11" - "3.12" - "3.13-dev" + include: + # arm64, 3 cpus (M1), 7 GiB RAM, no nested virtalization. + - os: macos-14 + python-version: "3.12" + runs-on: ${{ matrix.os }} steps: - name: Checkout source uses: actions/checkout@v4 @@ -198,7 +256,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Install tools + - name: Install python packages run: pip install -r requirements.txt - name: Install drenv