-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#This action is centrally managed in https://github.com/asyncapi/.github/ | ||
#Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo | ||
#It does magic only if there is go.mod file in the root of the project | ||
name: PR testing - if Go project | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize, ready_for_review] | ||
|
||
jobs: | ||
lint: | ||
if: github.event.pull_request.draft == false | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- name: Check if Go project and has go.mod | ||
id: gomod | ||
run: test -e ./go.mod && echo "::set-output name=exists::true" || echo "::set-output name=exists::false" | ||
shell: bash | ||
- if: steps.gomod.outputs.exists == 'true' | ||
name: Setup Go | ||
uses: actions/setup-go@v2.1.3 | ||
with: | ||
go-version: 1.16 | ||
- if: steps.gomod.outputs.exists == 'true' | ||
name: golangci-lint | ||
uses: golangci/golangci-lint-action@v2 # golangci-lint version extracted from go.mod. `latest` if missing. | ||
with: | ||
skip-go-installation: true # we wanna control the version of Go in use | ||
|
||
test: | ||
if: github.event.pull_request.draft == false | ||
name: ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- name: Check if Go project and has go.mod | ||
id: gomod | ||
run: test -e ./go.mod && echo "::set-output name=exists::true" || echo "::set-output name=exists::false" | ||
shell: bash | ||
- if: steps.gomod.outputs.exists == 'true' | ||
name: Setup Go | ||
uses: actions/setup-go@v2.1.3 | ||
with: | ||
go-version: 1.16 | ||
- if: steps.gomod.outputs.exists == 'true' | ||
name: Build | ||
run: go build -v ./... | ||
- if: steps.gomod.outputs.exists == 'true' | ||
name: Test | ||
run: go test -v ./... | ||
|