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

feat: Add Golang checks to GitHub workflows #8

Merged
merged 3 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
23 changes: 22 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
PYTHON_MIN_VERSION: "3.7.13"

jobs:
asdf:
asdf-bash:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -21,6 +21,27 @@ jobs:
- run: scripts/install_dependencies.bash
- run: scripts/lint.bash --check

asdf-golang:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.21.5'
- name: Install dependencies
run: go get .
- name: Check format
run: '[ -z "$(gofmt -l ./...)" ]'
- name: Vet
run: go vet
- name: Install staticcheck for linting
run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: Lint
run: staticcheck -tests -show-ignored ./...
- name: Build
run: build -v ./...

actions:
runs-on: ubuntu-latest
steps:
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/semantic-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,17 @@ jobs:
- uses: amannn/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
scopes: |
# The scope for all the Golang rewrite commits
golang-rewrite
# A list of all used scopes can be computed by running this command:
#
# git log --pretty=format:%s | rg '^[^: ]*\(([^):]*)\).*' -r '$1' | sort | uniq
#
# We only want to allow a limited set of scopes going forward, so
# the list of valid scopes has been pared down here.
docs
website
plugin
completions
17 changes: 15 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ on:
jobs:
detect-changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
# Set job outputs to values from filter step
outputs:
documentation: ${{ steps.filter.outputs.documentation }}
Expand All @@ -37,6 +35,21 @@ jobs:
- 'defaults'
- 'help.txt'

test-golang:
needs: detect-changes
if: ${{ needs.detect-changes.outputs.cli == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.21.5'
- name: Install dependencies
run: go get .
- name: Run Go tests
run: go test

ubuntu:
needs: detect-changes
# only run if
Expand Down
Loading