Testing ci #50
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
name: Starknet-P2p-Specs-CI | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- '*' | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- auto_merge_enabled | |
- edited | |
env: | |
PROTOC_VERSION: v25.1 | |
jobs: | |
compile-protos: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- uses: Noelware/[email protected] | |
with: | |
version: ${{env.PROTOC_VERSION}} | |
- name: Find .proto files | |
id: find-protos | |
run: | | |
proto_files=$(find . -name "*.proto") | |
if [ -z "$proto_files" ]; then | |
echo "No .proto files found." | |
exit 1 | |
fi | |
echo "Found the following .proto files:" | |
echo "$proto_files" | |
# Save the list as an output | |
echo "proto_files=$(echo "$proto_files" | tr '\n' ' ')" >> $GITHUB_OUTPUT | |
- name: Validate rust | |
run: | | |
echo "Using the following .proto files from previous step:" | |
echo "${{ steps.find-protos.outputs.proto_files }}" | |
for file in ${{ steps.find-protos.outputs.proto_files }}; do | |
echo "Compiling $file" | |
protoc --rust_out=experimental-codegen=enabled,kernel=upb:$(mktemp -d) file | |
done | |
# protoc --rust_out=experimental-codegen=enabled,kernel=upb:$(mktemp -d) ${{ steps.find-protos.outputs.proto_files }} | |
# - name: Validate .proto files for Rust compatibility | |
# run: | | |
# protoc --rust_out=experimental-codegen=enabled,kernel=upb:$(mktemp -d) *.proto | |
# protoc --rust_out=experimental-codegen=enabled,kernel=upb:$(mktemp -d) ./p2p/proto/*.proto | |
# protoc --rust_out=experimental-codegen=enabled,kernel=upb:$(mktemp -d) ./p2p/proto/**/*.proto | |
- name: Validate .proto files for Python compatibility | |
run: | | |
echo "Searching for .proto files..." | |
proto_files=$(find . -name "*.proto") | |
if [ -z "$proto_files" ]; then | |
echo "No .proto files found." | |
exit 0 | |
fi | |
echo "Found the following .proto files:" | |
echo "$proto_files" | |
echo "Compiling protos..." | |
echo "$proto_files" | xargs protoc --proto_path=. --python_out=$(mktemp -d) | |
# find . -name "*.proto" -exec protoc --proto_path=. --python_out=$(mktemp -d) {} + | |
# protoc --python_out=$(mktemp -d) ./p2p/proto/*.proto | |
# protoc --python_out=$(mktemp -d) ./p2p/proto/**/*.proto | |
- name: Validate .proto files for C++ compatibility | |
run: | | |
protoc --cpp_out=$(mktemp -d) *.proto | |
# protoc --cpp_out=$(mktemp -d) ./p2p/proto/*.proto | |
# protoc --cpp_out=$(mktemp -d) ./p2p/proto/**/*.proto | |
- name: Install protoc-gen-go | |
run: | | |
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest | |
export PATH=$PATH:$(go env GOPATH)/bin | |
protoc --go_out=$(mktemp -d) --go_opt=paths=source_relative *.proto | |
# protoc --go_out=$(mktemp -d) --go_opt=paths=source_relative ./p2p/proto/*.proto | |
# protoc --go_out=$(mktemp -d) --go_opt=paths=source_relative ./p2p/proto/**/*.proto | |
# - name: go env GOPATH | |
# run: go env GOPATH | |
# - name: export GOPATH | |
# run: export PATH=$PATH:$(go env GOPATH)/bin | |
# - name: echo PATH | |
# run: echo $PATH | |
# - name: check protoc-gen-go installation dir | |
# run: ls $(go env GOPATH)/bin/protoc-gen-go | |
# - name: which protoc-gen-go | |
# run: which protoc-gen-go | |
# - name: Validate .proto files for Go compatibility | |
# run: | | |
# protoc --go_out=$(mktemp -d) ./p2p/proto/*.proto | |
# protoc --go_out=$(mktemp -d) ./p2p/proto/**/*.proto | |
- name: Success Message | |
run: echo "All proto compilations passed!" |