-
Notifications
You must be signed in to change notification settings - Fork 125
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
GH Actions CI Additions + Linter fixups #242
Changes from 4 commits
8064f29
b8f0eac
7007f8c
ffc8b42
b7c1b8b
dbf63af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Manual Go Test Run | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
# When a new revision is pushed to a PR, cancel all in-progress CI runs for that | ||
# PR. See https://docs.github.com/en/actions/using-jobs/using-concurrency | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
go-test: | ||
name: Go Test (${{ matrix.os }}) | ||
runs-on: ${{ matrix.run }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- os: linux | ||
run: ubuntu-22.04 | ||
- os: darwin | ||
philipaconrad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
run: macos-latest | ||
# Windows not allowed currently because of line-ending conversion issues. | ||
#- os: windows | ||
# run: windows-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- id: go_version | ||
name: Read go version | ||
run: echo "::set-output name=go_version::$(cat .go-version)" | ||
|
||
- name: Install Go (${{ steps.go_version.outputs.go_version }}) | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ steps.go_version.outputs.go_version }} | ||
|
||
- name: Unit Test Golang | ||
run: go test ./... | ||
timeout-minutes: 30 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Manual Linter Run | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
# When a new revision is pushed to a PR, cancel all in-progress CI runs for that | ||
# PR. See https://docs.github.com/en/actions/using-jobs/using-concurrency | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
go-lint: | ||
name: Go Lint | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Golang Style and Lint Check | ||
run: docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.46.2 golangci-lint run -v | ||
timeout-minutes: 30 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: PR Check | ||
|
||
on: [pull_request] | ||
|
||
# When a new revision is pushed to a PR, cancel all in-progress CI runs for that | ||
# PR. See https://docs.github.com/en/actions/using-jobs/using-concurrency | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
go-lint: | ||
name: Go Lint | ||
runs-on: ubuntu-22.04 | ||
philipaconrad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Golang Style and Lint Check | ||
run: docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.46.2 golangci-lint run -v | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I wonder why you are choosing to run the docker image, rather than the golangci-lint GitHub action from the marketplace? Does the docker version also annotate the PR with inline comments the way the action marketplace golangci-lint does? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll admit, I just copied that part of the workflow over wholesale from OPA's I'll try out the Github action, and see if that works equally well. The less fiddly commands in those workflows, the less stuff that can break. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the Github actions version works okay. I pinned it to |
||
timeout-minutes: 30 | ||
|
||
go-test: | ||
name: Go Test (${{ matrix.os }}) | ||
runs-on: ${{ matrix.run }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- os: linux | ||
run: ubuntu-22.04 | ||
- os: darwin | ||
philipaconrad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
run: macos-latest | ||
# Windows not allowed currently because of line-ending conversion issues. | ||
#- os: windows | ||
# run: windows-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- id: go_version | ||
name: Read go version | ||
run: echo "::set-output name=go_version::$(cat .go-version)" | ||
|
||
- name: Install Go (${{ steps.go_version.outputs.go_version }}) | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ steps.go_version.outputs.go_version }} | ||
|
||
- name: Unit Test Golang | ||
run: go test ./... | ||
timeout-minutes: 30 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.19.1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,4 +42,4 @@ issues: | |
- errcheck | ||
- gosec | ||
- rowserrcheck | ||
- makezero | ||
- makezero |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ package validator | |
|
||
import ( | ||
_ "embed" | ||
|
||
"github.com/vektah/gqlparser/v2/ast" | ||
) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooooo! Ok, this is super fancy! I'm stealing this for use at my day job. Thanks!