forked from valkey-io/valkey-glide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add CI for Go * Add command to install wget to amazon linux workflow * Remove sudo from the amazon linux tar command * Add command to install tar on amazon linux * Change command so that the Go path is updated for all amazon linux steps * Remove command to list Go version * Fix missing steps, go mod command * Remove redundant step * Add Go bin to path, remove patch version from go mod command * Update amazon linux test name * Increase timeout * Specify minimum go version as 1.18, remove dependency requiring Go 1.21, fix yml formatting, fix setup-go cache
- Loading branch information
1 parent
8466748
commit ace0786
Showing
11 changed files
with
605 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
name: Go CI | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ "main" ] | ||
paths: | ||
- glide-core/** | ||
- submodules/** | ||
- go/** | ||
- .github/workflows/go.yml | ||
pull_request: | ||
paths: | ||
- glide-core/** | ||
- submodules/** | ||
- go/** | ||
- .github/workflows/go.yml | ||
|
||
# Run only the latest job on a branch and cancel previous ones | ||
concurrency: | ||
group: ${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-and-test-go-client: | ||
timeout-minutes: 20 | ||
strategy: | ||
# Run all jobs | ||
fail-fast: false | ||
matrix: | ||
go: | ||
- '1.18' | ||
- '1.21' | ||
redis: | ||
- 6.2.14 | ||
- 7.2.3 | ||
os: | ||
- ubuntu-latest | ||
- macos-latest | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Set up Go ${{ matrix.go }} | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
cache-dependency-path: go/go.sum | ||
|
||
- name: Install shared software dependencies | ||
uses: ./.github/workflows/install-shared-dependencies | ||
with: | ||
os: ${{ matrix.os }} | ||
target: ${{ matrix.os == 'ubuntu-latest' && 'x86_64-unknown-linux-gnu' || 'x86_64-apple-darwin' }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install redis | ||
# TODO: make this step macos compatible: https://github.com/aws/glide-for-redis/issues/781 | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
uses: ./.github/workflows/install-redis | ||
with: | ||
redis-version: ${{ matrix.redis }} | ||
|
||
- name: Install client dependencies | ||
working-directory: ./go | ||
run: make install-tools | ||
|
||
- name: Build client | ||
working-directory: ./go | ||
run: make build | ||
|
||
- name: Run linters | ||
working-directory: ./go | ||
run: make lint | ||
|
||
- name: Run unit tests | ||
working-directory: ./go | ||
run: make unit-test-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/unit-test-report.html | ||
build-amazonlinux-latest: | ||
if: github.repository_owner == 'aws' | ||
strategy: | ||
# Run all jobs | ||
fail-fast: false | ||
matrix: | ||
go: | ||
- 1.18.10 | ||
- 1.21.6 | ||
runs-on: ubuntu-latest | ||
container: amazonlinux:latest | ||
timeout-minutes: 15 | ||
steps: | ||
- name: Install git | ||
run: | | ||
yum -y remove git | ||
yum -y remove git-* | ||
yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm | ||
yum update | ||
yum install -y git | ||
git --version | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Checkout submodules | ||
run: | | ||
git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
git submodule update --init --recursive | ||
- name: Install shared software dependencies | ||
uses: ./.github/workflows/install-shared-dependencies | ||
with: | ||
os: "amazon-linux" | ||
target: "x86_64-unknown-linux-gnu" | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create a symbolic Link for redis6 binaries | ||
run: | | ||
ln -s /usr/bin/redis6-server /usr/bin/redis-server | ||
ln -s /usr/bin/redis6-cli /usr/bin/redis-cli | ||
- name: Install Go | ||
run: | | ||
yum -y install wget | ||
yum -y install tar | ||
wget https://go.dev/dl/go${{ matrix.go }}.linux-amd64.tar.gz | ||
tar -C /usr/local -xzf go${{ matrix.go }}.linux-amd64.tar.gz | ||
echo "/usr/local/go/bin" >> $GITHUB_PATH | ||
echo "$HOME/go/bin" >> $GITHUB_PATH | ||
- name: Install client dependencies | ||
working-directory: ./go | ||
run: make install-tools | ||
|
||
- name: Build client | ||
working-directory: ./go | ||
run: make build | ||
|
||
- name: Run linters | ||
working-directory: ./go | ||
run: make lint | ||
|
||
- name: Run unit tests | ||
working-directory: ./go | ||
run: make unit-test-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/unit-test-report.html | ||
|
||
lint-rust: | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- uses: ./.github/workflows/lint-rust | ||
with: | ||
cargo-toml-folder: ./go | ||
name: lint go rust |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[env] | ||
GLIDE_NAME = { value = "GlideGo", force = true } | ||
GLIDE_VERSION = "0.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Go compilation files | ||
*.pb.go | ||
|
||
reports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[package] | ||
name = "glide-rs" | ||
version = "0.1.0" | ||
edition = "2021" | ||
license = "Apache-2.0" | ||
authors = ["Amazon Web Services"] | ||
|
||
[lib] | ||
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" } | ||
tokio = { version = "^1", features = ["rt", "macros", "rt-multi-thread", "time"] } | ||
protobuf = { version = "3.3.0", features = [] } | ||
|
||
[profile.release] | ||
lto = true | ||
debug = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
install-tools: | ||
@cat tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go install % | ||
|
||
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: | ||
mkdir -p 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: | ||
mkdir -p reports | ||
go test -race ./... -json | go-test-report -o reports/unit-test-report.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package glide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module github.com/aws/glide-for-redis/go/glide | ||
|
||
go 1.18 | ||
|
||
require ( | ||
github.com/vakenbolt/go-test-report v0.9.3 | ||
google.golang.org/protobuf v1.32.0 | ||
honnef.co/go/tools v0.3.3 | ||
) | ||
|
||
require ( | ||
github.com/BurntSushi/toml v1.2.1 // 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 | ||
) |
Oops, something went wrong.