Skip to content

Commit

Permalink
Add makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-congo committed Feb 8, 2024
1 parent 76480fd commit 258fc6b
Show file tree
Hide file tree
Showing 15 changed files with 90 additions and 1,078 deletions.
45 changes: 13 additions & 32 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,49 +63,30 @@ jobs:
with:
redis-version: ${{ matrix.redis }}

- name: Build glide-core
working-directory: ./glide-core
run: cargo build --release

- name: Build glide
working-directory: ./go/glide
run: cargo build --release
- name: Install client dependencies
working-directory: ./go
run: make install-dependencies

- name: Setup upterm session
uses: lhotari/action-upterm@v1

- name: Install client dependencies
working-directory: ./go/glide
run: go install

- name: Generate the Go protobuf files
run: |
mkdir go/glide/protobuf
protoc --proto_path=glide-core/src/protobuf \
--go_opt=Mconnection_request.proto=github.com/aws/glide-for-redis/go/glide/protobuf \
--go_opt=Mredis_request.proto=github.com/aws/glide-for-redis/go/glide/protobuf \
--go_opt=Mresponse.proto=github.com/aws/glide-for-redis/go/glide/protobuf \
--go_out=go/glide/protobuf \
--go_opt=paths=source_relative \
glide-core/src/protobuf/*.proto
- name: Build client
working-directory: ./go/glide
working-directory: ./go
run: |
go mod edit -go=${{ matrix.go }}
go build .
make build
- name: Run go vet
working-directory: ./go/glide
- name: Run go vet linter
working-directory: ./go
run: go vet .

- name: Run staticcheck
working-directory: ./go/glide
- name: Run staticcheck linter
working-directory: ./go
run: go staticcheck .

- name: Run unit tests
working-directory: ./go/glide
run: go test -json | go-test-report -o reports/unit-test-report.html
working-directory: ./go
run: make unit-test-report

- name: Upload test reports
if: always()
Expand All @@ -114,7 +95,7 @@ jobs:
with:
name: test-reports-go-${{ matrix.go }}-redis-${{ matrix.redis }}-${{ matrix.os }}
path: |
go/glide/reports/unit-test-report.html
go/reports/unit-test-report.html
lint-rust:
timeout-minutes: 15
Expand All @@ -126,5 +107,5 @@ jobs:

- uses: ./.github/workflows/lint-rust
with:
cargo-toml-folder: ./go/glide
cargo-toml-folder: ./go
name: lint go rust
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions go/glide/Cargo.toml → go/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ cbindgen = "0.20"
crate-type = ["cdylib"]

[dependencies]
redis = { path = "../../submodules/redis-rs/redis", features = ["aio", "tokio-comp", "tls", "tokio-native-tls-comp", "tls-rustls-insecure"] }
glide-core = { path = "../../glide-core" }
redis = { path = "../submodules/redis-rs/redis", features = ["aio", "tokio-comp", "tls", "tokio-native-tls-comp", "tls-rustls-insecure"] }
glide-core = { path = "../glide-core" }
tokio = { version = "^1", features = ["rt", "macros", "rt-multi-thread", "time"] }
protobuf = { version = "3.3.0", features = [] }

Expand Down
29 changes: 29 additions & 0 deletions go/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
install-dependencies:
go install github.com/DarkDrim/[email protected]
go install google.golang.org/protobuf/cmd/[email protected]
go install honnef.co/go/tools/cmd/[email protected]

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

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

build-glide-client:
cargo build --release

generate-protobuf:
protoc --proto_path=../glide-core/src/protobuf \
--go_opt=Mconnection_request.proto=github.com/aws/glide-for-redis/go/protobuf \
--go_opt=Mredis_request.proto=github.com/aws/glide-for-redis/go/protobuf \
--go_opt=Mresponse.proto=github.com/aws/glide-for-redis/go/protobuf \
--go_out=./protobuf \
--go_opt=paths=source_relative \
../glide-core/src/protobuf/*.proto

lint:
go vet ./...
staticcheck ./...

unit-test-report:
go test ./... -json | go-test-report -o reports/unit-test-report.html
File renamed without changes.
1 change: 1 addition & 0 deletions go/glide.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package _go
1 change: 0 additions & 1 deletion go/glide/glide.go

This file was deleted.

1,035 changes: 0 additions & 1,035 deletions go/glide/go.sum

This file was deleted.

3 changes: 0 additions & 3 deletions go/glide/src/lib.rs

This file was deleted.

7 changes: 4 additions & 3 deletions go/glide/go.mod → go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ module github.com/aws/glide-for-redis/go/glide
go 1.21

require (
github.com/vakenbolt/go-test-report v0.9.3
github.com/DarkDrim/go-test-report v1.5.0
google.golang.org/protobuf v1.32.0
honnef.co/go/tools v0.4.6
)

require (
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/spf13/cobra v1.1.3 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/spf13/cobra v1.8.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/tools v0.12.1-0.20230825192346-2191a27a6dc5 // indirect
)
28 changes: 28 additions & 0 deletions go/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/DarkDrim/go-test-report v1.5.0 h1:KBItzAYuvgjUvMhfiM2KmSuXFV2zbK/E9SwsFSbp4mU=
github.com/DarkDrim/go-test-report v1.5.0/go.mod h1:b3M6oZDGdKEuWjHYQDzDP70nzr/DOqZPFjwaFdQGhp8=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a h1:Jw5wfR+h9mnIYH+OtGT2im5wV1YGGDora5vTv/aa5bE=
golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/tools v0.12.1-0.20230825192346-2191a27a6dc5 h1:Vk4mysSz+GqQK2eqgWbo4zEO89wkeAjJiFIr9bpqa8k=
golang.org/x/tools v0.12.1-0.20230825192346-2191a27a6dc5/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM=
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.4.6 h1:oFEHCKeID7to/3autwsWfnuv69j3NsfcXbvJKuIcep8=
honnef.co/go/tools v0.4.6/go.mod h1:+rnGS1THNh8zMwnd2oVOTL9QF6vmfyG6ZXBULae2uc0=
11 changes: 11 additions & 0 deletions go/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/
use std::{
ffi::c_void
};

#[no_mangle]
pub extern "C" fn create_connection() -> *const c_void {
todo!()
}
2 changes: 1 addition & 1 deletion go/glide/glide_test.go → go/tests/glide_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package glide
package tests

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion go/glide/tools.go → go/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package main

import (
_ "github.com/vakenbolt/go-test-report"
_ "github.com/DarkDrim/go-test-report"
_ "google.golang.org/protobuf/cmd/protoc-gen-go"
_ "honnef.co/go/tools/cmd/staticcheck"
)

0 comments on commit 258fc6b

Please sign in to comment.