Skip to content

Test gomod2

Test gomod2 #147

Workflow file for this run

name: Run tests
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.22'
- name: Checkout code
uses: actions/checkout@v2
with:
path: ./src/github.com/${{ github.repository }}
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
./src/github.com/${{ github.repository }}/vendor
~/go/bin
${{ github.workspace }}/kubebuilder_2.3.1_linux_amd64
key: ${{ runner.os }}-build-depcache-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-build-depcache-
- name: Setup test tooling
run: |
GO111MODULE=on go install github.com/onsi/ginkgo/ginkgo@v1.14.2
if ! [[ -x $(go env GOPATH)/bin/golangci-lint ]]; then echo "golangci-lint not found; fetching"; curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.57.2; fi
if ! [[ -d ${{ github.workspace }}/kubebuilder_2.3.1_linux_amd64 ]]; then echo "kubebuilder not found; fetching"; curl -sSfL https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.1/kubebuilder_2.3.1_linux_amd64.tar.gz | tar zxvf -; mkdir -p kubebuilder/1.29.0; mv -v kubebuilder_2.3.1_linux_amd64/bin kubebuilder/1.29.0/; pwd; find kubebuilder; fi
if ! [[ -x $(go env GOPATH)/bin/kustomize ]]; then echo "kustomize not found; fetching"; GO111MODULE=on go install sigs.k8s.io/kustomize/kustomize/v5@latest; fi
- name: Download dependencies
run: |
export GOPATH=$(go env GOPATH):$(pwd)
echo "Running go mod tidy"
cd ./src/github.com/${{ github.repository }}
go mod tidy
- name: Configure
run: |
export GOPATH=$(go env GOPATH)
export PATH=$GOPATH/bin:$PATH
./configure --with-kubebuilder=${{ github.workspace }}/kubebuilder/1.29.0/bin --with-kubectl=${{ github.workspace }}/kubebuilder/1.29.0/bin/kubectl
working-directory: ./src/github.com/${{ github.repository }}
- name: Run Tests
run: |
export GOPATH=$(go env GOPATH):$(pwd)
cd ./src/github.com/${{ github.repository }}
make check