From ba67df46ee235bdfdbc98d1465dab9de69bf0983 Mon Sep 17 00:00:00 2001 From: Namho Kim Date: Thu, 9 Nov 2023 11:47:33 -0800 Subject: [PATCH] migrate github workflows from core --- .github/workflows/lint-golang.yml | 53 +++++++++++++++++++ .../workflows/redpanda-migration-build.yml | 44 +++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 .github/workflows/lint-golang.yml create mode 100644 .github/workflows/redpanda-migration-build.yml diff --git a/.github/workflows/lint-golang.yml b/.github/workflows/lint-golang.yml new file mode 100644 index 000000000..14bdb388d --- /dev/null +++ b/.github/workflows/lint-golang.yml @@ -0,0 +1,53 @@ +name: Lint golang + +on: + push: + branches: + - 'main' + paths: + - 'src/go/**' + tags-ignore: + - '**' + pull_request: + paths: + - 'src/go/**' + +jobs: + go: + name: Lint go files + runs-on: ubuntu-latest + steps: + + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup go + uses: actions/setup-go@v3 + with: + go-version: stable + + - name: Install gofumpt + env: + GOFUMPT_VER: 0.5.0 + run: | + mkdir -v -p "$HOME/.local/bin" + wget -O "$HOME/.local/bin/gofumpt" "https://github.com/mvdan/gofumpt/releases/download/v${GOFUMPT_VER}/gofumpt_v${GOFUMPT_VER}_linux_amd64" + chmod 0700 "$HOME/.local/bin/gofumpt" + + - name: Run gofumpt + run: | + find src/go -type f -not -name 'zz*' -name '*.go' | xargs -n1 "$HOME/.local/bin/gofumpt" -w -lang=1.20 + git diff --exit-code + + - name: go mod tidy (cluster-to-redpanda-migration) + working-directory: src/go/cluster-to-redpanda-migration + run: | + go mod tidy + git diff --exit-code -- go.mod go.sum + + - name: go mod tidy (k8s) + working-directory: src/go/k8s + run: | + go mod tidy + git diff --exit-code -- go.mod go.sum + diff --git a/.github/workflows/redpanda-migration-build.yml b/.github/workflows/redpanda-migration-build.yml new file mode 100644 index 000000000..8bb6ebdf9 --- /dev/null +++ b/.github/workflows/redpanda-migration-build.yml @@ -0,0 +1,44 @@ +# Copyright 2020 Redpanda Data, Inc. +# +# Use of this software is governed by the Business Source License +# included in the file licenses/BSL.md +# +# As of the Change Date specified in that file, in accordance with +# the Business Source License, use of this software will be governed +# by the Apache License, Version 2.0 + +name: cluster-to-redpanda-migration +on: + push: + branches: + - '*' + pull_request: + branches: + - main + - 'v*' + paths: + - .github/workflows/redpanda-migration-build.yml + - 'src/go/cluster-to-redpanda-migration/**' + - 'src/go/k8s/**' + +jobs: + test: + name: Test cluster-to-redpanda-migration + strategy: + matrix: + os: [linux, darwin, windows] + arch: [amd64, arm64] + runs-on: ubuntu-latest + steps: + + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: stable + + - name: Run tests + working-directory: src/go/cluster-to-redpanda-migration/ + run: go test -v ./...