Skip to content

Commit

Permalink
Go: miscellaneous CI improvements (valkey-io#1135)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-congo authored Mar 20, 2024
1 parent d40cd63 commit c4daccd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 30 deletions.
28 changes: 7 additions & 21 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Go CI

on:
workflow_dispatch:
push:
branches: [ "main" ]
paths:
Expand All @@ -23,7 +22,7 @@ concurrency:

jobs:
build-and-test-go-client:
timeout-minutes: 20
timeout-minutes: 35
strategy:
# Run all jobs
fail-fast: false
Expand Down Expand Up @@ -69,6 +68,10 @@ jobs:
working-directory: ./go
run: make install-tools-go${{ matrix.go }}

- name: Set LD_LIBRARY_PATH
if: ${{ matrix.os == 'ubuntu-latest' }}
run: echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/go/target/release/deps/" >> $GITHUB_ENV

- name: Build client
working-directory: ./go
run: make build
Expand All @@ -79,16 +82,7 @@ jobs:

- name: Run tests
working-directory: ./go
run: make test-and-report

- name: Upload test reports
if: always()
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: test-reports-go-${{ matrix.go }}-redis-${{ matrix.redis }}-${{ matrix.os }}
path: |
go/reports/test-report.html
run: make test

build-amazonlinux-latest:
if: github.repository_owner == 'aws'
Expand Down Expand Up @@ -154,15 +148,7 @@ jobs:

- name: Run tests
working-directory: ./go
run: make test-and-report

- name: Upload test reports
if: always()
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: test-reports-go-${{ matrix.go }}-amazon-linux-latest
path: go/reports/test-report.html
run: make test

lint-rust:
timeout-minutes: 15
Expand Down
13 changes: 4 additions & 9 deletions go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,9 @@ install-tools-go1.22.0: install-build-tools install-dev-tools-go1.22.0

install-tools: install-tools-go1.22.0

build: build-glide-core build-glide-client generate-protobuf
build: build-glide-client generate-protobuf
go build ./...

build-glide-core:
cd ../glide-core; cargo build --release

build-glide-client:
cargo build --release

Expand All @@ -46,9 +43,7 @@ lint:
gofumpt -d .
golines --dry-run --shorten-comments -m 127 .

lint-ci:
go vet ./...
staticcheck ./...
lint-ci: lint
if [ "$$(gofumpt -l . | wc -l)" -gt 0 ]; then exit 1; fi
if [ "$$(golines -l --shorten-comments -m 127 . | wc -l)" -gt 0 ]; then exit 1; fi

Expand All @@ -57,8 +52,8 @@ format:
golines -w --shorten-comments -m 127 .

test:
go test -v -race `go list ./... | grep -v protobuf`
go test -v -race ./...

test-and-report:
mkdir -p reports
go test -v -race `go list ./... | grep -v protobuf` -json | go-test-report -o reports/test-report.html
go test -v -race ./... -json | go-test-report -o reports/test-report.html

0 comments on commit c4daccd

Please sign in to comment.