Skip to content

Add staticcheck linter #1337

Add staticcheck linter

Add staticcheck linter #1337

Workflow file for this run

name: Functional Tests
on:
push:
branches: [ master, v4.0 ]
pull_request:
branches: [ master, v4.0 ]
# This ensures that previous jobs for the PR are canceled when the PR is
# updated.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
build:
name: Testing on Kubernetes ${{ matrix.kube-version }} in ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
matrix:
kube-version: ['v1.20.15', 'v1.21.14', 'v1.22.17', 'v1.23.17', 'v1.24.17', 'v1.25.16', 'v1.26.15', 'v1.27.16', 'v1.28.15', 'v1.29.11', 'v1.30.7', 'v1.31.3']
os: [ubuntu-20.04, ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.23.x
check-latest: true
- name: Install dependencies
run: |
sudo apt-get update
- name: Set environment
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
mkdir -p "$(go env GOPATH)/src/github.com/minio/"
ln -s "$PWD" "$(go env GOPATH)/src/github.com/minio/directpv"
echo "VERSION=$(git describe --tags --always --dirty)" >> $GITHUB_ENV
# To Fix: chmod: cannot access '/etc/cni/net.d': No such file or directory
sudo mkdir -p /etc/cni/net.d
- name: Build binaries
env:
CGO_ENABLED: 0
GO111MODULE: on
run: |
go build -tags "osusergo netgo static_build" -ldflags="-X main.Version=${VERSION} -extldflags=-static" github.com/minio/directpv/cmd/directpv
go build -tags "osusergo netgo static_build" -ldflags="-X main.Version=${VERSION} -extldflags=-static" github.com/minio/directpv/cmd/kubectl-directpv
- name: Build docker image
run: |
docker build --quiet -t quay.io/minio/directpv:${VERSION} .
docker build --quiet -t example.org/test/sleep:v0.0.1 -f functests/Dockerfile.sleep functests
- name: Setup Minikube
uses: medyagh/setup-minikube@latest
with:
driver: none
kubernetes-version: ${{ matrix.kube-version }}
- name: Check Minikube
run: |
kubectl get nodes
kubectl get pods -A
while kubectl get pods -n kube-system --no-headers | grep -vqw Running; do echo "Waiting for Minikube pods to be ready"; sleep 3; done
while kubectl get nodes --no-headers | grep -vqw Ready; do echo "Waiting for Minikube node to be ready"; sleep 3; done
- name: Run tests
run: |
functests/run-tests.sh
- name: Run migration tests with DirectCSI v3.2.2
run: |
sudo rm -fr /var/lib/directpv
functests/run-migration-tests.sh "v3.2.2"
- name: Run migration tests with DirectCSI v2.0.9
if: contains(fromJson('["v1.20.15", "v1.21.14", "v1.22.17"]'), matrix.kube-version)
run: |
sudo rm -fr /var/lib/directpv /var/lib/direct-csi
functests/run-migration-tests.sh "v2.0.9"