Skip to content

Commit

Permalink
ci: add cross build
Browse files Browse the repository at this point in the history
Signed-off-by: Kir Kolyshkin <[email protected]>
  • Loading branch information
kolyshkin committed Jul 1, 2020
1 parent 86f20af commit 2cb4baa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ jobs:
run: make test
- name: Lint
run: make lint
- name: Cross build
if: ${{ runner.os == 'Linux' }}
run: make cross
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
.SHELLFLAGS = -ec
PACKAGES ?= mountinfo mount
BINDIR ?= _build/bin
CROSS_OSES ?= linux freebsd darwin windows
CROSS_ARCHES ?= amd64 arm arm64 ppc64le s390x
OS_ARCH_SKIP = '^((freebsd|darwin|windows)/(ppc64le|s390x)|windows/arm64|freebsd/s390x)$$'

.PHONY: all
all: lint test
all: lint test cross

.PHONY: test
test:
Expand All @@ -24,3 +27,15 @@ $(BINDIR)/golangci-lint: $(BINDIR)

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

.PHONY: cross
cross:
for os in $(CROSS_OSES); do \
for arch in $(CROSS_ARCHES); do \
echo "$$os/$$arch" | grep -qE $(OS_ARCH_SKIP) && continue; \
echo "# building for $$os/$$arch"; \
for p in $(PACKAGES); do \
(cd $$p && GOOS=$$os GOARCH=$$arch go build .); \
done; \
done; \
done

0 comments on commit 2cb4baa

Please sign in to comment.