ci: Update ci.yml to use simpler make build to build testing binaries (#1278)

* ci: Update ci.yml to use simpler make build to build testing binaries

Signed-off-by: Mercurio <signormercurio@gmail.com>

* fix GOARCH bug in Makefile

Signed-off-by: Mercurio <signormercurio@gmail.com>

* attempt to remove some of the dependencies

Signed-off-by: Mercurio <signormercurio@gmail.com>

* sync makefile and goreleaser build flags

Signed-off-by: Mercurio <signormercurio@gmail.com>
This commit is contained in:
Mercurio
2022-07-09 01:24:29 +08:00
committed by GitHub
parent 0b91bdeb5e
commit b89d95d148
5 changed files with 17 additions and 36 deletions
-3
View File
@@ -1,3 +0,0 @@
{
"contributors": ["cuisongliu"],
}
+8 -6
View File
@@ -104,10 +104,8 @@ jobs:
- name: Install Build Dependencies
run: |
sudo apt update || true
sudo apt install -y upx
sudo apt install -y libbtrfs-dev:${{ matrix.arch }} btrfs-progs:${{ matrix.arch }}
sudo apt install -y libgpgme-dev:${{ matrix.arch }}
sudo apt update || true
sudo apt install -y libbtrfs-dev:${{ matrix.arch }} libgpgme-dev:${{ matrix.arch }}
- name: Install gcc
if: ${{ matrix.arch == 'arm64' }}
@@ -115,10 +113,14 @@ jobs:
- name: Build Binaries
run: |
make release-build BUILDSTEP=${{ matrix.binary }}-${{ matrix.arch }}
make build BINS=${{ matrix.binary }} PLATFORM=linux_${{ matrix.arch }}
- name: Compress Binaries
run: |
make compress BINS=${{ matrix.binary }} PLATFORM=linux_${{ matrix.arch }}
- name: Save binaries
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.binary }}-${{ matrix.arch }}
path: dist/${{ matrix.binary }}-${{ matrix.arch }}_linux_${{ matrix.arch }}/${{ matrix.binary }}
path: bin/linux_${{ matrix.arch}}/${{ matrix.binary }}
+2 -21
View File
@@ -17,7 +17,6 @@ before:
# You may remove this if you don't use go modules.
#- go mod download
- go generate ./...
# - apt-get install -y upx
builds:
- env:
- CGO_ENABLED=1
@@ -28,7 +27,6 @@ builds:
id: sealos-arm64
binary: sealos
hooks:
# pre: apt-get install -y libgpgme-dev:arm64 libdevmapper-dev:arm64
post: upx "{{ .Path }}"
goos:
- linux
@@ -56,7 +54,6 @@ builds:
main: ./cmd/sealos
id: sealos-amd64
hooks:
# pre: apt-get install -y libgpgme-dev libdevmapper-dev
post: upx "{{ .Path }}"
binary: sealos
goos:
@@ -80,24 +77,7 @@ builds:
- env:
- CGO_ENABLED=0
main: ./cmd/sealctl
id: sealctl-amd64
hooks:
post: upx "{{ .Path }}"
binary: sealctl
goos:
- linux
goarch:
- amd64
ldflags:
- -X github.com/labring/sealos/pkg/version.gitVersion={{.Version}}
- -X github.com/labring/sealos/pkg/version.gitCommit={{.ShortCommit}}
- -X github.com/labring/sealos/pkg/version.buildDate={{.Date}}
- -s -w
- env:
- CGO_ENABLED=0
main: ./cmd/sealctl
id: sealctl-arm64
id: sealctl
hooks:
post: upx "{{ .Path }}"
binary: sealctl
@@ -105,6 +85,7 @@ builds:
- linux
goarch:
- arm64
- amd64
ldflags:
- -X github.com/labring/sealos/pkg/version.gitVersion={{.Version}}
- -X github.com/labring/sealos/pkg/version.gitCommit={{.ShortCommit}}
+4 -4
View File
@@ -40,12 +40,12 @@ endif
# only support linux
GOOS=linux
# set a specific GOARCH
ifeq ($(origin GOARCH), undefined)
GOARCH := $(shell go env GOARCH)
endif
# set a specific PLATFORM
ifeq ($(origin PLATFORM), undefined)
ifeq ($(origin GOARCH), undefined)
GOARCH := $(shell go env GOARCH)
endif
PLATFORM := $(GOOS)_$(GOARCH)
endif
+3 -2
View File
@@ -15,12 +15,13 @@
GO := go
GO_LDFLAGS += -X $(VERSION_PACKAGE).gitVersion=${GIT_TAG} \
-X $(VERSION_PACKAGE).gitCommit=${GIT_COMMIT} \
-X $(VERSION_PACKAGE).buildDate=${BUILD_DATE}
-X $(VERSION_PACKAGE).buildDate=${BUILD_DATE} \
-s -w
ifeq ($(DEBUG), 1)
GO_BUILD_FLAGS += -gcflags "all=-N -l"
GO_LDFLAGS=
endif
GO_BUILD_FLAGS += -tags "containers_image_openpgp netgo exclude_graphdriver_devicemapper static osusergo exclude_graphdriver_btrfs" -ldflags "$(GO_LDFLAGS)"
GO_BUILD_FLAGS += -tags "containers_image_openpgp netgo exclude_graphdriver_devicemapper static osusergo exclude_graphdriver_btrfs" -trimpath -ldflags "$(GO_LDFLAGS)"
ifeq ($(ROOT_PACKAGE),)
$(error the variable ROOT_PACKAGE must be set prior to including golang.mk)