From 3f9e9a82dcd89d34e2270b7d3cf02e615b836bb5 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Fri, 14 Jan 2022 19:59:30 +0100 Subject: [PATCH 1/9] Attempt at building multi-platform builder --- .woodpecker/.build.yml | 1 + .woodpecker/.builder.yml | 6 ++++-- .woodpecker/.lint.yml | 1 + .woodpecker/.publish.yml | 1 + Dockerfile.builder | 22 +++++++++++----------- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index cc66bc7..12610e4 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -1,6 +1,7 @@ # These checks already get performed on the feature branches branches: exclude: [ main, dev ] +platform: linux/amd64 pipeline: vieter: diff --git a/.woodpecker/.builder.yml b/.woodpecker/.builder.yml index ec4a36e..8a1329a 100644 --- a/.woodpecker/.builder.yml +++ b/.woodpecker/.builder.yml @@ -1,13 +1,15 @@ -branches: dev +# branches: dev +platform: linux/amd64 pipeline: publish: - image: plugins/docker + image: woodpeckerci/plugin-docker-buildx secrets: [ docker_username, docker_password ] settings: repo: chewingbever/vlang tag: latest dockerfile: Dockerfile.builder + platforms: [ linux/arm/v7, linux/arm64/v8, linux/amd64 ] when: event: push path: Dockerfile.builder diff --git a/.woodpecker/.lint.yml b/.woodpecker/.lint.yml index ae47c32..380b3d4 100644 --- a/.woodpecker/.lint.yml +++ b/.woodpecker/.lint.yml @@ -1,6 +1,7 @@ # These checks already get performed on the feature branches branches: exclude: [ main, dev ] +platform: linux/amd64 pipeline: lint: diff --git a/.woodpecker/.publish.yml b/.woodpecker/.publish.yml index 34a3675..fa958ca 100644 --- a/.woodpecker/.publish.yml +++ b/.woodpecker/.publish.yml @@ -1,4 +1,5 @@ branches: [main, dev] +platform: linux/amd64 pipeline: dev: diff --git a/Dockerfile.builder b/Dockerfile.builder index d45fe83..4691c8e 100644 --- a/Dockerfile.builder +++ b/Dockerfile.builder @@ -8,17 +8,17 @@ ENV VVV /opt/vlang ENV PATH /opt/vlang:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ENV VFLAGS -cc gcc -RUN mkdir -p /opt/vlang && ln -s /opt/vlang/v /usr/bin/v - -RUN apk --no-cache add \ - git make upx gcc bash \ - musl-dev \ - openssl-libs-static openssl-dev \ - zlib-static bzip2-static xz-dev expat-static zstd-static lz4-static \ - sqlite-static sqlite-dev \ - libx11-dev glfw-dev freetype-dev \ - libarchive-static libarchive-dev \ - diffutils +RUN mkdir -p /opt/vlang && \ + ln -s /opt/vlang/v /usr/bin/v && \ + apk --no-cache add \ + git make upx gcc bash \ + musl-dev \ + openssl-libs-static openssl-dev \ + zlib-static bzip2-static xz-dev expat-static zstd-static lz4-static \ + sqlite-static sqlite-dev \ + libx11-dev glfw-dev freetype-dev \ + libarchive-static libarchive-dev \ + diffutils COPY . /vlang-local From 0b6c20140d7a1e0ab16d21ff1be7f9946d69ead3 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Fri, 14 Jan 2022 20:05:02 +0100 Subject: [PATCH 2/9] Removed upx dep --- Dockerfile.builder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.builder b/Dockerfile.builder index 4691c8e..6635f3b 100644 --- a/Dockerfile.builder +++ b/Dockerfile.builder @@ -11,7 +11,7 @@ ENV VFLAGS -cc gcc RUN mkdir -p /opt/vlang && \ ln -s /opt/vlang/v /usr/bin/v && \ apk --no-cache add \ - git make upx gcc bash \ + git make gcc bash \ musl-dev \ openssl-libs-static openssl-dev \ zlib-static bzip2-static xz-dev expat-static zstd-static lz4-static \ From 3ee796f0a57740e2a4c0207b372dabeb45e27560 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Fri, 14 Jan 2022 20:10:40 +0100 Subject: [PATCH 3/9] Removed bash from builder --- Dockerfile.builder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.builder b/Dockerfile.builder index 6635f3b..48048f8 100644 --- a/Dockerfile.builder +++ b/Dockerfile.builder @@ -11,7 +11,7 @@ ENV VFLAGS -cc gcc RUN mkdir -p /opt/vlang && \ ln -s /opt/vlang/v /usr/bin/v && \ apk --no-cache add \ - git make gcc bash \ + git make gcc \ musl-dev \ openssl-libs-static openssl-dev \ zlib-static bzip2-static xz-dev expat-static zstd-static lz4-static \ From 3acce6df0f9596825ac44b67ca79d9fc90772f5b Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Fri, 14 Jan 2022 20:30:56 +0100 Subject: [PATCH 4/9] Added arm64 tests (hopefully) --- .woodpecker/.build_arm64.yml | 25 +++++++++++++++++++++++++ .woodpecker/.builder.yml | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .woodpecker/.build_arm64.yml diff --git a/.woodpecker/.build_arm64.yml b/.woodpecker/.build_arm64.yml new file mode 100644 index 0000000..33d5f3f --- /dev/null +++ b/.woodpecker/.build_arm64.yml @@ -0,0 +1,25 @@ +# These checks already get performed on the feature branches +branches: + exclude: [ main, dev ] +platform: linux/arm64 + +pipeline: + vieter: + image: 'chewingbever/vlang:latest' + group: 'build' + commands: + - make vieter + + debug: + image: 'chewingbever/vlang:latest' + group: 'build' + commands: + - make debug + + prod: + image: 'chewingbever/vlang:latest' + environment: + - LDFLAGS=-lz -lbz2 -llzma -lexpat -lzstd -llz4 -static + group: 'build' + commands: + - make prod diff --git a/.woodpecker/.builder.yml b/.woodpecker/.builder.yml index 8a1329a..f827566 100644 --- a/.woodpecker/.builder.yml +++ b/.woodpecker/.builder.yml @@ -1,4 +1,4 @@ -# branches: dev +branches: dev platform: linux/amd64 pipeline: From d3dc0abc5bdca34390ad4dd85145b1941897849b Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Fri, 14 Jan 2022 20:38:36 +0100 Subject: [PATCH 5/9] Added check for static binary --- .woodpecker/.build_arm64.yml | 2 ++ .woodpecker/.publish.yml | 3 +++ 2 files changed, 5 insertions(+) diff --git a/.woodpecker/.build_arm64.yml b/.woodpecker/.build_arm64.yml index 33d5f3f..3d8843b 100644 --- a/.woodpecker/.build_arm64.yml +++ b/.woodpecker/.build_arm64.yml @@ -23,3 +23,5 @@ pipeline: group: 'build' commands: - make prod + # Make sure the binary is actually static + - [ "$(readelf -d pvieter) | grep NEEDED | wc -l" = 0 ] diff --git a/.woodpecker/.publish.yml b/.woodpecker/.publish.yml index fa958ca..002fdbd 100644 --- a/.woodpecker/.publish.yml +++ b/.woodpecker/.publish.yml @@ -24,3 +24,6 @@ pipeline: when: event: tag branch: main + +depends_on: + builder From d1f867e511f7c3b5ab86e26c32903c2c44e85d74 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Fri, 14 Jan 2022 20:39:06 +0100 Subject: [PATCH 6/9] Sorry for the typo --- .woodpecker/.build_arm64.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/.build_arm64.yml b/.woodpecker/.build_arm64.yml index 3d8843b..fa3e2fb 100644 --- a/.woodpecker/.build_arm64.yml +++ b/.woodpecker/.build_arm64.yml @@ -24,4 +24,4 @@ pipeline: commands: - make prod # Make sure the binary is actually static - - [ "$(readelf -d pvieter) | grep NEEDED | wc -l" = 0 ] + - '[ "$(readelf -d pvieter) | grep NEEDED | wc -l" = 0 ]' From 641a9783a629959907089db02bc938ee911c755d Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Fri, 14 Jan 2022 20:39:44 +0100 Subject: [PATCH 7/9] Another one --- .woodpecker/.publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/.publish.yml b/.woodpecker/.publish.yml index 002fdbd..d23f63c 100644 --- a/.woodpecker/.publish.yml +++ b/.woodpecker/.publish.yml @@ -26,4 +26,4 @@ pipeline: branch: main depends_on: - builder + - builder From 9af37819f3189f623c0bc42504bd3bf399807b0c Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Fri, 14 Jan 2022 20:41:42 +0100 Subject: [PATCH 8/9] Added static test to amd64 builds as well --- .woodpecker/.build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index 12610e4..f94e1ab 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -23,3 +23,5 @@ pipeline: group: 'build' commands: - make prod + # Make sure the binary is actually static + - '[ "$(readelf -d pvieter) | grep NEEDED | wc -l" = 0 ]' From 8a8c7fab838a261793f1a80a88079a77bd65748f Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Fri, 14 Jan 2022 20:43:11 +0100 Subject: [PATCH 9/9] Of course I made another typo --- .woodpecker/.build.yml | 3 ++- .woodpecker/.build_arm64.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index f94e1ab..83dcb0e 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -24,4 +24,5 @@ pipeline: commands: - make prod # Make sure the binary is actually static - - '[ "$(readelf -d pvieter) | grep NEEDED | wc -l" = 0 ]' + - readelf -d pvieter + - '[ "$(readelf -d pvieter | grep NEEDED | wc -l)" = 0 ]' diff --git a/.woodpecker/.build_arm64.yml b/.woodpecker/.build_arm64.yml index fa3e2fb..704bc48 100644 --- a/.woodpecker/.build_arm64.yml +++ b/.woodpecker/.build_arm64.yml @@ -24,4 +24,5 @@ pipeline: commands: - make prod # Make sure the binary is actually static - - '[ "$(readelf -d pvieter) | grep NEEDED | wc -l" = 0 ]' + - readelf -d pvieter + - '[ "$(readelf -d pvieter | grep NEEDED | wc -l)" = 0 ]'