|
| 1 | +name: Smoke tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + |
| 6 | +jobs: |
| 7 | + smoke-tests: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - name: Checkout code |
| 11 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 12 | + |
| 13 | + - name: Setup Go |
| 14 | + uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 |
| 15 | + with: |
| 16 | + go-version-file: "go.mod" |
| 17 | + |
| 18 | + - name: Write config file |
| 19 | + run: | |
| 20 | + cat <<EOF > kind-config.yaml |
| 21 | + apiVersion: kind.x-k8s.io/v1alpha4 |
| 22 | + kind: Cluster |
| 23 | + kubeadmConfigPatches: |
| 24 | + - | |
| 25 | + kind: ClusterConfiguration |
| 26 | + apiServer: |
| 27 | + extraArgs: |
| 28 | + "service-node-port-range": "30000-30005" |
| 29 | + nodes: |
| 30 | + - role: control-plane |
| 31 | + extraPortMappings: |
| 32 | + - containerPort: 30000 |
| 33 | + hostPort: 30000 |
| 34 | + - containerPort: 30001 |
| 35 | + hostPort: 30001 |
| 36 | + - containerPort: 30002 |
| 37 | + hostPort: 30002 |
| 38 | + - containerPort: 30003 |
| 39 | + hostPort: 30003 |
| 40 | + - containerPort: 30004 |
| 41 | + hostPort: 30004 |
| 42 | + - containerPort: 30005 |
| 43 | + hostPort: 30005 |
| 44 | + networking: |
| 45 | + disableDefaultCNI: true |
| 46 | + EOF |
| 47 | + - name: Set up Kind cluster |
| 48 | + uses: helm/kind-action@92086f6be054225fa813e0a4b13787fc9088faab # v1.13.0 |
| 49 | + with: |
| 50 | + config: kind-config.yaml |
| 51 | + cluster_name: kind |
| 52 | + env: |
| 53 | + KIND_EXPERIMENTAL_DOCKER_NETWORK: kind |
| 54 | + |
| 55 | + - name: Patch local-path to mount shared filesystem path on the single kind node |
| 56 | + run: | |
| 57 | + # From https://github.com/kubernetes-sigs/kind/issues/1487#issuecomment-2211072952 |
| 58 | + kubectl -n local-path-storage patch configmap local-path-config -p '{"data": {"config.json": "{\n\"sharedFileSystemPath\": \"/var/local-path-provisioner\"\n}"}}' |
| 59 | +
|
| 60 | + - name: Setup Cilium as Kind CNI |
| 61 | + run: | |
| 62 | + # See https://docs.cilium.io/en/stable/installation/kind/#install-cilium |
| 63 | + helm repo add cilium https://helm.cilium.io/ |
| 64 | +
|
| 65 | + helm install cilium cilium/cilium --version 1.19.1 \ |
| 66 | + --namespace kube-system \ |
| 67 | + --set image.pullPolicy=IfNotPresent \ |
| 68 | + --set ipam.mode=kubernetes |
| 69 | +
|
| 70 | + - name: Setup CNPG |
| 71 | + run: | |
| 72 | + helm repo add cnpg https://cloudnative-pg.github.io/charts |
| 73 | + helm upgrade --install cnpg \ |
| 74 | + --namespace cnpg-system \ |
| 75 | + --create-namespace \ |
| 76 | + cnpg/cloudnative-pg |
| 77 | +
|
| 78 | + - name: Install Pulumi |
| 79 | + uses: pulumi/actions@8582a9e8cc630786854029b4e09281acd6794b58 # v6.6.1 |
| 80 | + - name: Prepare environment |
| 81 | + run: | |
| 82 | + pulumi login --local |
| 83 | +
|
| 84 | + - name: Run Smoke Tests |
| 85 | + run: | |
| 86 | + mkdir coverdir # Directory in which coverage data are exported |
| 87 | + go test -v ./smoke/ -run=^Test_S_ -timeout=30m |
| 88 | +
|
| 89 | + - name: Merge coverages |
| 90 | + run: | |
| 91 | + go tool covdata textfmt -i=coverdir -o=smoke.cov |
| 92 | +
|
| 93 | + # Point back to the actual Go module tested. |
| 94 | + # It cannot be inferred, leading to this highly precise step. |
| 95 | + sed -i 's|^/home/runner/work/ctfer/ctfer|github.com/ctfer-io/ctfer|' smoke.cov |
| 96 | +
|
| 97 | + - name: Upload smoke tests coverage |
| 98 | + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 |
| 99 | + with: |
| 100 | + name: smoke.cov |
| 101 | + path: smoke.cov |
0 commit comments