Skip to content

Commit 7af1ee9

Browse files
ci: define workflows in this repository
1 parent 8a545e3 commit 7af1ee9

File tree

11 files changed

+98
-100
lines changed

11 files changed

+98
-100
lines changed

.github/workflows/go-check-config.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/go-check.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/go-generate.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
DIR=$(pwd)
6+
TMP=$(mktemp -d)
7+
cd "$TMP"
8+
cp -r "$DIR" orig
9+
cp -r "$DIR" generated
10+
11+
cd generated
12+
# delete all go-generated files generated (that adhere to the comment convention)
13+
grep --include \*.go -lrIZ "^// Code generated .* DO NOT EDIT\.$" . | xargs --null rm
14+
15+
# generate everything
16+
go generate ./...
17+
cd ..

.github/workflows/go-test.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/interop.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ jobs:
1010
with:
1111
# Optional: do not specify to match Chrome's version
1212
chromedriver-version: '124.0.6367.62'
13-
- id: go-mod
14-
uses: pl-strflt/uci/.github/actions/read-go-mod@main
1513
- id: go
1614
env:
1715
GO_MOD_VERSION: ${{ fromJSON(steps.go-mod.outputs.json).Go }}

.github/workflows/lint.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
on: [push, pull_request]
2+
3+
jobs:
4+
check:
5+
runs-on: ubuntu-latest
6+
name: Lint
7+
steps:
8+
- uses: actions/checkout@v4
9+
- uses: actions/setup-go@v5
10+
with:
11+
go-version: "1.23.x"
12+
- name: Check for //go:build ignore in .go files
13+
run: |
14+
IGNORED_FILES=$(grep -rl '//go:build ignore' . --include='*.go') || true
15+
if [ -n "$IGNORED_FILES" ]; then
16+
echo "::error::Found ignored Go files: $IGNORED_FILES"
17+
exit 1
18+
fi
19+
- name: Check that go.mod is tidied
20+
if: success() || failure() # run this step even if the previous one failed
21+
run: |
22+
cp go.mod go.mod.orig
23+
cp go.sum go.sum.orig
24+
go mod tidy
25+
diff go.mod go.mod.orig
26+
diff go.sum go.sum.orig
27+
- name: Run code generators
28+
if: success() || failure() # run this step even if the previous one failed
29+
run: .github/workflows/go-generate.sh
30+
- name: gofmt
31+
if: success() || failure() # run this step even if the previous one failed
32+
run: |
33+
out=$(gofmt -s -l .)
34+
if [[ -n "$out" ]]; then
35+
echo $out | awk '{print "::error file=" $0 ",line=0,col=0::File is not gofmt-ed."}'
36+
exit 1
37+
fi
38+
- name: go vet
39+
if: success() || failure() # run this step even if the previous one failed
40+
run: go vet ./...
41+
- name: Install staticcheck
42+
if: success() || failure() # run this step even if the previous one failed
43+
run: go install honnef.co/go/tools/cmd/staticcheck@v0.5.0
44+
- name: staticcheck
45+
if: success() || failure() # run this step even if the previous one failed
46+
run: |
47+
set -o pipefail
48+
staticcheck ./... | sed -e 's@\(.*\)\.go@./\1.go@g'

.github/workflows/release-check.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/releaser.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/tagpush.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/unit.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
on: [push, pull_request]
2+
3+
jobs:
4+
unit:
5+
strategy:
6+
fail-fast: false
7+
matrix:
8+
os: [ "ubuntu", "windows", "macos" ]
9+
go: [ "1.23.x", "1.24.x" ]
10+
runs-on: ${{ fromJSON(vars[format('UNIT_RUNNER_{0}', matrix.os)] || format('"{0}-latest"', matrix.os)) }}
11+
name: Unit tests (${{ matrix.os}}, Go ${{ matrix.go }})
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-go@v5
15+
with:
16+
go-version: ${{ matrix.go }}
17+
- run: go version
18+
- name: Run tests
19+
env:
20+
TIMESCALE_FACTOR: 10
21+
run: go test -v -cover -coverprofile coverage.txt ./...
22+
- name: Run tests (32 bit)
23+
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
24+
env:
25+
TIMESCALE_FACTOR: 10
26+
GOARCH: 386
27+
run: go test -v -cover
28+
- name: Upload coverage to Codecov
29+
uses: codecov/codecov-action@v4
30+
with:
31+
files: coverage.txt,coverage-root.txt
32+
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}
33+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)