From 4a99bd3462b36c712863b7eca1b22a33fe0b5da7 Mon Sep 17 00:00:00 2001 From: Augustin Husson Date: Tue, 14 Nov 2023 15:03:57 +0100 Subject: [PATCH] [IGNORE] enable ci Signed-off-by: Augustin Husson --- .github/workflows/ci.yaml | 35 +++++++++++++++++++++++ .github/workflows/go.yml | 60 +++++++++++++++++++++++++++++++++++++++ Makefile | 12 ++++++++ 3 files changed, 107 insertions(+) create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/go.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..7fd3aa1 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,35 @@ +name: ci +on: + push: + branches: + - main + - release/* + - snapshot/* + tags: + - v* + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' || github.ref_name != 'main' }} + +jobs: + build: + name: "go and github release" + runs-on: ubuntu-latest + permissions: + contents: write + env: + # This env is required for the docker manifest command to work + DOCKER_CLI_EXPERIMENTAL: "enabled" + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: perses/github-actions@v0.1.0 + - uses: ./.github/perses-ci/actions/setup_environment + with: + enable_go: true + - name: Build operator + run: make build diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..4c57a06 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,60 @@ +name: go +on: + push: + branches: + - main + - release/* + - snapshot/* + tags: + - v* + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' || github.ref_name != 'main' }} + +jobs: + gofmt: + name: "check code format" + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + - uses: perses/github-actions@v0.1.0 + - uses: ./.github/perses-ci/actions/setup_environment + with: + enable_go: true + - name: check format + run: make checkformat + - name: check go.mod + run: make checkunused + test: + name: "tests" + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + - uses: perses/github-actions@v0.1.0 + - uses: ./.github/perses-ci/actions/setup_environment + with: + enable_go: true + - name: test + run: make test + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + - uses: perses/github-actions@v0.1.0 + - uses: ./.github/perses-ci/actions/setup_environment + with: + enable_go: true + - name: generate files + run: make generate + - name: golangci-lint + uses: golangci/golangci-lint-action@v3.7.0 + with: + # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. + version: v1.54.2 + args: --timeout 5m diff --git a/Makefile b/Makefile index 4864b09..37797e7 100644 --- a/Makefile +++ b/Makefile @@ -87,6 +87,18 @@ all: build help: ## Display this help. @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) + +.PHONY: checkformat +checkformat: + @echo ">> checking go code format" + ! gofmt -d $$(find . -name '*.go' -not -path "./ui/*" -print) | grep '^' + +.PHONY: checkunused +checkunused: + @echo ">> running check for unused/missing packages in go.mod" + go mod tidy + @git diff --exit-code -- go.sum go.mod + ##@ Development .PHONY: manifests