From 4d9e1037764049919d59ee0cd382303299bf3547 Mon Sep 17 00:00:00 2001 From: Semyon Novikov Date: Fri, 26 Jul 2024 17:02:11 +0300 Subject: [PATCH] ci/cd: refactor (#9) update protoc, use internal bash scripts --- .github/workflows/build.yml | 14 +++++++++----- .github/workflows/test.yml | 31 +++++++++++-------------------- scripts/build_all_platforms | 0 scripts/install_deps | 0 4 files changed, 20 insertions(+), 25 deletions(-) mode change 100644 => 100755 scripts/build_all_platforms mode change 100644 => 100755 scripts/install_deps diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9debafa3..55042ed6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ env: GOLANG_PROTOBUF_REGISTRATION_CONFLICT: ignore jobs: - run_build: + build: runs-on: ubuntu-latest steps: @@ -22,10 +22,14 @@ jobs: with: go-version: '1.22.5' - - name: install protobuf - run: | - sudo apt update - sudo apt install protobuf-compiler + - name: install protoc (protobuf) + uses: arduino/setup-protoc@v3 + with: + version: v27.2 + include-pre-releases: false + + - name: chmod +x + run: chmod +x ./scripts/install_deps && chmod +x ./scripts/build - name: install dependencies run: ./scripts/install_deps diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a909bca1..c63d5abb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,10 +10,9 @@ env: GOLANG_PROTOBUF_REGISTRATION_CONFLICT: ignore jobs: - run_tests: + tests: runs-on: ubuntu-latest steps: - - name: clone repo uses: actions/checkout@v3 @@ -22,25 +21,17 @@ jobs: with: go-version: '1.22.5' - - name: install protobuf - run: | - sudo apt update - sudo apt install protobuf-compiler - - - name: go_ins_1 - run: go install google.golang.org/protobuf/cmd/protoc-gen-go@latest - - - name: go_ins_2 - run: go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest - - - name: generate - run: go generate ./... + - name: install protoc (protobuf) + uses: arduino/setup-protoc@v3 + with: + version: v27.2 + include-pre-releases: false - - name: check version - run: go version + - name: chmod to allow run script + run: chmod +x ./scripts/install_deps - - name: check folder - run: ls + - name: install dependencies + run: ./scripts/install_deps - - name: do tests + - name: go tests run: go test -v ./... diff --git a/scripts/build_all_platforms b/scripts/build_all_platforms old mode 100644 new mode 100755 diff --git a/scripts/install_deps b/scripts/install_deps old mode 100644 new mode 100755