From c11d8a00adaafee86b2727e053ad76bd53959b7e Mon Sep 17 00:00:00 2001 From: Shawn Tabai Date: Sun, 27 Feb 2022 19:25:26 -0800 Subject: [PATCH 1/7] fix: reproduce breakage --- .github/actions/bazel-command/action.yml | 3 ++ .github/workflows/buf.yml | 2 + .github/workflows/build.yml | 2 + .github/workflows/check-pr.yml | 62 ++++++++++++------------ .github/workflows/lint.yml | 6 +++ .github/workflows/test.yml | 2 + 6 files changed, 46 insertions(+), 31 deletions(-) diff --git a/.github/actions/bazel-command/action.yml b/.github/actions/bazel-command/action.yml index 19a7365..679e427 100644 --- a/.github/actions/bazel-command/action.yml +++ b/.github/actions/bazel-command/action.yml @@ -28,6 +28,9 @@ runs: with: separator: + +# - run: buf generate +# shell: bash + - id: bazel-rdeps-query if: ${{ inputs.affected_targets_only}} shell: bash diff --git a/.github/workflows/buf.yml b/.github/workflows/buf.yml index d1220c8..5105310 100644 --- a/.github/workflows/buf.yml +++ b/.github/workflows/buf.yml @@ -3,6 +3,8 @@ name: Buf on: push: branches: [main] + pull_request: + branches: [main] workflow_call: inputs: detect_breaking_changes: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 391a478..2d99837 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,8 @@ name: Build on: push: branches: [main] + pull_request: + branches: [main] workflow_call: inputs: affected_targets_only: diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml index 2ad4163..7eaa5a7 100644 --- a/.github/workflows/check-pr.yml +++ b/.github/workflows/check-pr.yml @@ -1,31 +1,31 @@ -name: Check PR - -on: - pull_request: - branches: [main] - -jobs: - buildifier: - uses: ./.github/workflows/buildifier.yml - with: - changed_files_only: true - buf: - uses: ./.github/workflows/buf.yml - with: - detect_breaking_changes: true - super-linter: - uses: ./.github/workflows/lint.yml - with: - changed_files_only: true - build: - uses: ./.github/workflows/build.yml - with: - affected_targets_only: true - test: - needs: [build] - uses: ./.github/workflows/test.yml - with: - affected_targets_only: true - tilt: - needs: [build] - uses: ./.github/workflows/tilt.yml +#name: Check PR +# +#on: +# pull_request: +# branches: [main] +# +#jobs: +# buildifier: +# uses: ./.github/workflows/buildifier.yml +# with: +# changed_files_only: true +# buf: +# uses: ./.github/workflows/buf.yml +# with: +# detect_breaking_changes: true +# super-linter: +# uses: ./.github/workflows/lint.yml +# with: +# changed_files_only: true +# build: +# uses: ./.github/workflows/build.yml +# with: +# affected_targets_only: true +# test: +# needs: [build] +# uses: ./.github/workflows/test.yml +# with: +# affected_targets_only: true +# tilt: +# needs: [build] +# uses: ./.github/workflows/tilt.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index eb21803..368ec4d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,6 +9,8 @@ name: Lint on: push: branches: [main] + pull_request: + branches: [main] workflow_call: inputs: changed_files_only: @@ -25,6 +27,10 @@ jobs: # Full git history is needed to get a proper list of changed files within `super-linter` fetch-depth: 0 +# - name: Generate Protos +# run: buf generate +# shell: bash + - name: Lint Code uses: github/super-linter/slim@v4 env: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9513fdc..f24b561 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,6 +3,8 @@ name: Test on: push: branches: [main] + pull_request: + branches: [main] workflow_call: inputs: affected_targets_only: From 250d27edc8195dec8358e5482acd2cfbe3129062 Mon Sep 17 00:00:00 2001 From: Shawn Tabai Date: Sun, 27 Feb 2022 19:31:10 -0800 Subject: [PATCH 2/7] test: maybe fix --- .github/actions/bazel-command/action.yml | 4 ++-- .github/workflows/lint.yml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/actions/bazel-command/action.yml b/.github/actions/bazel-command/action.yml index 679e427..f1bce85 100644 --- a/.github/actions/bazel-command/action.yml +++ b/.github/actions/bazel-command/action.yml @@ -28,8 +28,8 @@ runs: with: separator: + -# - run: buf generate -# shell: bash + - run: buf generate + shell: bash - id: bazel-rdeps-query if: ${{ inputs.affected_targets_only}} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 368ec4d..7528188 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -27,9 +27,9 @@ jobs: # Full git history is needed to get a proper list of changed files within `super-linter` fetch-depth: 0 -# - name: Generate Protos -# run: buf generate -# shell: bash + - name: Generate Protos + run: buf generate + shell: bash - name: Lint Code uses: github/super-linter/slim@v4 From 36a54c09da4d745dfec473e1687d45cbacaa33e2 Mon Sep 17 00:00:00 2001 From: Shawn Tabai Date: Sun, 27 Feb 2022 19:36:33 -0800 Subject: [PATCH 3/7] test: maybe fix --- .github/workflows/lint.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7528188..acdb57e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -27,6 +27,11 @@ jobs: # Full git history is needed to get a proper list of changed files within `super-linter` fetch-depth: 0 + - name: Set up Buf + uses: bufbuild/buf-setup-action@v0.6.0 + with: + version: 1.0.0-rc12 + - name: Generate Protos run: buf generate shell: bash From e0b2bca6729b4e632867a3ea170e7809c74b31c3 Mon Sep 17 00:00:00 2001 From: Shawn Tabai Date: Sun, 27 Feb 2022 20:14:25 -0800 Subject: [PATCH 4/7] test: maybe fix --- .github/workflows/lint.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index acdb57e..2706eaf 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,5 +1,5 @@ # This workflow executes several linters on changed files based on languages used in your code base whenever -# you push a code or open a pull request. +# you push code or open a pull request. # # You can adjust the behavior by modifying this file. # For more information, see: @@ -36,6 +36,10 @@ jobs: run: buf generate shell: bash + - name: check thing + run: ls proto/example/service/v1/ + shell: bash + - name: Lint Code uses: github/super-linter/slim@v4 env: From e298f8ffe9c83a8c630cd285f6ff925141d84066 Mon Sep 17 00:00:00 2001 From: Shawn Tabai Date: Mon, 28 Feb 2022 14:09:16 -0800 Subject: [PATCH 5/7] fix: update linters enabled --- .github/workflows/lint.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2706eaf..c0dcb92 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -36,15 +36,11 @@ jobs: run: buf generate shell: bash - - name: check thing - run: ls proto/example/service/v1/ - shell: bash - - name: Lint Code - uses: github/super-linter/slim@v4 + uses: github/super-linter/slim@6eed012d2d9731d8896242a3708f2ecca5faa98e env: VALIDATE_ALL_CODEBASE: ${{ !inputs.changed_files_only }} DEFAULT_BRANCH: main GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # TODO: Reenable github actions validation after https://github.com/rhysd/actionlint/pull/115 - VALIDATE_GITHUB_ACTIONS: false + # TODO: Figure out why golangci-lint ignores generated protos + VALIDATE_GO: false From e525e6a4127ec272e4a6c6107116a7847ad8df00 Mon Sep 17 00:00:00 2001 From: Shawn Tabai Date: Mon, 28 Feb 2022 14:16:42 -0800 Subject: [PATCH 6/7] fix: clean up workflows --- .github/workflows/buf.yml | 3 +- .github/workflows/build.yml | 3 +- .github/workflows/buildifier.yml | 1 + .github/workflows/check-pr.yml | 62 ++++++++++++++++---------------- .github/workflows/lint.yml | 3 +- .github/workflows/test.yml | 3 +- 6 files changed, 36 insertions(+), 39 deletions(-) diff --git a/.github/workflows/buf.yml b/.github/workflows/buf.yml index 5105310..d91ca03 100644 --- a/.github/workflows/buf.yml +++ b/.github/workflows/buf.yml @@ -3,11 +3,10 @@ name: Buf on: push: branches: [main] - pull_request: - branches: [main] workflow_call: inputs: detect_breaking_changes: + description: Whether to check for breaking changes to protos type: boolean default: false required: false diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2d99837..62e13c7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,11 +3,10 @@ name: Build on: push: branches: [main] - pull_request: - branches: [main] workflow_call: inputs: affected_targets_only: + description: Whether to limit checks to targets affected by modified files type: boolean default: false required: false diff --git a/.github/workflows/buildifier.yml b/.github/workflows/buildifier.yml index 61bf9ee..db10b4e 100644 --- a/.github/workflows/buildifier.yml +++ b/.github/workflows/buildifier.yml @@ -6,6 +6,7 @@ on: workflow_call: inputs: changed_files_only: + description: Whether to limit checks to modified files type: boolean default: false required: false diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml index 7eaa5a7..06b2c25 100644 --- a/.github/workflows/check-pr.yml +++ b/.github/workflows/check-pr.yml @@ -1,31 +1,31 @@ -#name: Check PR -# -#on: -# pull_request: -# branches: [main] -# -#jobs: -# buildifier: -# uses: ./.github/workflows/buildifier.yml -# with: -# changed_files_only: true -# buf: -# uses: ./.github/workflows/buf.yml -# with: -# detect_breaking_changes: true -# super-linter: -# uses: ./.github/workflows/lint.yml -# with: -# changed_files_only: true -# build: -# uses: ./.github/workflows/build.yml -# with: -# affected_targets_only: true -# test: -# needs: [build] -# uses: ./.github/workflows/test.yml -# with: -# affected_targets_only: true -# tilt: -# needs: [build] -# uses: ./.github/workflows/tilt.yml +name: Check PR + +on: + pull_request: + branches: [main] + +jobs: + buildifier: + uses: ./.github/workflows/buildifier.yml + with: + changed_files_only: true + buf: + uses: ./.github/workflows/buf.yml + with: + detect_breaking_changes: true + super-linter: + uses: ./.github/workflows/lint.yml + with: + changed_files_only: true + build: + uses: ./.github/workflows/build.yml + with: + affected_targets_only: true + test: + needs: [build] + uses: ./.github/workflows/test.yml + with: + affected_targets_only: true + tilt: + needs: [build] + uses: ./.github/workflows/tilt.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c0dcb92..6ad9d18 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,11 +9,10 @@ name: Lint on: push: branches: [main] - pull_request: - branches: [main] workflow_call: inputs: changed_files_only: + description: Whether to limit checks to modified files type: boolean default: false required: false diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f24b561..3eeb934 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,11 +3,10 @@ name: Test on: push: branches: [main] - pull_request: - branches: [main] workflow_call: inputs: affected_targets_only: + description: Whether to limit checks to targets affected by modified files type: boolean default: false required: false From 604592af38e1a811d4639e13665159aabcb6a884 Mon Sep 17 00:00:00 2001 From: Shawn Tabai Date: Mon, 28 Feb 2022 14:26:14 -0800 Subject: [PATCH 7/7] fix: clean up workflows --- .github/workflows/buildifier.yml | 1 + .github/workflows/lint.yml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/buildifier.yml b/.github/workflows/buildifier.yml index db10b4e..02e2d2b 100644 --- a/.github/workflows/buildifier.yml +++ b/.github/workflows/buildifier.yml @@ -49,6 +49,7 @@ jobs: fi if [[ "$fileset" != "" ]]; then echo "Executing buildifier on: $fileset" + # shellcheck disable=SC2086 buildifier -mode=check -lint=warn $fileset else echo "Skipping buildifier; no files to check" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6ad9d18..a026065 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -36,10 +36,10 @@ jobs: shell: bash - name: Lint Code - uses: github/super-linter/slim@6eed012d2d9731d8896242a3708f2ecca5faa98e + uses: github/super-linter/slim@latest env: VALIDATE_ALL_CODEBASE: ${{ !inputs.changed_files_only }} DEFAULT_BRANCH: main GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # TODO: Figure out why golangci-lint ignores generated protos + # TODO: Figure out why golangci-lint doesn't see the generated protos VALIDATE_GO: false