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 24, 2023
1 parent d200834 commit a0b0e37
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 120 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/autodep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ jobs:
timeout-minutes: 10

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.20.x

- name: Checkout
uses: actions/checkout@v3
go-version-file: 'go.mod'

- name: Update minor and patch-level dependencies
run: go get -t -u ./...
Expand Down
45 changes: 0 additions & 45 deletions .github/workflows/check.yml

This file was deleted.

46 changes: 0 additions & 46 deletions .github/workflows/gotip.yml

This file was deleted.

58 changes: 39 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,59 @@ jobs:
test:
strategy:
matrix:
go-version: [1.19.x, 1.20.x]
os: ["ubuntu", "windows", "macos"]
runs-on: ${{ matrix.os }}-latest
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
- id: Cache
uses: actions/cache@v3

- name: Install Go
uses: actions/setup-go@v4
with:
path: |
~/go/pkg/mod # Module download cache
~/.cache/go-build # Build cache (Linux)
~/Library/Caches/go-build # Build cache (Mac)
'%LocalAppData%\go-build' # Build cache (Windows)
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Dependencies
run: go mod download
if: steps.cache.outputs.cache-hit != 'true'
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
echo "go.sum was added by go mod tidy"
exit 1
fi
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
run: |
out=$(gofmt -s -l .)
if [[ -n "$out" ]]; then
echo $out | awk '{print "::error file=" $0 ",line=0,col=0::File is not gofmt-ed."}'
exit 1
fi
- name: Vet
if: ${{ matrix.os == 'ubuntu' && (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
run: staticcheck ./...

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

- name: Test 32 bit
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
env:
GOARCH: 386
run: go test ./...

- name: Test with race detector
if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow
run: go test -race ./...
13 changes: 8 additions & 5 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
name: Bump version
on:
workflow_dispatch:
push:
branches:
- main
- master
workflow_run:
workflows: ["Run tests"]
types:
- completed

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4

- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.1
Expand Down

0 comments on commit a0b0e37

Please sign in to comment.