Skip to content

Commit

Permalink
Updated github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
iand committed Nov 25, 2023
1 parent 0b61394 commit 86f79dc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
31 changes: 21 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ on:
- master
name: Run tests
jobs:
test:
strategy:
matrix:
os: ["ubuntu", "windows", "macos"]
runs-on: ${{ matrix.os }}-latest
check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -25,11 +22,9 @@ jobs:
go-version-file: 'go.mod'

- name: Get StaticCheck
if: ${{ matrix.os == 'ubuntu' }}
run: go install honnef.co/go/tools/cmd/staticcheck@latest

- name: Gomod
if: ${{ matrix.os == 'ubuntu' }}
run: |
go mod tidy
if [[ -n $(git ls-files --other --exclude-standard --directory -- go.sum) ]]; then
Expand All @@ -39,7 +34,7 @@ jobs:
git diff --exit-code -- go.sum go.mod
- name: Gofmt
if: ${{ matrix.os == 'ubuntu' && (success() || failure()) }} # run this step even if the previous one failed
if: ${{ success() || failure() }} # run this step even if the previous one failed
run: |
out=$(gofmt -s -l .)
if [[ -n "$out" ]]; then
Expand All @@ -48,13 +43,29 @@ jobs:
fi
- name: Vet
if: ${{ matrix.os == 'ubuntu' && (success() || failure()) }} # run this step even if the previous one failed
if: ${{ success() || failure() }} # run this step even if the previous one failed
run: go vet ./...

- name: StaticCheck
if: ${{ matrix.os == 'ubuntu' && (success() || failure()) }} # run this step even if the previous one failed
if: ${{ success() || failure() }} # run this step even if the previous one failed
run: staticcheck ./...

test:
strategy:
matrix:
os: ["ubuntu", "windows", "macos"]
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'

- name: Test
run: go test ./...

Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ on:
workflows: ["Run tests"]
types:
- completed
branches:
- main
- master

jobs:
build:
version:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
Expand Down

0 comments on commit 86f79dc

Please sign in to comment.