From 7460f9c71b05469489750f21a31399e97074681f Mon Sep 17 00:00:00 2001 From: Timur Zununbekov Date: Tue, 19 Mar 2024 11:41:40 +0600 Subject: [PATCH 1/3] Add "PackageLinuxDebianArmv6l" CI build target --- .github/workflows/build-packages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-packages.yml b/.github/workflows/build-packages.yml index 7ff3df4349..7e72410511 100644 --- a/.github/workflows/build-packages.yml +++ b/.github/workflows/build-packages.yml @@ -93,6 +93,7 @@ jobs: - PackageLinuxArm - PackageLinuxDebianAmd64 - PackageLinuxDebianArm64 + - PackageLinuxDebianArmv6l - PackageLinuxDebianArm - PackageMacOSAmd64 - PackageMacOSArm64 From 87b59168c8372ce8d35a3690d7f46aa228c1525e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mantas=20Doma=C5=A1evi=C4=8Dius?= Date: Tue, 19 Mar 2024 07:09:11 +0200 Subject: [PATCH 2/3] Apply patch for armv6l by jgabriel98 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mantas Domaševičius --- .gitlab-ci.yml | 5 +++++ ci/packages/build.go | 8 +++++-- ci/packages/package.go | 50 ++++++++++++++++++++++++++++++++++-------- 3 files changed, 52 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4bda1a0fb5..9ff9036906 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -109,6 +109,11 @@ package:linux-debian-arm: tags: [go] script: go run mage.go -v PackageLinuxDebianArm +package:linux-debian-armv6l: + stage: build + tags: [go] + script: go run mage.go -v PackageLinuxDebianArmv6l + package:linux-debian-arm64: stage: build tags: [go] diff --git a/ci/packages/build.go b/ci/packages/build.go index 35ca2cab0b..19c851d88a 100644 --- a/ci/packages/build.go +++ b/ci/packages/build.go @@ -76,10 +76,10 @@ func buildBinary(source, target string) error { if !ok { targetArch = runtime.GOARCH } - return buildBinaryFor(source, target, targetOS, targetArch, false) + return buildBinaryFor(source, target, targetOS, targetArch, nil, false) } -func buildBinaryFor(source, target, targetOS, targetArch string, buildStatic bool) error { +func buildBinaryFor(source, target, targetOS, targetArch string, extraEnvs map[string]string, buildStatic bool) error { log.Info().Msgf("Building %s -> %s %s/%s", source, target, targetOS, targetArch) buildDir, err := filepath.Abs(path.Join("build", target)) @@ -110,6 +110,10 @@ func buildBinaryFor(source, target, targetOS, targetArch string, buildStatic boo "GOOS": targetOS, "GOARCH": targetArch, } + for envKey, envValue := range extraEnvs { + envi[envKey] = envValue + } + if buildStatic { envi["CGO_ENABLED"] = "0" } diff --git a/ci/packages/package.go b/ci/packages/package.go index a91f4f1ff2..a21657b953 100644 --- a/ci/packages/package.go +++ b/ci/packages/package.go @@ -39,7 +39,7 @@ import ( // PackageLinuxAmd64 builds and stores linux amd64 package func PackageLinuxAmd64() error { logconfig.Bootstrap() - if err := packageStandalone("build/myst/myst_linux_amd64", "linux", "amd64"); err != nil { + if err := packageStandalone("build/myst/myst_linux_amd64", "linux", "amd64", nil); err != nil { return err } return env.IfRelease(storage.UploadArtifacts) @@ -48,7 +48,19 @@ func PackageLinuxAmd64() error { // PackageLinuxArm builds and stores linux arm package func PackageLinuxArm() error { logconfig.Bootstrap() - if err := packageStandalone("build/myst/myst_linux_arm", "linux", "arm"); err != nil { + if err := packageStandalone("build/myst/myst_linux_arm", "linux", "arm", nil); err != nil { + return err + } + return env.IfRelease(storage.UploadArtifacts) +} + +// PackageLinuxArmv6l builds and stores linux armv6 package +func PackageLinuxArmv6l() error { + logconfig.Bootstrap() + extraEnv := map[string]string{ + "GOARM": "6", + } + if err := packageStandalone("build/myst/myst_linux_armv6l", "linux", "arm", extraEnv); err != nil { return err } return env.IfRelease(storage.UploadArtifacts) @@ -73,7 +85,7 @@ func PackageLinuxDebianAmd64() error { return env.IfRelease(storage.UploadArtifacts) } -// PackageLinuxDebianArm builds and stores debian arm package +// PackageLinuxDebianArm builds and stores debian armv7l+ package func PackageLinuxDebianArm() error { logconfig.Bootstrap() if err := goGet("github.com/debber/debber-v0.3/cmd/debber"); err != nil { @@ -92,6 +104,26 @@ func PackageLinuxDebianArm() error { return env.IfRelease(storage.UploadArtifacts) } +// PackageLinuxDebianArmv6l builds and stores debian armv6l package +func PackageLinuxDebianArmv6l() error { + logconfig.Bootstrap() + if err := goGet("github.com/debber/debber-v0.3/cmd/debber"); err != nil { + return err + } + envi := map[string]string{ + "GOOS": "linux", + "GOARCH": "arm", + "GOARM": "6", + } + if err := sh.RunWith(envi, "bin/build"); err != nil { + return err + } + if err := packageDebian("build/myst/myst", "armhf"); err != nil { + return err + } + return env.IfRelease(storage.UploadArtifacts) +} + // PackageLinuxDebianArm64 builds and stores debian arm64 package func PackageLinuxDebianArm64() error { logconfig.Bootstrap() @@ -114,7 +146,7 @@ func PackageLinuxDebianArm64() error { // PackageMacOSAmd64 builds and stores macOS amd64 package func PackageMacOSAmd64() error { logconfig.Bootstrap() - if err := packageStandalone("build/myst/myst_darwin_amd64", "darwin", "amd64"); err != nil { + if err := packageStandalone("build/myst/myst_darwin_amd64", "darwin", "amd64", nil); err != nil { return err } return env.IfRelease(storage.UploadArtifacts) @@ -123,7 +155,7 @@ func PackageMacOSAmd64() error { // PackageMacOSArm64 builds and stores macOS arm64 package func PackageMacOSArm64() error { logconfig.Bootstrap() - if err := packageStandalone("build/myst/myst_darwin_arm64", "darwin", "arm64"); err != nil { + if err := packageStandalone("build/myst/myst_darwin_arm64", "darwin", "arm64", nil); err != nil { return err } return env.IfRelease(storage.UploadArtifacts) @@ -132,7 +164,7 @@ func PackageMacOSArm64() error { // PackageWindowsAmd64 builds and stores Windows amd64 package func PackageWindowsAmd64() error { logconfig.Bootstrap() - if err := packageStandalone("build/myst/myst_windows_amd64.exe", "windows", "amd64"); err != nil { + if err := packageStandalone("build/myst/myst_windows_amd64.exe", "windows", "amd64", nil); err != nil { return err } return env.IfRelease(storage.UploadArtifacts) @@ -341,13 +373,13 @@ func goGet(pkg string) error { return sh.RunWith(map[string]string{"GO111MODULE": "off"}, "go", "get", "-u", pkg) } -func packageStandalone(binaryPath, os, arch string) error { +func packageStandalone(binaryPath, os, arch string, extraEnvs map[string]string) error { log.Info().Msgf("Packaging %s %s %s", binaryPath, os, arch) var err error if os == "linux" { filename := path.Base(binaryPath) binaryPath = path.Join("build", filename, filename) - err = buildBinaryFor(path.Join("cmd", "mysterium_node", "mysterium_node.go"), filename, os, arch, true) + err = buildBinaryFor(path.Join("cmd", "mysterium_node", "mysterium_node.go"), filename, os, arch, extraEnvs, true) } else { err = buildCrossBinary(os, arch) } @@ -355,7 +387,7 @@ func packageStandalone(binaryPath, os, arch string) error { return err } - err = buildBinaryFor(path.Join("cmd", "supervisor", "supervisor.go"), "myst_supervisor", os, arch, true) + err = buildBinaryFor(path.Join("cmd", "supervisor", "supervisor.go"), "myst_supervisor", os, arch, extraEnvs, true) if err != nil { return err } From 6f6c01837a4082da86a632a105cf1acfca87b1b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mantas=20Doma=C5=A1evi=C4=8Dius?= Date: Tue, 19 Mar 2024 10:51:08 +0200 Subject: [PATCH 3/3] Correct armv6l MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mantas Domaševičius --- ci/packages/package.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/packages/package.go b/ci/packages/package.go index a21657b953..7b738d99d6 100644 --- a/ci/packages/package.go +++ b/ci/packages/package.go @@ -118,7 +118,7 @@ func PackageLinuxDebianArmv6l() error { if err := sh.RunWith(envi, "bin/build"); err != nil { return err } - if err := packageDebian("build/myst/myst", "armhf"); err != nil { + if err := packageDebian("build/myst/myst", "armv6l"); err != nil { return err } return env.IfRelease(storage.UploadArtifacts)