Skip to content

Commit

Permalink
build(ci): optional jobs must report success to merge PR (#993)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
lklimek authored Dec 12, 2024
1 parent 896df0a commit a4e894b
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 29 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/check-generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
name: Check generated code
on:
pull_request:
paths:
- "**.go"
- "**.proto"
push:
branches:
- master
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ name: e2e
on:
workflow_dispatch: # allow running workflow manually
pull_request:
paths:
- "**Dockerfile"
- "**.go"
- "go.sum"
push:
branches:
- master
Expand Down Expand Up @@ -40,7 +36,9 @@ jobs:
- uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
**/Dockerfile
**/**.go
FILES: |
go.mod
go.sum
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ name: Golang Linter

on:
pull_request:
paths:
- "**.go"
- ".golangci.yml"
- ".github/linters/*"
push:
branches:
- master
Expand All @@ -30,25 +26,32 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/[email protected]
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/[email protected]
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/[email protected]
if: env.GIT_DIFF
with:
# Required: the version of golangci-lint is required and
# must be specified without patch version: we always use the
Expand All @@ -57,4 +60,3 @@ jobs:
args: --timeout 10m
github-token: ${{ secrets.github_token }}
only-new-issues: true
if: env.GIT_DIFF
25 changes: 14 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
name: Test
on:
pull_request:
paths:
- "**.go"
- "go.sum"
push:
branches:
- master
Expand All @@ -17,29 +14,35 @@ jobs:
matrix:
part: ["00", "01", "02", "03", "04", "05"]
steps:
- uses: actions/[email protected]
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/[email protected]
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
1 change: 1 addition & 0 deletions proto/tendermint/abci/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
//----------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a4e894b

Please sign in to comment.