From 93c6a5e85a005907cde93f8f7c01961e8120f7eb Mon Sep 17 00:00:00 2001 From: James Munnelly Date: Sun, 15 Dec 2019 21:51:22 +0000 Subject: [PATCH 1/5] Create basic GitHub action workflow --- .github/workflows/presubmit.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/presubmit.yml diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml new file mode 100644 index 0000000..8fa29f9 --- /dev/null +++ b/.github/workflows/presubmit.yml @@ -0,0 +1,26 @@ +name: Go +on: [pull_request] +jobs: + + build: + name: Build + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.12 + uses: actions/setup-go@v1 + with: + go-version: 1.12 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v1 + + - name: Get kubebuilder + run: | + mkdir -p /usr/local/kubebuilder + curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v1.0.8/kubebuilder_1.0.8_linux_amd64.tar.gz | \ + tar -C /usr/local/kubebuilder xvf - + + - name: Run tests + run: make test From bf3467858e7d66acff1fa2909aa90737a9226bea Mon Sep 17 00:00:00 2001 From: James Munnelly Date: Sun, 15 Dec 2019 21:53:22 +0000 Subject: [PATCH 2/5] Add sudo when installing kubebuilder --- .github/workflows/presubmit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index 8fa29f9..f4ef2e6 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -18,9 +18,9 @@ jobs: - name: Get kubebuilder run: | - mkdir -p /usr/local/kubebuilder + sudo mkdir -p /usr/local/kubebuilder curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v1.0.8/kubebuilder_1.0.8_linux_amd64.tar.gz | \ - tar -C /usr/local/kubebuilder xvf - + sudo tar -C /usr/local/kubebuilder xvf - - name: Run tests run: make test From f33ce0d320761edba1ccd4b06868adf12d30e739 Mon Sep 17 00:00:00 2001 From: James Munnelly Date: Sun, 15 Dec 2019 21:55:16 +0000 Subject: [PATCH 3/5] Update presubmit.yml --- .github/workflows/presubmit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index f4ef2e6..6f5a7c5 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -20,7 +20,7 @@ jobs: run: | sudo mkdir -p /usr/local/kubebuilder curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v1.0.8/kubebuilder_1.0.8_linux_amd64.tar.gz | \ - sudo tar -C /usr/local/kubebuilder xvf - + sudo tar -xvfC /usr/local/kubebuilder - - name: Run tests run: make test From d52888cd9ab0f76eda3994581f5d4691c7f2cf69 Mon Sep 17 00:00:00 2001 From: James Munnelly Date: Sun, 15 Dec 2019 21:59:19 +0000 Subject: [PATCH 4/5] Update presubmit.yml --- .github/workflows/presubmit.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index 6f5a7c5..a884b51 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -18,9 +18,18 @@ jobs: - name: Get kubebuilder run: | - sudo mkdir -p /usr/local/kubebuilder - curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v1.0.8/kubebuilder_1.0.8_linux_amd64.tar.gz | \ - sudo tar -xvfC /usr/local/kubebuilder - + version=1.0.8 # latest stable version + arch=amd64 + + # download the release + curl -L -O "https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${version}/kubebuilder_${version}_darwin_${arch}.tar.gz" + + # extract the archive + tar -zxvf kubebuilder_${version}_darwin_${arch}.tar.gz + mv kubebuilder_${version}_darwin_${arch} kubebuilder && sudo mv kubebuilder /usr/local/ + + # update your PATH to include /usr/local/kubebuilder/bin + export PATH=$PATH:/usr/local/kubebuilder/bin - name: Run tests run: make test From 0f11764f9c4f8503b9c05c01e6c8968447fd9fdd Mon Sep 17 00:00:00 2001 From: James Munnelly Date: Sun, 15 Dec 2019 22:01:05 +0000 Subject: [PATCH 5/5] Update presubmit.yml --- .github/workflows/presubmit.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index a884b51..0d0231f 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -32,4 +32,6 @@ jobs: export PATH=$PATH:/usr/local/kubebuilder/bin - name: Run tests - run: make test + run: | + export GOPATH=$(go env GOPATH) + make test