mirror of
https://github.com/ultravioletrs/cocos.git
synced 2026-06-23 04:10:25 +00:00
5377dd4d7f
* Refactor mock interfaces to use 'any' instead of 'interface{}' for improved type safety and readability across multiple files in the manager and pkg directories.
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
* Update Go version to 1.25.x in CI workflows and remove obsolete Go package files
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
* Add mock implementations for various components in the attestation and SDK packages
- Created mock for MeasurementProvider in pkg/attestation/cmdconfig/mocks/mocks_test.go
- Created mock for Provider in pkg/attestation/mocks/mocks_test.go
- Created mock for Client in pkg/clients/grpc/mocks/mocks_test.go
- Created mock for SDK in pkg/sdk/mocks/mocks_test.go
These mocks are generated using mockery and are intended for unit testing purposes.
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
* Remove autogenerated mock files and update mock usage in tests
- Deleted mocks for gRPC clients in pkg/clients/grpc/mocks/mocks_test.go and pkg/sdk/mocks/mocks_test.go.
- Updated test files in pkg/progressbar/progress_test.go to use the new mock structure without type parameters for gRPC client interfaces.
- Refactored mock generation in pkg/sdk/mocks/sdk.go to streamline the mock creation process and ensure consistency across mock methods.
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
* Update protobuf generated files for events and manager
- Bump protoc-gen-go version from v1.36.5 to v1.36.8 in events.pb.go and manager.pb.go.
- Refactor raw descriptor definitions in events.pb.go and manager.pb.go to use string concatenation for better readability and maintainability.
- Ensure compatibility with the latest protobuf specifications and improve code generation consistency.
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
* Update test commands to use GOTOOLCHAIN for consistent Go version handling
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
* Fix GOTOOLCHAIN usage in test command for consistency
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
---------
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
84 lines
2.2 KiB
YAML
84 lines
2.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "manager/manager.proto"
|
|
- "pkg/manager/*.pb.go"
|
|
- "agent/agent.proto"
|
|
- "agent/*.pb.go"
|
|
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "manager/manager.proto"
|
|
- "pkg/manager/*.pb.go"
|
|
- "agent/agent.proto"
|
|
- "agent/*.pb.go"
|
|
|
|
jobs:
|
|
checkproto:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: 1.25.x
|
|
|
|
- name: Set up protoc
|
|
run: |
|
|
PROTOC_VERSION=29.0
|
|
PROTOC_GEN_VERSION=v1.36.8
|
|
PROTOC_GRPC_VERSION=v1.5.1
|
|
|
|
# Download and install protoc
|
|
PROTOC_ZIP=protoc-$PROTOC_VERSION-linux-x86_64.zip
|
|
curl -0L -o $PROTOC_ZIP https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP
|
|
unzip -o $PROTOC_ZIP -d protoc3
|
|
sudo mv protoc3/bin/* /usr/local/bin/
|
|
sudo mv protoc3/include/* /usr/local/include/
|
|
rm -rf $PROTOC_ZIP protoc3
|
|
|
|
# Install protoc-gen-go and protoc-gen-go-grpc
|
|
go install google.golang.org/protobuf/cmd/protoc-gen-go@$PROTOC_GEN_VERSION
|
|
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@$PROTOC_GRPC_VERSION
|
|
|
|
# Add protoc to the PATH
|
|
export PATH=$PATH:/usr/local/bin/protoc
|
|
|
|
- name: Set up Cocos-AI
|
|
run: |
|
|
# Rename .pb.go files to .pb.go.tmp to prevent conflicts
|
|
for p in $(ls manager/*.pb.go); do
|
|
mv $p $p.tmp
|
|
done
|
|
|
|
for p in $(ls agent/*.pb.go); do
|
|
mv $p $p.tmp
|
|
done
|
|
|
|
# Generate Go files from protobuf definitions
|
|
make protoc
|
|
|
|
# Compare generated Go files with the original ones
|
|
for p in $(ls manager/*.pb.go); do
|
|
if ! cmp -s $p $p.tmp; then
|
|
echo "Proto file and generated Go file $p are out of sync!"
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
for p in $(ls agent/*.pb.go); do
|
|
if ! cmp -s $p $p.tmp; then
|
|
echo "Proto file and generated Go file $p are out of sync!"
|
|
exit 1
|
|
fi
|
|
done
|