Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Commit 22f29d4

Browse files
committed
modify Makefile and run tests on Darwin in CI
Signed-off-by: Sanskar Jaiswal <[email protected]>
1 parent 93a33be commit 22f29d4

File tree

2 files changed

+11
-36
lines changed

2 files changed

+11
-36
lines changed

.github/workflows/build.yaml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,15 @@ jobs:
2222
steps:
2323
- name: Checkout
2424
uses: actions/checkout@v2
25-
- name: Test build script for darwin-amd64
25+
- name: Test build script for darwin-amd64 - libgit2-all
2626
run: |
27-
TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64 \
28-
BUILD_ROOT_DIR=${GITHUB_WORKSPACE}/libgit2/build/amd \
29-
./hack/static.sh all
27+
make dev-test
28+
rm -rf ${GITHUB_WORKSPACE}/build rm -rf ${GITHUB_WORKSPACE}/libgit2
3029
env:
3130
MACOSX_DEPLOYMENT_TARGET: 10.15
32-
- name: Test cross compile script for darwin-arm64
31+
- name: Test build script for darwin-amd64 - libgit2-only
3332
run: |
34-
TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64 \
35-
BUILD_ROOT_DIR=${GITHUB_WORKSPACE}/libgit2/build/arm \
36-
TARGET_ARCH=arm64 \
37-
CMAKE_APPLE_SILICON_PROCESSOR=arm64 \
38-
./hack/static.sh all
33+
LIBGIT2_ONLY=true make dev-test
3934
env:
4035
MACOSX_DEPLOYMENT_TARGET: 10.15
4136

Makefile

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ TAG ?= latest
22

33
ifeq ($(LIBGIT2_ONLY),true)
44
IMG ?= ghcr.io/fluxcd/golang-with-libgit2-only
5+
DOCKERFILE ?= Dockerfile.libgit2-only
56
else
67
IMG ?= ghcr.io/fluxcd/golang-with-libgit2-all
8+
DOCKERFILE ?= Dockerfile
79
endif
810

911
PLATFORMS ?= linux/amd64,linux/arm/v7,linux/arm64
@@ -43,51 +45,33 @@ GO_STATIC_FLAGS=-tags 'netgo,osusergo,static_build'
4345

4446
.PHONY: build
4547
build:
46-
ifeq ($(LIBGIT2_ONLY),true)
47-
docker buildx build \
48-
--platform=$(PLATFORMS) \
49-
--tag $(IMG):$(TAG) \
50-
--file Dockerfile.libgit2-only \
51-
$(BUILD_ARGS) .
52-
else
5348
docker buildx build \
5449
--platform=$(PLATFORMS) \
5550
--tag $(IMG):$(TAG) \
56-
--file Dockerfile \
51+
--file $(DOCKERFILE) \
5752
$(BUILD_ARGS) .
58-
endif
5953

6054
.PHONY: test
6155
test:
62-
ifeq ($(LIBGIT2_ONLY),true)
63-
docker buildx build \
64-
--platform=$(PLATFORMS) \
65-
--tag $(IMG):$(TAG)-test \
66-
--build-arg LIBGIT2_IMG=$(IMG) \
67-
--build-arg LIBGIT2_TAG=$(TAG) \
68-
--file Dockerfile.test-libgit2-only \
69-
$(BUILD_ARGS) .
70-
else
7156
docker buildx build \
7257
--platform=$(PLATFORMS) \
7358
--tag $(IMG):$(TAG)-test \
7459
--build-arg LIBGIT2_IMG=$(IMG) \
7560
--build-arg LIBGIT2_TAG=$(TAG) \
76-
--file Dockerfile.test \
61+
--file $(DOCKERFILE) \
7762
$(BUILD_ARGS) .
78-
endif
7963

8064
.PHONY: builder
8165
builder:
82-
# create local builder
66+
# create local builder
8367
docker buildx create --name local-builder \
8468
--platform $(PLATFORMS) \
8569
--driver-opt network=host \
8670
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=1073741274 \
8771
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SPEED=5000000000000 \
8872
--buildkitd-flags '--allow-insecure-entitlement security.insecure' \
8973
--use
90-
# install qemu emulators
74+
# install qemu emulators
9175
docker run -it --rm --privileged tonistiigi/binfmt --install all
9276

9377
$(LIBGIT2): $(MUSL-CC)
@@ -100,11 +84,7 @@ else
10084
./hack/static.sh all
10185
endif
10286
else
103-
ifeq ($(LIBGIT2_ONLY),true)
10487
IMG_TAG=$(IMG):$(TAG) ./hack/extract-libraries.sh
105-
else
106-
IMG_TAG=$(IMG):$(TAG) ./hack/extract-libraries.sh
107-
endif
10888
endif
10989

11090
$(MUSL-CC):

0 commit comments

Comments
 (0)