From a4e894b8342eac64b37b4da6212075d7f91b86c6 Mon Sep 17 00:00:00 2001 From: lklimek <842586+lklimek@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:12:53 +0100 Subject: [PATCH] build(ci): optional jobs must report success to merge PR (#993) * build(ci): report status of optional jobs * chore: revert old approach * check-proto, check-mocks * chore: remove paths * build: replace on pull request paths with technote-space/get-diff-action@v6 * chore: setup go later * chore: trigger ci * chore: trigger tests * chore: remove fetch-depth to ensure CI will run correctly * chore: remove duplicate code * check generated mocks when something (incl mockery version) changes in check-generated.yml --- .github/workflows/check-generated.yml | 17 +++++++++++++---- .github/workflows/e2e.yml | 6 ++---- .github/workflows/lint.yml | 20 +++++++++++--------- .github/workflows/tests.yml | 25 ++++++++++++++----------- proto/tendermint/abci/types.proto | 1 + test/e2e/node/main.go | 2 +- 6 files changed, 42 insertions(+), 29 deletions(-) diff --git a/.github/workflows/check-generated.yml b/.github/workflows/check-generated.yml index 5b751145a..139bc197f 100644 --- a/.github/workflows/check-generated.yml +++ b/.github/workflows/check-generated.yml @@ -6,9 +6,6 @@ name: Check generated code on: pull_request: - paths: - - "**.go" - - "**.proto" push: branches: - master @@ -27,7 +24,15 @@ jobs: - uses: actions/checkout@v4 + - uses: technote-space/get-diff-action@v6 + with: + PATTERNS: | + **/*.go + FILES: | + .github/workflows/check-generated.yml + - name: "Check generated mocks" + if: env.GIT_DIFF run: | set -euo pipefail @@ -52,10 +57,14 @@ jobs: go-version: "1.23.2" - uses: actions/checkout@v4 + + - uses: technote-space/get-diff-action@v6 with: - fetch-depth: 1 # we need a .git directory to run git diff + PATTERNS: | + **/*.proto - name: "Check protobuf generated code" + if: env.GIT_DIFF run: | set -euo pipefail diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index d38c13e78..eacee2225 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -5,10 +5,6 @@ name: e2e on: workflow_dispatch: # allow running workflow manually pull_request: - paths: - - "**Dockerfile" - - "**.go" - - "go.sum" push: branches: - master @@ -40,7 +36,9 @@ jobs: - uses: technote-space/get-diff-action@v6 with: PATTERNS: | + **/Dockerfile **/**.go + FILES: | go.mod go.sum diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5644aeab1..cdc5ddfd5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,10 +9,6 @@ name: Golang Linter on: pull_request: - paths: - - "**.go" - - ".golangci.yml" - - ".github/linters/*" push: branches: - master @@ -30,25 +26,32 @@ jobs: - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-go@v5.1.0 - with: - go-version: "^1.23.2" + - uses: technote-space/get-diff-action@v6 with: PATTERNS: | **/**.go + .github/linters/* + FILES: | go.mod go.sum .golangci.yml + - uses: actions/setup-go@v5.1.0 + if: env.GIT_DIFF + with: + go-version: "^1.23.2" + - name: Install dependencies + if: env.GIT_DIFF run: sudo apt-get update && sudo apt-get install -y libpcap-dev - uses: ./.github/actions/bls + if: env.GIT_DIFF name: Install BLS library - if: "env.GIT_DIFF != ''" - uses: golangci/golangci-lint-action@v6.1.1 + if: env.GIT_DIFF with: # Required: the version of golangci-lint is required and # must be specified without patch version: we always use the @@ -57,4 +60,3 @@ jobs: args: --timeout 10m github-token: ${{ secrets.github_token }} only-new-issues: true - if: env.GIT_DIFF diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7300760a4..115c8dde9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,9 +2,6 @@ name: Test on: pull_request: - paths: - - "**.go" - - "go.sum" push: branches: - master @@ -17,29 +14,35 @@ jobs: matrix: part: ["00", "01", "02", "03", "04", "05"] steps: - - uses: actions/setup-go@v5.1.0 - with: - go-version: "1.23.2" - uses: actions/checkout@v4 + - uses: technote-space/get-diff-action@v6 with: PATTERNS: | **/**.go "!test/" + FILES: | go.mod go.sum Makefile + + - uses: actions/setup-go@v5.1.0 + if: env.GIT_DIFF + with: + go-version: "1.23.2" + - name: Install libpcap - run: sudo apt-get install --yes libpcap-dev + if: env.GIT_DIFF + run: sudo apt-get update && sudo apt-get install --yes libpcap-dev + - uses: ./.github/actions/bls name: Install BLS library - if: "env.GIT_DIFF != ''" - - name: Install dependencies - run: sudo apt-get update && sudo apt-get install -y libpcap-dev + if: env.GIT_DIFF + - name: Run Go Tests + if: env.GIT_DIFF env: CGO_LDFLAGS: "-L/usr/local/lib -ldashbls -lrelic_s -lmimalloc-secure -lgmp" CGO_CXXFLAGS: "-I/usr/local/include" run: | make test-group-${{ matrix.part }} NUM_SPLIT=6 - if: env.GIT_DIFF diff --git a/proto/tendermint/abci/types.proto b/proto/tendermint/abci/types.proto index 0e64cdf6a..3453c1ce4 100644 --- a/proto/tendermint/abci/types.proto +++ b/proto/tendermint/abci/types.proto @@ -14,6 +14,7 @@ import "google/protobuf/timestamp.proto"; import "gogoproto/gogo.proto"; // NOTE: When using custom types, mind the warnings. +// // https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues // //---------------------------------------- diff --git a/test/e2e/node/main.go b/test/e2e/node/main.go index fc246e128..830008e1a 100644 --- a/test/e2e/node/main.go +++ b/test/e2e/node/main.go @@ -105,7 +105,7 @@ func run(ctx context.Context, configFile string) error { } func startAppServer(ctx context.Context, cfg *Config, logger log.Logger) error { - // Start remote signer (must start before node if running builtin). + // Start remote signer (must start before node if running builtin) if cfg.PrivValServer != "" { err := startRemoteSigner(ctx, cfg, logger) if err != nil {