Skip to content

Commit 4a1ce08

Browse files
committed
[SP-2993] chore: update workflows and makefile
1 parent aafe6c3 commit 4a1ce08

File tree

3 files changed

+31
-19
lines changed

3 files changed

+31
-19
lines changed

.github/workflows/go-ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@ name: Go Unit Test
44
on:
55
workflow_dispatch:
66
push:
7-
branches: [ "main" ]
7+
branches: ["main"]
88
pull_request:
9-
branches: [ "main" ]
9+
branches: ["main"]
1010

1111
jobs:
1212
build:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v4
1616
with:
17-
fetch-depth: 0 # Get tags to allow build script to get build version
17+
fetch-depth: 0 # Get tags to allow build script to get build version
1818

1919
- name: Set up Go
2020
uses: actions/setup-go@v5
2121
with:
2222
go-version: 1.22.x
2323

2424
- name: Build
25-
run: make build_amd
25+
run: make build_amd64
2626

2727
- name: Unit Test
28-
run: make unit_test
28+
run: make test

.github/workflows/release.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ jobs:
2121

2222
- name: Build API and Import Scripts
2323
run: |
24-
make build_amd
25-
make build_arm
26-
make build_import_amd
27-
make build_import_arm
24+
make build_amd64
25+
make build_arm64
26+
make build_import_amd64
27+
make build_import_arm64
2828
2929
- name: Unit Test
3030
run: make unit_test
3131

3232
- name: Package
3333
run: |
34-
make package_amd
35-
make package_arm
34+
make package_amd64
35+
make package_arm64
3636
3737
- name: Release
3838
uses: softprops/action-gh-release@v1
@@ -45,4 +45,3 @@ jobs:
4545
target/scanoss-hfh-import-linux-arm64
4646
scanoss-folder-hashing-api_linux-amd64_${{ github.ref_name }}-1.tgz
4747
scanoss-folder-hashing-api_linux-arm64_${{ github.ref_name }}-1.tgz
48-

Makefile

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ vet: ## Run go vet
4242
@go vet ./...
4343

4444
# Build
45-
build: build-amd64 build-arm64 ## Build binaries for all architectures
45+
build: build_amd64 build_arm64 ## Build binaries for all architectures
4646

47-
build-amd64: ## Build AMD64 binary
47+
build_amd64: ## Build AMD64 binary
4848
@mkdir -p $(BUILD_DIR)
4949
@GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/folder-hashing-api-linux-amd64 ./cmd/server
5050

51-
build-arm64: ## Build ARM64 binary
51+
build_arm64: ## Build ARM64 binary
5252
@mkdir -p $(BUILD_DIR)
5353
@GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/folder-hashing-api-linux-arm64 ./cmd/server
5454

55-
build-import-amd64: ## Build import tool (AMD64)
55+
build_import_amd64: ## Build import tool (AMD64)
5656
@mkdir -p $(BUILD_DIR)
5757
@GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-w -s -X main.Version=$(VERSION)" -o $(BUILD_DIR)/hfh-import-linux-amd64 ./cmd/import
5858

59-
build-import-arm64: ## Build import tool (ARM64)
59+
build_import_arm64: ## Build import tool (ARM64)
6060
@mkdir -p $(BUILD_DIR)
6161
@GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="-w -s -X main.Version=$(VERSION)" -o $(BUILD_DIR)/hfh-import-linux-arm64 ./cmd/import
6262

@@ -69,8 +69,21 @@ tidy: ## Tidy and verify dependencies
6969
@go mod tidy
7070
@go mod verify
7171

72-
version: ## Show current version
73-
@echo $(VERSION)
72+
version: ## Display current version
73+
@echo "Current version: $(VERSION)"
7474

7575
# Quality checks (CI)
7676
ci: lint test ## Run all CI checks
77+
78+
# Packaging
79+
package_amd64: version ## Build & Package an AMD 64 binary
80+
@echo "Building AMD binary $(VERSION) and placing into scripts..."
81+
go generate ./cmd/server/main.go
82+
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-w -s" -o ./scripts/scanoss-folder-hashing-api ./cmd/server/main.go
83+
bash ./package-scripts.sh linux-amd64 $(VERSION)
84+
85+
package_arm64: version ## Build & Package an ARM 64 binary
86+
@echo "Building ARM binary $(VERSION) and placing into scripts..."
87+
go generate ./cmd/server/main.go
88+
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="-w -s" -o ./scripts/scanoss-folder-hashing-api ./cmd/server/main.go
89+
bash ./package-scripts.sh linux-arm64 $(VERSION)

0 commit comments

Comments
 (0)