|
| 1 | +name: Run E2E Test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, release-*] |
| 6 | + paths-ignore: ['**.md', '**.png', '**.jpg', '**.svg', '**/docs/**'] |
| 7 | + pull_request: |
| 8 | + branches: [main, release-*] |
| 9 | + paths-ignore: ['**.md', '**.png', '**.jpg', '**.svg', '**/docs/**'] |
| 10 | + schedule: |
| 11 | + - cron: '0 4 * * *' |
| 12 | + |
| 13 | +jobs: |
| 14 | + run-e2e-test: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout code |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Cache Go modules |
| 22 | + uses: actions/cache@v4 |
| 23 | + with: |
| 24 | + path: | |
| 25 | + ~/.cache/go-build |
| 26 | + ~/go/pkg/mod |
| 27 | + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 28 | + restore-keys: | |
| 29 | + ${{ runner.os }}-go- |
| 30 | +
|
| 31 | + - name: Cache Docker layers |
| 32 | + uses: actions/cache@v4 |
| 33 | + with: |
| 34 | + path: /tmp/.buildx-cache |
| 35 | + key: ${{ runner.os }}-docker-buildx-${{ github.sha }} |
| 36 | + restore-keys: | |
| 37 | + ${{ runner.os }}-docker-buildx- |
| 38 | +
|
| 39 | + - name: Set up QEMU |
| 40 | + uses: docker/setup-qemu-action@v3 |
| 41 | + |
| 42 | + - name: Set up Docker Buildx |
| 43 | + uses: docker/setup-buildx-action@v3 |
| 44 | + |
| 45 | + - name: Build Docker Image |
| 46 | + uses: docker/build-push-action@v5 |
| 47 | + with: |
| 48 | + context: . |
| 49 | + file: build/Dockerfile |
| 50 | + build-args: | |
| 51 | + HOME=${{ env.HOME }} |
| 52 | + tags: model-csi-driver:latest |
| 53 | + load: true |
| 54 | + push: false |
| 55 | + cache-from: type=local,src=/tmp/.buildx-cache |
| 56 | + cache-to: type=local,dest=/tmp/.buildx-cache-new |
| 57 | + |
| 58 | + - name: Move Docker Build Cache |
| 59 | + run: | |
| 60 | + rm -rf /tmp/.buildx-cache |
| 61 | + mv /tmp/.buildx-cache-new /tmp/.buildx-cache || true |
| 62 | +
|
| 63 | + - name: Install Kind |
| 64 | + run: | |
| 65 | + curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.30.0/kind-linux-amd64 |
| 66 | + chmod +x ./kind |
| 67 | + sudo mv ./kind /usr/local/bin/kind |
| 68 | +
|
| 69 | + - name: Create Kind Cluster |
| 70 | + run: | |
| 71 | + kind create cluster --wait 120s |
| 72 | +
|
| 73 | + - name: Load docker image into kind |
| 74 | + run: | |
| 75 | + kind load docker-image model-csi-driver:latest |
| 76 | +
|
| 77 | + - name: Load docker image into kind |
| 78 | + run: | |
| 79 | + kind load docker-image model-csi-driver:latest |
| 80 | +
|
| 81 | + - name: Install Helm |
| 82 | + run: | |
| 83 | + curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash |
| 84 | +
|
| 85 | + - name: Check cluster and helm |
| 86 | + run: | |
| 87 | + kubectl get nodes |
| 88 | + kubectl cluster-info |
| 89 | + helm version |
| 90 | +
|
| 91 | + - name: Deploy model-csi-driver chart |
| 92 | + run: | |
| 93 | + helm upgrade --install model-csi-driver ./charts/model-csi-driver --namespace model-csi --create-namespace |
| 94 | +
|
| 95 | + - name: Wait for model-csi-driver pods to be ready |
| 96 | + run: | |
| 97 | + kubectl wait --for=condition=Ready pods --all --namespace model-csi --timeout=120s |
| 98 | + |
| 99 | + - name: Run Test Pod |
| 100 | + run: | |
| 101 | + kubectl apply -f test/testdata/pod.test.yaml |
| 102 | + kubectl wait --for=condition=Ready pod/model-csi-driver-test --timeout=120s |
| 103 | + kubectl delete pod model-csi-driver-test |
| 104 | +
|
| 105 | + # # Keep for debug purpose |
| 106 | + # - name: Start tmate session |
| 107 | + # uses: mxschmitt/action-tmate@v3 |
0 commit comments