different approach #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
kind: | |
image: kindest/node:v1.30.0 | |
options: --privileged | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.22' | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Install kubectl | |
run: | | |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | |
chmod +x kubectl | |
sudo mv kubectl /usr/local/bin/ | |
- name: Set up kind | |
run: | | |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64 | |
chmod +x ./kind | |
sudo mv ./kind /usr/local/bin/kind | |
- name: Create Kubernetes cluster | |
run: kind create cluster --wait 5m | |
- name: Apply test PVC and pod | |
run: | | |
kubectl apply -f pkg/plugin/test/pvc.yaml | |
kubectl apply -f pkg/plugin/test/test-pod.yaml | |
- name: Install sshfs | |
run: sudo apt-get update && sudo apt-get install -y sshfs --no-install-recommends --no-install-suggests | |
- name: Build pv-mounter | |
run: | | |
make bin | |
- name: Create mountpoint | |
run: mkdir foo | |
- name: Check PVC status | |
run: | | |
kubectl get pvc | |
kubectl get pvc test-pvc -o yaml | |
- name: Check pod status | |
run: kubectl get pod test-pod -o yaml | |
# - name: Wait for PVC to be bound | |
# run: kubectl wait --for=condition=Bound pvc/test-pvc --timeout=2m | |
- name: Run tests | |
run: | | |
./bin/pv-mounter mount default test-pvc foo | |
touch foo/dupa | |
ls -l foo/dupa | |
./bin/pv-mounter clean default test-pvc foo | |
# env: | |
# KUBECONFIG: ${{ secrets.KUBECONFIG }} | |
# run: go test -v ./pkg/plugin | |
- name: Delete pod and PVC | |
run: | | |
kubectl delete -f pkg/plugin/test/test-pod.yaml | |
kubectl delete -f pkg/plugin/test/pvc.yaml | |
- name: Delete cluster | |
run: kind delete cluster | |