From 95583088a206681ad1be8843c0224ef837820cd5 Mon Sep 17 00:00:00 2001 From: Andy Herzog Date: Fri, 14 May 2021 15:12:56 -0600 Subject: [PATCH 1/5] chore: split ci into separate steps --- .github/workflows/go.yml | 62 ++++++++++++++++++++++++++++++++++------ Makefile | 4 --- 2 files changed, 54 insertions(+), 12 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 7f83dfa02..72c0a5421 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,11 +1,9 @@ name: Go -on: - pull_request: - push: +on: [push, pull_request] jobs: - build: - name: Build + lint: + name: Lint runs-on: ubuntu-latest steps: - name: Set up Go 1.16 @@ -20,10 +18,39 @@ jobs: - name: Install golanglint-ci run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.37.1 - - name: ci - run: PATH=$(go env GOPATH)/bin:$PATH make ci + - name: lint + run: PATH=$(go env GOPATH)/bin:$PATH make lint + + unit: + name: Unit Test + runs-on: ubuntu-latest + steps: + - name: Set up Go 1.16 + uses: actions/setup-go@v1 + with: + go-version: 1.16 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: run unit tests + run: PATH=$(go env GOPATH)/bin:$PATH make test + + integration: + name: Integration Test + runs-on: ubuntu-latest + steps: + - name: Set up Go 1.16 + uses: actions/setup-go@v1 + with: + go-version: 1.16 + id: go - - name: integration + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: run integration tests # skip running this action if the PR is coming from a fork: if: github.event.pull_request.head.repo.full_name == github.repository shell: bash @@ -35,3 +62,22 @@ jobs: AUTH0_CLI_CLIENT_SECRET: ${{ secrets.AUTH0_CLI_CLIENT_SECRET }} AUTH0_CLI_REUSE_CONFIG: ${{ secrets.AUTH0_CLI_REUSE_CONFIG }} AUTH0_CLI_OVERWRITE: ${{ secrets.AUTH0_CLI_OVERWRITE }} + + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Set up Go 1.16 + uses: actions/setup-go@v1 + with: + go-version: 1.16 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Install golanglint-ci + run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.37.1 + + - name: ci + run: PATH=$(go env GOPATH)/bin:$PATH make build-all-platforms \ No newline at end of file diff --git a/Makefile b/Makefile index a70e37b1d..50a7ba7b6 100644 --- a/Makefile +++ b/Makefile @@ -48,10 +48,6 @@ build-all-platforms: env GOOS=windows go build -ldflags "$(CTIMEVAR)" -o auth0-windows.exe cmd/auth0/main.go .PHONY: build-all-platforms -# Run all the tests and code checks -ci: build-all-platforms test lint -.PHONY: ci - $(GOBIN)/mockgen: @cd && GO111MODULE=on go get github.com/golang/mock/mockgen@v1.4.4 From f469570fa44625c8808a196166c44a67e6065a05 Mon Sep 17 00:00:00 2001 From: Andy Herzog Date: Fri, 14 May 2021 15:24:02 -0600 Subject: [PATCH 2/5] chore: remove duplicate runs --- .github/workflows/go.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 72c0a5421..69e55f7ca 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -5,6 +5,10 @@ jobs: lint: name: Lint runs-on: ubuntu-latest + # We want to run on external PRs, but not on our own internal PRs as they'll be run + # by the push to the branch. + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + steps: - name: Set up Go 1.16 uses: actions/setup-go@v1 @@ -24,6 +28,8 @@ jobs: unit: name: Unit Test runs-on: ubuntu-latest + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + steps: - name: Set up Go 1.16 uses: actions/setup-go@v1 @@ -40,6 +46,9 @@ jobs: integration: name: Integration Test runs-on: ubuntu-latest + # skip running this action if the PR is coming from a fork: + if: github.event_name == 'push' && github.event.pull_request.head.repo.full_name == github.repository + steps: - name: Set up Go 1.16 uses: actions/setup-go@v1 @@ -51,8 +60,6 @@ jobs: uses: actions/checkout@v2 - name: run integration tests - # skip running this action if the PR is coming from a fork: - if: github.event.pull_request.head.repo.full_name == github.repository shell: bash run: PATH=$(go env GOPATH)/bin:$PATH make integration env: @@ -66,6 +73,10 @@ jobs: build: name: Build runs-on: ubuntu-latest + # We want to run on external PRs, but not on our own internal PRs as they'll be run + # by the push to the branch. + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + steps: - name: Set up Go 1.16 uses: actions/setup-go@v1 From 4e71252a54c1191cdc1796171217fba8572079cc Mon Sep 17 00:00:00 2001 From: Andy Herzog Date: Fri, 14 May 2021 15:35:54 -0600 Subject: [PATCH 3/5] chore: run lint with test --- .github/workflows/go.yml | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 69e55f7ca..b2cfb86f2 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,9 +1,8 @@ name: Go on: [push, pull_request] jobs: - - lint: - name: Lint + unit: + name: Unit Test runs-on: ubuntu-latest # We want to run on external PRs, but not on our own internal PRs as they'll be run # by the push to the branch. @@ -25,21 +24,6 @@ jobs: - name: lint run: PATH=$(go env GOPATH)/bin:$PATH make lint - unit: - name: Unit Test - runs-on: ubuntu-latest - if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository - - steps: - - name: Set up Go 1.16 - uses: actions/setup-go@v1 - with: - go-version: 1.16 - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - name: run unit tests run: PATH=$(go env GOPATH)/bin:$PATH make test From c00689e4b9485049c2883c8baede3874bcc7f250 Mon Sep 17 00:00:00 2001 From: Andy Herzog Date: Fri, 14 May 2021 15:40:50 -0600 Subject: [PATCH 4/5] chore: apply skip logic to goreleaser --- .github/workflows/goreleaser.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 1ea7b82db..0ae3bc930 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -7,6 +7,9 @@ on: jobs: goreleaser: runs-on: ubuntu-latest + # We want to run on external PRs, but not on our own internal PRs as they'll be run + # by the push to the branch. + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository steps: - name: Checkout uses: actions/checkout@v2 From fe54fb45bb9dc8ca59d005e873e2f674cc5bd618 Mon Sep 17 00:00:00 2001 From: Andy Herzog Date: Fri, 14 May 2021 15:56:58 -0600 Subject: [PATCH 5/5] test: fix integration settings --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index b2cfb86f2..ca4222d39 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -31,7 +31,7 @@ jobs: name: Integration Test runs-on: ubuntu-latest # skip running this action if the PR is coming from a fork: - if: github.event_name == 'push' && github.event.pull_request.head.repo.full_name == github.repository + if: github.event.pull_request.head.repo.full_name == github.repository steps: - name: Set up Go 1.16