From ca9882b036fc5ef2f608c5073535d22ae60cfc65 Mon Sep 17 00:00:00 2001 From: Alexander Hansen Date: Wed, 11 Sep 2024 18:14:58 +0200 Subject: [PATCH] ci: Add basic ci build changed the go version to make the ci work. The filename for the binary is chosen to match the existing tool. Signed-off-by: Alexander Hansen --- .github/workflows/ci-build.yml | 35 ++++++++++++++++++++++++++++++++++ .gitignore | 2 +- Makefile | 14 ++++++++++++++ go.mod | 2 +- 4 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci-build.yml create mode 100644 Makefile diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml new file mode 100644 index 0000000..0fcc34e --- /dev/null +++ b/.github/workflows/ci-build.yml @@ -0,0 +1,35 @@ +--- + +name: build +on: + pull_request: + merge_group: + push: + branches: ['main'] + tags: ['v*'] + +permissions: + contents: read + +jobs: + build-cross: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: install dependencies + shell: bash + run: sudo apt-get install -y golang make + - name: build + shell: bash + run: make cross + + build-native: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: install dependencies + shell: bash + run: sudo apt-get install -y golang make + - name: build + shell: bash + run: make native diff --git a/.gitignore b/.gitignore index e1d66c3..0d774fb 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -bmc-test-go +bmc-test-* diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ced8bec --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +all: cross native + +# the CGO_ENABLED=0 +# is used to not rely on libc, to use +# in on debian for the host, as it has different libc. + +native: + env CGO_ENABLED=0 go build -o bmc-test-x86 +cross: + env GOOS=linux GOARCH=arm GOARM=5 go build -o bmc-test-armv5 + ln -s -f bmc-test-armv5 bmc-test-cross + +clean: + rm -f bmc-test-cross bmc-test-armv5 bmc-test-x86 diff --git a/go.mod b/go.mod index f8c9cd0..399218a 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/9elements/bmc-test-go -go 1.23.1 +go 1.23