Add a gcp project picker to the repo flow #15986
Workflow file for this run
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: Check Style | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
checkstyle: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, 'style skip')" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# TODO(https://github.com/tj-actions/changed-files/issues/809): Re-enable | |
# - name: Get changed files | |
# id: changed-files | |
# uses: tj-actions/[email protected] | |
- name: Setup go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.21.3" # Keep in sync with WORKSPACE | |
- name: gofmt | |
run: | | |
gofmt -d . > gofmt-diff.txt || true | |
echo "gofmt diff:" | |
cat gofmt-diff.txt | |
- name: buildifier | |
run: | | |
go install github.com/bazelbuild/buildtools/[email protected] | |
"$(go env GOPATH)/bin/buildifier" -d -r . > buildifier-diff.txt || true | |
echo "buildifier diff:" | |
cat buildifier-diff.txt | |
- name: go deps | |
# Keep Gazelle version in sync with WORKSPACE | |
run: | | |
go install github.com/bazelbuild/bazel-gazelle/cmd/[email protected] | |
GAZELLE_PATH="$(go env GOPATH)/bin/gazelle" \ | |
GO_PATH="$(go env GOROOT)/bin/go" \ | |
./tools/fix_go_deps.sh --diff &> go-deps-diff.txt || true | |
echo "go deps diff:" | |
cat go-deps-diff.txt | |
- name: gazelle | |
run: | | |
# Invoke gazelle via bb fix for TypeScript support | |
cli/install.sh tags/5.0.21 # keep in sync with buildfix.sh | |
bb version | |
bb fix -mode diff &> gazelle-diff.txt || true | |
echo "gazelle diff:" | |
cat gazelle-diff.txt | |
- name: clang-format | |
run: | | |
git ls-files | grep '\.proto$' | xargs --no-run-if-empty -d'\n' clang-format -i --style=Google --dry-run &> clang-format-errors.txt || true | |
clang-format --version | |
echo "clang format errors:" | |
cat clang-format-errors.txt | |
- name: prettier | |
# NOTE: Only run prettier on files that differ from master, since | |
# prettier can be slow. | |
run: | | |
yarn global add [email protected] | |
# TODO(https://github.com/tj-actions/changed-files/issues/809): | |
# Use changed-files instead of git ls-files | |
# printf '%s\n' ${{ steps.changed-files.outputs.all_changed_files }} | |
git ls-files | | |
grep -P '(README|\.(js|jsx|ts|tsx|html|css|yaml|yml|json|md))$' | | |
( xargs --no-run-if-empty --delimiter='\n' "$(yarn global bin)/prettier" --check 1>/dev/null || true ) &> prettier-errors.txt | |
echo "prettier errors:" | |
cat prettier-errors.txt | |
- name: Check | |
run: | | |
echo "===== gofmt diff (fix with ./buildfix.sh) =====" | |
cat gofmt-diff.txt | |
echo "===== buildifier diff (fix with ./buildfix.sh) =====" | |
cat buildifier-diff.txt | |
echo "===== gazelle diff (fix with ./buildfix.sh --gazelle) =====" | |
cat gazelle-diff.txt | |
echo "===== go deps diff (fix with ./buildfix.sh --go_deps) =====" | |
cat go-deps-diff.txt | |
echo "===== clang-format errors (fix with ./buildfix.sh) =====" | |
cat clang-format-errors.txt | |
echo "===== prettier errors (fix with ./buildfix.sh) =====" | |
cat prettier-errors.txt | |
if [ -s gazelle-diff.txt ]; then exit 1; fi | |
if [ -s go-deps-diff.txt ]; then exit 1; fi | |
if [ -s gofmt-diff.txt ]; then exit 1; fi | |
if [ -s buildifier-diff.txt ]; then exit 1; fi | |
if [ -s clang-format-errors.txt ]; then exit 1; fi | |
if [ -s prettier-errors.txt ]; then exit 1; fi |