-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ondra Machacek <[email protected]>
- Loading branch information
1 parent
f7e87ad
commit e8e6f0f
Showing
3 changed files
with
22 additions
and
25 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,35 +15,16 @@ jobs: | |
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
|
||
- name: Test | ||
- name: Prepare | ||
run: | | ||
touch rhcos-live.x86_64.iso | ||
make generate | ||
make build | ||
DOWNLOAD_RHCOS=false make build | ||
- name: Test | ||
run: | | ||
make test | ||
- name: Checking generated files are up to date | ||
run: | | ||
if [[ $(git ls-files --others --exclude-standard) ]]; then git ls-files --others --exclude-standard; echo "These files are not tracked by git"; exit 1; fi | ||
if [ -n "$(git status --porcelain)" ]; then echo "There are uncommitted changes:"; git status --short; exit 1; fi | ||
Lint: | ||
name: Lint code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Run golangci-lint | ||
uses: golangci/[email protected] | ||
with: | ||
args: --timeout=2m | ||
|
||
YamlLint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: ⤵️ Check out code from GitHub | ||
uses: actions/checkout@v4 | ||
- name: 🚀 Run yamllint | ||
run: | | ||
yamllint -f github -c .yamllint . |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ examples/config.ign | |
examples/config.yaml | ||
*.local.* | ||
/tmp/ | ||
cover.out |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ MIGRATION_PLANNER_AGENT_IMAGE ?= quay.io/kubev2v/migration-planner-agent | |
MIGRATION_PLANNER_COLLECTOR_IMAGE ?= quay.io/kubev2v/migration-planner-collector | ||
MIGRATION_PLANNER_API_IMAGE ?= quay.io/kubev2v/migration-planner-api | ||
MIGRATION_PLANNER_UI_IMAGE ?= quay.io/kubev2v/migration-planner-ui | ||
DOWNLOAD_RHCOS ?= true | ||
|
||
SOURCE_GIT_TAG ?=$(shell git describe --always --long --tags --abbrev=7 --match 'v[0-9]*' || echo 'v0.0.0-unknown-$(SOURCE_GIT_COMMIT)') | ||
SOURCE_GIT_TREE_STATE ?=$(shell ( ( [ ! -d ".git/" ] || git diff --quiet ) && echo 'clean' ) || echo 'dirty') | ||
|
@@ -42,6 +43,18 @@ help: | |
@echo " build: run all builds" | ||
@echo " clean: clean up all containers and volumes" | ||
|
||
GOBIN = $(shell pwd)/bin | ||
GINKGO = $(GOBIN)/ginkgo | ||
ginkgo: ## Download ginkgo locally if necessary. | ||
ifeq (, $(shell which ginkgo 2> /dev/null)) | ||
go install -v github.com/onsi/ginkgo/v2/[email protected] | ||
endif | ||
|
||
TEST_PACKAGES := ./... | ||
GINKGO_OPTIONS ?= --skip e2e | ||
test: ginkgo | ||
$(GINKGO) --cover -output-dir=. -coverprofile=cover.out -v --show-node-events $(GINKGO_OPTIONS) $(TEST_PACKAGES) | ||
|
||
generate: | ||
go generate -v $(shell go list ./...) | ||
hack/mockgen.sh | ||
|
@@ -50,10 +63,12 @@ tidy: | |
git ls-files go.mod '**/*go.mod' -z | xargs -0 -I{} bash -xc 'cd $$(dirname {}) && go mod tidy' | ||
|
||
lint: tools | ||
$(GOBIN)/golangci-lint run -v | ||
$(GOBIN)/golangci-lint run -v --timeout 2m | ||
|
||
image: | ||
ifeq ($(DOWNLOAD_RHCOS), true) | ||
curl --silent -C - -O https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos/latest/rhcos-live.x86_64.iso | ||
endif | ||
|
||
build: bin image | ||
go build -buildvcs=false $(GO_BUILD_FLAGS) -o $(GOBIN) ./cmd/... | ||
|