Skip to content

Commit

Permalink
Add file size check for tiny-frpc 2 binary files (#27)
Browse files Browse the repository at this point in the history
This pull request fixes #26
  • Loading branch information
blizard863 authored Jun 16, 2024
1 parent 28318b0 commit 824422a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/go-code-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ jobs:

- name: Test
run: make test

- name: Check File Size
run: make check-size
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export PATH := $(GOPATH)/bin:$(PATH)
LDFLAGS := -s -w

all: fmt build
all: fmt build check-size

build: gssh nssh

Expand All @@ -23,6 +23,17 @@ gssh:
nssh:
env CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -tags nssh -o bin/tiny-frpc-ssh ./cmd/frpc

check-size:
@echo "Checking file sizes..."
@FRPC_SIZE=$$(stat -c%s "./bin/tiny-frpc"); \
FRPC_SSH_SIZE=$$(stat -c%s "./bin/tiny-frpc-ssh"); \
if [ $$FRPC_SSH_SIZE -gt $$FRPC_SIZE ]; then \
echo "Error: tiny-frpc-ssh ($$FRPC_SSH_SIZE bytes) is larger than tiny-frpc ($$FRPC_SIZE bytes)"; \
exit 1; \
else \
echo "File size check passed: tiny-frpc-ssh ($$FRPC_SSH_SIZE bytes) is not larger than tiny-frpc ($$FRPC_SIZE bytes)"; \
fi

test: gotest

gotest:
Expand Down

0 comments on commit 824422a

Please sign in to comment.