From d9ce7c31662477ad4c136bf56bce66fedb90470b Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Thu, 5 Dec 2024 10:09:33 -0500 Subject: [PATCH] build: build all the things (#9845) Build packages for stdiscosrv and strelaysrv as well. --- .github/workflows/build-syncthing.yaml | 45 +++++++++++++++++--------- build.go | 21 ++---------- 2 files changed, 31 insertions(+), 35 deletions(-) diff --git a/.github/workflows/build-syncthing.yaml b/.github/workflows/build-syncthing.yaml index 70cd9a9e8..d71254d6a 100644 --- a/.github/workflows/build-syncthing.yaml +++ b/.github/workflows/build-syncthing.yaml @@ -178,10 +178,13 @@ jobs: - name: Create packages run: | - go run build.go -goarch amd64 zip - go run build.go -goarch arm zip - go run build.go -goarch arm64 zip - go run build.go -goarch 386 zip + $targets = 'syncthing', 'stdiscosrv', 'strelaysrv' + $archs = 'amd64', 'arm', 'arm64', '386' + foreach ($arch in $archs) { + foreach ($tgt in $targets) { + go run build.go -goarch $arch zip $tgt + } + } env: CGO_ENABLED: "0" CODESIGN_SIGNTOOL: ${{ secrets.CODESIGN_SIGNTOOL }} @@ -193,7 +196,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: packages-windows - path: syncthing-windows-*.zip + path: "*.zip" # # Linux @@ -229,7 +232,9 @@ jobs: run: | archs=$(go tool dist list | grep linux | sed 's#linux/##') for goarch in $archs ; do - go run build.go -goarch "$goarch" tar + for tgt in syncthing stdiscosrv strelaysrv ; do + go run build.go -goarch "$goarch" tar "$tgt" + done done env: CGO_ENABLED: "0" @@ -239,7 +244,7 @@ jobs: with: name: packages-linux path: | - syncthing-linux-*.tar.gz + *.tar.gz compat.json # @@ -301,7 +306,9 @@ jobs: - name: Create package (amd64) run: | - go run build.go -goarch amd64 zip + for tgt in syncthing stdiscosrv strelaysrv ; do + go run build.go -goarch amd64 zip "$tgt" + done env: CGO_ENABLED: "1" @@ -315,7 +322,9 @@ jobs: go "\$@" EOT chmod 755 xgo.sh - go run build.go -gocmd ./xgo.sh -goarch arm64 zip + for tgt in syncthing stdiscosrv strelaysrv ; do + go run build.go -gocmd ./xgo.sh -goarch arm64 zip "$tgt" + done env: CGO_ENABLED: "1" @@ -339,7 +348,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: packages-macos - path: syncthing-*.zip + path: "*.zip" notarize-macos: name: Notarize for macOS @@ -359,7 +368,7 @@ jobs: run: | APPSTORECONNECT_API_KEY_PATH="$RUNNER_TEMP/apikey.p8" echo "$APPSTORECONNECT_API_KEY" | base64 -d -o "$APPSTORECONNECT_API_KEY_PATH" - for file in syncthing-macos-*.zip ; do + for file in *-macos-*.zip ; do xcrun notarytool submit \ -k "$APPSTORECONNECT_API_KEY_PATH" \ -d "$APPSTORECONNECT_API_KEY_ID" \ @@ -424,9 +433,11 @@ jobs: goos="${plat%/*}" goarch="${plat#*/}" echo "::group ::$plat" - if ! go run build.go -goos "$goos" -goarch "$goarch" tar 2>/dev/null; then - echo "::warning ::Failed to build for $plat" - fi + for tgt in syncthing stdiscosrv strelaysrv ; do + if ! go run build.go -goos "$goos" -goarch "$goarch" tar "$tgt" 2>/dev/null; then + echo "::warning ::Failed to build $tgt for $plat" + fi + done echo "::endgroup::" done env: @@ -436,7 +447,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: packages-other - path: syncthing-*.tar.gz + path: "*.tar.gz" # # Source @@ -597,7 +608,9 @@ jobs: - name: Package for Debian run: | for arch in amd64 i386 armhf armel arm64 ; do - go run build.go -no-upgrade -installsuffix=no-upgrade -goarch "$arch" deb + for tgt in syncthing stdiscosrv strelaysrv ; do + go run build.go -no-upgrade -installsuffix=no-upgrade -goarch "$arch" deb "$tgt" + done done env: BUILD_USER: debian diff --git a/build.go b/build.go index 4a4f4bb0f..f7c106313 100644 --- a/build.go +++ b/build.go @@ -86,7 +86,6 @@ var targets = map[string]target{ "all": { // Only valid for the "build" and "install" commands as it lacks all // the archive creation stuff. buildPkgs gets filled out in init() - tags: []string{"purego"}, }, "syncthing": { // The default target for "build", "install", "tar", "zip", "deb", etc. @@ -158,7 +157,6 @@ var targets = map[string]target{ {src: "cmd/stdiscosrv/etc/linux-systemd/default", dst: "deb/etc/default/syncthing-discosrv", perm: 0o644}, {src: "cmd/stdiscosrv/etc/firewall-ufw/stdiscosrv", dst: "deb/etc/ufw/applications.d/stdiscosrv", perm: 0o644}, }, - tags: []string{"purego"}, }, "strelaysrv": { name: "strelaysrv", @@ -190,23 +188,9 @@ var targets = map[string]target{ }, "strelaypoolsrv": { name: "strelaypoolsrv", - debname: "syncthing-relaypoolsrv", - debdeps: []string{"libc6"}, description: "Syncthing Relay Pool Server", buildPkgs: []string{"github.com/syncthing/syncthing/cmd/infra/strelaypoolsrv"}, - binaryName: "strelaypoolsrv", // .exe will be added automatically for Windows builds - archiveFiles: []archiveFile{ - {src: "{{binary}}", dst: "{{binary}}", perm: 0o755}, - {src: "cmd/infra/strelaypoolsrv/README.md", dst: "README.txt", perm: 0o644}, - {src: "cmd/infra/strelaypoolsrv/LICENSE", dst: "LICENSE.txt", perm: 0o644}, - {src: "AUTHORS", dst: "AUTHORS.txt", perm: 0o644}, - }, - installationFiles: []archiveFile{ - {src: "{{binary}}", dst: "deb/usr/bin/{{binary}}", perm: 0o755}, - {src: "cmd/infra/strelaypoolsrv/README.md", dst: "deb/usr/share/doc/syncthing-relaypoolsrv/README.txt", perm: 0o644}, - {src: "cmd/infra/strelaypoolsrv/LICENSE", dst: "deb/usr/share/doc/syncthing-relaypoolsrv/LICENSE.txt", perm: 0o644}, - {src: "AUTHORS", dst: "deb/usr/share/doc/syncthing-relaypoolsrv/AUTHORS.txt", perm: 0o644}, - }, + binaryName: "strelaypoolsrv", }, "stupgrades": { name: "stupgrades", @@ -405,7 +389,6 @@ func parseFlags() { func test(tags []string, pkgs ...string) { lazyRebuildAssets() - tags = append(tags, "purego") args := []string{"test", "-tags", strings.Join(tags, " ")} if long { timeout = longTimeout @@ -439,7 +422,7 @@ func bench(tags []string, pkgs ...string) { func integration(bench bool) { lazyRebuildAssets() args := []string{"test", "-v", "-timeout", "60m", "-tags"} - tags := "purego,integration" + tags := "integration" if bench { tags += ",benchmark" }