Skip to content

Commit

Permalink
Merge pull request #781 from strukturag/keep-generated-files
Browse files Browse the repository at this point in the history
Keep generated files in the repository.
  • Loading branch information
fancycode authored Jul 24, 2024
2 parents 8776e2c + 05d5045 commit 1d68bdd
Show file tree
Hide file tree
Showing 24 changed files with 13,143 additions and 38 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/generated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: generated

on:
push:
branches: [ master ]
paths:
- '.github/workflows/generated.yml'
- 'api*.go'
- '*_easyjson.go'
- '*.pb.go'
- '*.proto'
- 'go.*'
pull_request:
branches: [ master ]
paths:
- '.github/workflows/generated.yml'
- 'api*.go'
- '*_easyjson.go'
- '*.pb.go'
- '*.proto'
- 'go.*'

permissions:
contents: read

jobs:
check-generated:
name: check-generated
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "stable"

- name: Install dependencies
run: |
sudo apt -y update && sudo apt -y install protobuf-compiler
- name: Generate files
run: |
make common
- name: Check generated files
run: |
git add *.go
git diff --cached --exit-code *.go
5 changes: 0 additions & 5 deletions .github/workflows/govuln.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ jobs:

- run: date

- name: Install dependencies
run: |
sudo apt -y update && sudo apt -y install protobuf-compiler
make common
- name: Install and run govulncheck
run: |
set -euo pipefail
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/licensecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Check for missing licenses
run: |
MISSING=$(echo "$CHECK_RESULT" | grep UNKNOWN || true)
MISSING=$(echo "$CHECK_RESULT" | grep -v "_easyjson.go" | grep UNKNOWN || true)
if [ -n "$MISSING" ]; then \
echo "$MISSING"; \
exit 1; \
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ jobs:
with:
go-version: "1.21"

- name: Install dependencies
run: |
sudo apt -y update && sudo apt -y install protobuf-compiler
make common
- name: lint
uses: golangci/[email protected]
with:
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/tarball.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ jobs:
with:
go-version: ${{ matrix.go-version }}

- name: Install dependencies
run: |
sudo apt -y update && sudo apt -y install protobuf-compiler
- name: Create tarball
run: |
echo "Building with $(nproc) threads"
Expand All @@ -61,10 +57,6 @@ jobs:
with:
go-version: ${{ matrix.go-version }}

- name: Install dependencies
run: |
sudo apt -y update && sudo apt -y install protobuf-compiler
- name: Download tarball
uses: actions/download-artifact@v4
with:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ jobs:
with:
go-version: ${{ matrix.go-version }}

- name: Install dependencies
run: |
sudo apt -y update && sudo apt -y install protobuf-compiler
- name: Build applications
run: |
echo "Building with $(nproc) threads"
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
bin/
vendor/

*_easyjson.go
*.pem
*.pb.go
*.prof
*.socket
*.tar.gz
Expand Down
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,20 @@ get:
fmt: hook | $(PROTO_GO_FILES)
$(GOFMT) -s -w *.go client proxy server

vet: common
vet:
$(GO) vet $(ALL_PACKAGES)

test: vet common
test: vet
$(GO) test -timeout $(TIMEOUT) $(TESTARGS) $(ALL_PACKAGES)

cover: vet common
cover: vet
rm -f cover.out && \
$(GO) test -timeout $(TIMEOUT) -coverprofile cover.out $(ALL_PACKAGES) && \
sed -i "/_easyjson/d" cover.out && \
sed -i "/\.pb\.go/d" cover.out && \
$(GO) tool cover -func=cover.out

coverhtml: vet common
coverhtml: vet
rm -f cover.out && \
$(GO) test -timeout $(TIMEOUT) -coverprofile cover.out $(ALL_PACKAGES) && \
sed -i "/_easyjson/d" cover.out && \
Expand All @@ -123,34 +123,34 @@ coverhtml: vet common
PATH="$(GODIR)":"$(GOPATHBIN)":$(PATH) protoc \
--go_out=. --go_opt=paths=source_relative \
$*.proto
sed -i -e '1h;2,$$H;$$!d;g' -re 's|// versions.+// source:|// source:|' $*.pb.go

%_grpc.pb.go: %.proto $(GOPATHBIN)/protoc-gen-go $(GOPATHBIN)/protoc-gen-go-grpc
PATH="$(GODIR)":"$(GOPATHBIN)":$(PATH) protoc \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
$*.proto
sed -i -e '1h;2,$$H;$$!d;g' -re 's|// versions.+// source:|// source:|' $*_grpc.pb.go

common: $(EASYJSON_GO_FILES) $(PROTO_GO_FILES)

$(BINDIR):
mkdir -p "$(BINDIR)"

client: common $(BINDIR)
client: $(BINDIR)
$(GO) build $(BUILDARGS) -ldflags '$(INTERNALLDFLAGS)' -o "$(BINDIR)/client" ./client/...

server: common $(BINDIR)
server: $(BINDIR)
$(GO) build $(BUILDARGS) -ldflags '$(INTERNALLDFLAGS)' -o "$(BINDIR)/signaling" ./server/...

proxy: common $(BINDIR)
proxy: $(BINDIR)
$(GO) build $(BUILDARGS) -ldflags '$(INTERNALLDFLAGS)' -o "$(BINDIR)/proxy" ./proxy/...

clean:
rm -f $(EASYJSON_GO_FILES)
rm -f easyjson-bootstrap*.go
rm -f $(PROTO_GO_FILES)

build: server proxy

vendor: go.mod go.sum common
vendor: go.mod go.sum
set -e ;\
rm -rf $(VENDORDIR)
$(GO) mod vendor
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ The following tools are required for building the signaling server.
- git
- go >= 1.21
- make
- protobuf-compiler >= 3

Usually the last two versions of Go are supported. This follows the release
policy of Go: https://go.dev/doc/devel/release#policy

These additional tools are required to generate code from `.proto` files.

- protobuf-compiler >= 3

All other dependencies are fetched automatically while building.

$ make build
Expand Down
Loading

0 comments on commit 1d68bdd

Please sign in to comment.