Skip to content

Commit

Permalink
PMM-12899 clean up the code
Browse files Browse the repository at this point in the history
  • Loading branch information
ademidoff committed Jun 13, 2024
1 parent 88d0b35 commit d0e12a3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/managed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,9 @@ jobs:
run: docker exec -t pmm-server supervisorctl status

- name: Run tests
if: ${{ !env.ACT }}
run: docker exec -i pmm-server make -C managed test-cover

- name: Upload coverage results
if: ${{ !env.ACT }}
uses: codecov/codecov-action@v4
with:
file: managed/cover.out
Expand All @@ -88,7 +86,7 @@ jobs:
# docker exec -i pmm-server make -C managed test-update
- name: Save PMM Go module and build cache as an image
if: ${{ env.BUILD_CACHE }}
if: ${{ fromJSON(env.BUILD_CACHE) }}
run: |
df -h | grep -A 1 Filesystem
# We need to free up some space, see more https://github.com/actions/runner-images/issues/2840
Expand All @@ -101,15 +99,15 @@ jobs:
docker rm -v pmm-cache
- name: Login to ghcr.io registry
if: ${{ env.BUILD_CACHE }}
if: ${{ fromJSON(env.BUILD_CACHE) }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push the image to ghcr.io
if: ${{ env.BUILD_CACHE }}
if: ${{ fromJSON(env.BUILD_CACHE) }}
run: docker push ${{ env.PMM_CACHE_IMAGE }}

- name: Run debug commands
Expand Down
18 changes: 8 additions & 10 deletions managed/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ PMM_LD_FLAGS = -ldflags " \
-X 'github.com/percona/pmm/version.Branch=$(PMM_RELEASE_BRANCH)' \
"

IS_ARM := $(filter arm64,$(shell uname -m))
PMM_RACE_FLAG ?= $(if $(IS_ARM),,-race)

PMM_TEST_FLAGS ?= -timeout=180s
PMM_TEST_RUN_UPDATE ?= 0
PMM_TEST_FILES ?= ./...

gen: clean ## Generate files
go generate ./...

Expand All @@ -36,17 +43,8 @@ release-starlark:
env CGO_ENABLED=0 go build -v $(PMM_LD_FLAGS) -o $(PMM_RELEASE_PATH)/ ./cmd/pmm-managed-starlark/...
$(PMM_RELEASE_PATH)/pmm-managed-starlark --version

ARCH=$(shell uname -m)
release-dev: ## Build pmm-managed binaries for development
if [ $(ARCH) = "aarch64" ]; then \
go build -gcflags="all=-N -l" -v $(PMM_LD_FLAGS) -o $(PMM_RELEASE_PATH)/ ./cmd/... ; \
else \
go build -race -gcflags="all=-N -l" -v $(PMM_LD_FLAGS) -o $(PMM_RELEASE_PATH)/ ./cmd/... ; \
fi

PMM_TEST_FLAGS ?= -timeout=180s
PMM_TEST_RUN_UPDATE ?= 0
PMM_TEST_FILES ?= ./...
go build $(PMM_RACE_FLAG) -gcflags="all=-N -l" -v $(PMM_LD_FLAGS) -o $(PMM_RELEASE_PATH)/ ./cmd/...

test: ## Run tests
go test $(PMM_TEST_FLAGS) -p 1 -race $(PMM_TEST_FILES)
Expand Down

0 comments on commit d0e12a3

Please sign in to comment.