Test gomod2 #141
Workflow file for this run
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: 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.27.0; 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 -; 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_2.3.1_linux_amd64/bin --with-kubectl=${{ github.workspace }}/kubebuilder_2.3.1_linux_amd64/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 |