Merge pull request #8 from asdf-vm/tb/github-workflow-setup

feat: Add Golang checks to GitHub workflows
This commit is contained in:
Trevor Brown 2024-02-02 20:26:55 -05:00 committed by Trevor Brown
commit 81e3010880
3 changed files with 51 additions and 3 deletions

View File

@ -10,7 +10,7 @@ env:
PYTHON_MIN_VERSION: "3.7.13"
jobs:
asdf:
asdf-bash:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@ -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:

View File

@ -14,3 +14,17 @@ jobs:
- uses: amannn/action-semantic-pull-request@v5.5.3
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

View File

@ -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 }}
@ -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