Skip to content

Commit

Permalink
chore: split ci into separate steps (#292)
Browse files Browse the repository at this point in the history
* chore: split ci into separate steps

* chore: remove duplicate runs

* chore: run lint with test

* chore: apply skip logic to goreleaser

* test: fix integration settings

Co-authored-by: Cyril David <cyx@users.noreply.github.com>
  • Loading branch information
as-herzog and cyx authored May 15, 2021
1 parent 1e4d4b4 commit cb3a6d4
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 15 deletions.
63 changes: 52 additions & 11 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: Go
on:
pull_request:
push:
on: [push, pull_request]
jobs:

build:
name: Build
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.
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
Expand All @@ -20,12 +21,29 @@ 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

- name: run unit tests
run: PATH=$(go env GOPATH)/bin:$PATH make test

integration:
name: Integration Test
runs-on: ubuntu-latest
# skip running this action if the PR is coming from a fork:
if: 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: integration
# skip running this action if the PR is coming from a fork:
if: github.event.pull_request.head.repo.full_name == github.repository
- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: run integration tests
shell: bash
run: PATH=$(go env GOPATH)/bin:$PATH make integration
env:
Expand All @@ -35,3 +53,26 @@ 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
# 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
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
3 changes: 3 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit cb3a6d4

Please sign in to comment.