Skip to content

Commit

Permalink
GH workflow: Use distro Go, split 3rdparty-build, test steps
Browse files Browse the repository at this point in the history
  • Loading branch information
hillu committed Nov 20, 2024
1 parent f0402d2 commit f582089
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21

- name: Install cross-build dependencies
run: sudo apt-get -qq -y update && sudo apt-get -qq -y --no-install-recommends install make gcc gcc-multilib gcc-mingw-w64 autoconf automake libtool pkg-config ca-certificates wget patch sed git-core moreutils zip
run: sudo apt-get -qq -y update && sudo apt-get -qq -y --no-install-recommends install make gcc gcc-multilib gcc-mingw-w64 autoconf automake libtool pkg-config ca-certificates wget patch sed git-core moreutils zip golang-go

- name: Show info about build environment
run: |
Expand All @@ -24,9 +19,12 @@ jobs:
x86_64-w64-mingw32-gcc --version
- name: Build 3rd-party deps
run: make 3rdparty-all && make unit-test
run: make 3rdparty-all

- name: Build
- name: Run unit tests
run: make unit-test

- name: Build binaries
run: make release VERSIONSUFFIX=+$GITHUB_SHA

- name: Upload a Build Artifact
Expand All @@ -51,9 +49,12 @@ jobs:
gnu-sed gnu-tar ca-certificates zip go
- name: Build 3rd-party deps
run: gmake 3rdparty-all && gmake unit-test
run: gmake 3rdparty-all

- name: Run unit tests
run: gmake unit-test

- name: Build
- name: Build binaries
run: gmake release VERSIONSUFFIX=+$GITHUB_SHA

- name: Upload a Build Artifact
Expand Down
12 changes: 10 additions & 2 deletions 3rdparty.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,20 @@ endef
# Determine host architecture:
3rdparty_NATIVE_ARCH := $(shell cc -dumpmachine)
# Determine target architectures:
# On Linux/x86, we can cross-build for Linux and Windows.
# On Linux, we can cross-build for Windows.
# On other systems, we only build for the respective host architecture
$(or \
$(if $(or $(findstring x86_64-linux-gnu,$(3rdparty_NATIVE_ARCH)),\
$(findstring x86_64-redhat-linux,$(3rdparty_NATIVE_ARCH))),\
$(eval 3rdparty_ARCHS=i386-linux-musl x86_64-linux-musl i686-w64-mingw32 x86_64-w64-mingw32)\
$(eval 3rdparty_ARCHS=\
i386-linux-musl x86_64-linux-musl \
i686-w64-mingw32 x86_64-w64-mingw32)\
$(foreach arch,i686-w64-mingw32 x86_64-w64-mingw32,\
$(if $(not $(shell which $(arch)-gcc)),$(error $(arch)-gcc not found)))),\
$(if $(findstring -linux-gnu,$(3rdparty_NATIVE_ARCH)),\
$(eval 3rdparty_ARCHS=\
$(patsubst %-linux-gnu,%-linux-musl,$(3rdparty_NATIVE_ARCH)) \
i686-w64-mingw32 x86_64-w64-mingw32)\
$(foreach arch,i686-w64-mingw32 x86_64-w64-mingw32,\
$(if $(not $(shell which $(arch)-gcc)),$(error $(arch)-gcc not found)))),\
$(if $(or $(findstring -linux-gnu,$(3rdparty_NATIVE_ARCH))),\
Expand Down

0 comments on commit f582089

Please sign in to comment.