Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: split ci into separate steps #292

Merged
merged 8 commits into from
May 15, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💪


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
Comment on lines +10 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we also avoid running this for external PRs? I guess what's our full intent?

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/[email protected]

Expand Down