Skip to content

Commit

Permalink
ci: add custom workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed May 4, 2024
1 parent bec9feb commit a0a0ea3
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 92 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/go-check.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/go-test.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
on: [push, pull_request]

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22.x"
- name: Check for //go:build ignore in .go files
run: |
IGNORED_FILES=$(grep -rl '//go:build ignore' . --include='*.go') || true
if [ -n "$IGNORED_FILES" ]; then
echo "::error::Found ignored Go files: $IGNORED_FILES"
exit 1
fi
- name: Check that go.mod is tidied
if: success() || failure() # run this step even if the previous one failed
run: |
cp go.mod go.mod.orig
cp go.sum go.sum.orig
go mod tidy
diff go.mod go.mod.orig
diff go.sum go.sum.orig
- name: gofmt
if: 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: go vet
if: success() || failure() # run this step even if the previous one failed
run: go vet ./...
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/[email protected]
- name: staticcheck
if: success() || failure() # run this step even if the previous one failed
run: |
set -o pipefail
staticcheck ./... | sed -e 's@\(.*\)\.go@./\1.go@g'
19 changes: 0 additions & 19 deletions .github/workflows/release-check.yml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/workflows/releaser.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/tagpush.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on: [push, pull_request]

jobs:
unit:
strategy:
fail-fast: false
matrix:
os: [ "ubuntu", "windows", "macos" ]
go: [ "1.21.x", "1.22.x" ]
runs-on: ${{ fromJSON(vars[format('UNIT_RUNNER_{0}', matrix.os)] || format('"{0}-latest"', matrix.os)) }}
name: Unit tests (${{ matrix.os}}, Go ${{ matrix.go }})
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- run: go version
- name: Run tests
env:
TIMESCALE_FACTOR: 10
run: go test -v -cover -coverprofile coverage.txt ./...
- name: Run tests (32 bit)
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
env:
TIMESCALE_FACTOR: 10
GOARCH: 386
run: go test -v -cover
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: coverage.txt,coverage-root.txt
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}
token: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
coverage.txt

0 comments on commit a0a0ea3

Please sign in to comment.