From 67c3908d2792084327e863b910255538badfc502 Mon Sep 17 00:00:00 2001 From: Jesus Date: Fri, 16 May 2025 12:52:04 +0200 Subject: [PATCH 01/42] updaters path draft --- backend/cmd/main.go | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/backend/cmd/main.go b/backend/cmd/main.go index 01ba862a8..c84a517a9 100644 --- a/backend/cmd/main.go +++ b/backend/cmd/main.go @@ -184,10 +184,32 @@ func main() { } else { fmt.Println("Backend folder not detected. Launching existing updater...") + osType := detectOS() + + execPath, err := os.Executable() + if err != nil { + fmt.Fprintf(os.Stderr, "Error getting executable path: %v\n", err) + os.Exit(1) + } + updatersDir := filepath.Join(filepath.Dir(execPath), "updaters") + + var updaterExe string + switch osType { + case "updaters/updater-windows-64.exe": + updaterExe = filepath.Join(updatersDir, "updater-windows-64") + case "updaters/updater-linux": + updaterExe = filepath.Join(updatersDir, "updater-linux") + case "updaters/updater-macos-m1": + updaterExe = filepath.Join(updatersDir, "updater-macos-m1") + case "updaters/updater-macos-64": + updaterExe = filepath.Join(updatersDir, "updater-macos-64") + default: + fmt.Fprintf(os.Stderr, "Unsupported updater: %s\n", osType) + os.Exit(1) + } - updaterExe := filepath.Join(execDir, "updater.exe") cmd := exec.Command(updaterExe) - cmd.Dir = filepath.Dir(updaterExe) + cmd.Dir = updatersDir cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr if err := cmd.Run(); err != nil { @@ -715,3 +737,20 @@ func getLatestVersionFromGitHub() (string, error) { version := strings.TrimPrefix(release.TagName, "v") return version, nil } +func detectOS() string { + switch runtime.GOOS { + case "windows": + return "updaters/updater-windows-64.exe" + case "darwin": + if strings.Contains(runtime.GOARCH, "arm") { + return "updaters/updater-macos-m1" + } + return "updaters/updater-macos-64" + case "linux": + return "updaters/updater-linux" + default: + fmt.Fprintf(os.Stderr, "Unsupported operating system: %s\n", runtime.GOOS) + os.Exit(1) + return "" + } +} From 99225f7f28b527d68ad8d9fc9958397093c79924 Mon Sep 17 00:00:00 2001 From: Jesus Date: Fri, 16 May 2025 17:21:15 +0200 Subject: [PATCH 02/42] fixes and version update --- updater/main.go | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/updater/main.go b/updater/main.go index 7469e4b99..ba08f9e4a 100644 --- a/updater/main.go +++ b/updater/main.go @@ -194,43 +194,46 @@ func downloadFile(filepath string, url string) error { } func extractBinaryFromZip(zipPath, binaryName string) (string, error) { - // Open the ZIP file r, err := zip.OpenReader(zipPath) if err != nil { return "", err } defer r.Close() - // Iterate through the files in the ZIP + var binaryPath string + parentDir, _ := filepath.Abs(filepath.Join(".", "..")) + for _, f := range r.File { - if f.Name == binaryName { - // Open the file inside the ZIP + baseName := filepath.Base(f.Name) + if baseName == binaryName || baseName == "VERSION.md" { rc, err := f.Open() if err != nil { return "", err } defer rc.Close() - // Create the output file - outPath := "./" + binaryName + outPath := filepath.Join(parentDir, baseName) outFile, err := os.Create(outPath) if err != nil { return "", err } defer outFile.Close() - // Copy the contents of the file _, err = io.Copy(outFile, rc) if err != nil { return "", err } - // Return the path to the extracted binary - return outPath, nil + if baseName == binaryName { + binaryPath = outPath + } } } - return "", fmt.Errorf("binary %s not found in ZIP", binaryName) + if binaryPath == "" { + return "", fmt.Errorf("binary %s not found in ZIP", binaryName) + } + return binaryPath, nil } func getLatestVersion() (string, error) { From 1f35a6da4d85b2057ffa4a9ab918fa5c54b4b382 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Fri, 16 May 2025 19:34:07 +0200 Subject: [PATCH 03/42] Rename build-updater.yml to build-updater.yaml --- .github/workflows/{build-updater.yml => build-updater.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{build-updater.yml => build-updater.yaml} (100%) diff --git a/.github/workflows/build-updater.yml b/.github/workflows/build-updater.yaml similarity index 100% rename from .github/workflows/build-updater.yml rename to .github/workflows/build-updater.yaml From d256dce22cfdb804ffa9a4a4c4a1ded878b4233a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20F=C3=ADsica?= Date: Fri, 16 May 2025 19:43:06 +0200 Subject: [PATCH 04/42] Integrate backof logic correctly --- backend/pkg/transport/network/tcp/client.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/backend/pkg/transport/network/tcp/client.go b/backend/pkg/transport/network/tcp/client.go index 39e683c35..757e5529d 100644 --- a/backend/pkg/transport/network/tcp/client.go +++ b/backend/pkg/transport/network/tcp/client.go @@ -35,13 +35,18 @@ func NewClient(address string, config ClientConfig, baseLogger zerolog.Logger) C // Dial attempts to connect with the client func (client *Client) Dial() (net.Conn, error) { - client.currentRetries = 0 var err error var conn net.Conn client.logger.Info().Msg("dialing") - for ; client.config.MaxConnectionRetries <= 0 || client.currentRetries < client.config.MaxConnectionRetries; client.currentRetries++ { + for client.config.MaxConnectionRetries <= 0 || client.currentRetries < client.config.MaxConnectionRetries { + client.currentRetries++ conn, err = client.config.DialContext(client.config.Context, "tcp", client.address) + + backoffDuration := client.config.ConnectionBackoffFunction(client.currentRetries) + client.logger.Error().Stack().Err(err).Dur("backoff", backoffDuration).Int("retries", client.currentRetries+1).Msg("retrying") + time.Sleep(backoffDuration) + if err == nil { client.logger.Info().Msg("connected") return conn, nil @@ -55,10 +60,6 @@ func (client *Client) Dial() (net.Conn, error) { client.logger.Error().Stack().Err(err).Msg("failed") return nil, err } - - backoffDuration := client.config.ConnectionBackoffFunction(client.currentRetries) - client.logger.Debug().Stack().Err(err).Dur("backoff", backoffDuration).Int("retries", client.currentRetries+1).Msg("retrying") - time.Sleep(backoffDuration) } client.logger.Debug().Int("max", client.config.MaxConnectionRetries).Msg("max connection retries exceeded") From 0ccce1065d0d86ba208e3ab5b2d39748cd6704bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20F=C3=ADsica?= Date: Fri, 16 May 2025 19:55:37 +0200 Subject: [PATCH 05/42] Reset current retries when connecting succesfully --- backend/pkg/transport/network/tcp/client.go | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/pkg/transport/network/tcp/client.go b/backend/pkg/transport/network/tcp/client.go index 757e5529d..c96a6d737 100644 --- a/backend/pkg/transport/network/tcp/client.go +++ b/backend/pkg/transport/network/tcp/client.go @@ -49,6 +49,7 @@ func (client *Client) Dial() (net.Conn, error) { if err == nil { client.logger.Info().Msg("connected") + client.currentRetries = 0 return conn, nil } if client.config.Context.Err() != nil { From dabb886784b99ece5d927047609dcc9fa3ce925c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20F=C3=ADsica?= Date: Fri, 16 May 2025 20:06:55 +0200 Subject: [PATCH 06/42] Add coment --- backend/pkg/transport/network/tcp/client.go | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/pkg/transport/network/tcp/client.go b/backend/pkg/transport/network/tcp/client.go index c96a6d737..82817a668 100644 --- a/backend/pkg/transport/network/tcp/client.go +++ b/backend/pkg/transport/network/tcp/client.go @@ -39,6 +39,7 @@ func (client *Client) Dial() (net.Conn, error) { var err error var conn net.Conn client.logger.Info().Msg("dialing") + // The max connection retries will not work because the for loop never completes, it always returns and the function is called again by transport. for client.config.MaxConnectionRetries <= 0 || client.currentRetries < client.config.MaxConnectionRetries { client.currentRetries++ conn, err = client.config.DialContext(client.config.Context, "tcp", client.address) From 2c747ce6935797fcc80d16e86bace5001bbc3aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Santos?= Date: Mon, 19 May 2025 15:46:41 +0200 Subject: [PATCH 07/42] Function to get all the blcu topics --- backend/cmd/main.go | 2 ++ backend/pkg/broker/topics/blcu/register.go | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 backend/pkg/broker/topics/blcu/register.go diff --git a/backend/cmd/main.go b/backend/cmd/main.go index 01ba862a8..67ec086ab 100644 --- a/backend/cmd/main.go +++ b/backend/cmd/main.go @@ -34,6 +34,7 @@ import ( "github.com/HyperloopUPV-H8/h9-backend/pkg/abstraction" "github.com/HyperloopUPV-H8/h9-backend/pkg/broker" connection_topic "github.com/HyperloopUPV-H8/h9-backend/pkg/broker/topics/connection" + blcu_topics "github.com/HyperloopUPV-H8/h9-backend/pkg/broker/topics/blcu" data_topic "github.com/HyperloopUPV-H8/h9-backend/pkg/broker/topics/data" logger_topic "github.com/HyperloopUPV-H8/h9-backend/pkg/broker/topics/logger" message_topic "github.com/HyperloopUPV-H8/h9-backend/pkg/broker/topics/message" @@ -295,6 +296,7 @@ func main() { upgrader := websocket.NewUpgrader(connections, trace.Logger) pool := websocket.NewPool(connections, trace.Logger) broker.SetPool(pool) + blcu_topics.RegisterTopics(broker, pool) // <--- transport ---> transp := transport.NewTransport(trace.Logger) diff --git a/backend/pkg/broker/topics/blcu/register.go b/backend/pkg/broker/topics/blcu/register.go new file mode 100644 index 000000000..ee735b716 --- /dev/null +++ b/backend/pkg/broker/topics/blcu/register.go @@ -0,0 +1,22 @@ +package blcu + +import ( + "github.com/HyperloopUPV-H8/h9-backend/pkg/boards" + "github.com/HyperloopUPV-H8/h9-backend/pkg/broker" + "github.com/HyperloopUPV-H8/h9-backend/pkg/websocket" +) + +func RegisterTopics(b *broker.Broker, pool *websocket.Pool) { + upload := &Upload{} + upload.SetAPI(b) + upload.SetPool(pool) + download := &Download{} + download.SetAPI(b) + download.SetPool(pool) + b.AddTopic(UploadName, upload) + b.AddTopic(DownloadName, download) + b.AddTopic(boards.UploadSuccess{}.Topic(), upload) + b.AddTopic(boards.UploadFailure{}.Topic(), upload) + b.AddTopic(boards.DownloadSuccess{}.Topic(), download) + b.AddTopic(boards.DownloadFailure{}.Topic(), download) +} From fa690058993c6576a8623c1cbad853e125281200 Mon Sep 17 00:00:00 2001 From: Ariadna Date: Wed, 21 May 2025 20:14:56 +0200 Subject: [PATCH 08/42] some fixes to improve readability --- .../Bootloader/SendElement/SendElement.module.scss | 8 ++++---- .../src/components/Navbar/NavbarItem/NavbarItem.tsx | 1 + ethernet-view/src/layouts/AppLayout/AppLayout.tsx | 7 ++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ethernet-view/src/components/BootloaderContainer/Bootloader/SendElement/SendElement.module.scss b/ethernet-view/src/components/BootloaderContainer/Bootloader/SendElement/SendElement.module.scss index a6ba3ba3a..74a9078d9 100644 --- a/ethernet-view/src/components/BootloaderContainer/Bootloader/SendElement/SendElement.module.scss +++ b/ethernet-view/src/components/BootloaderContainer/Bootloader/SendElement/SendElement.module.scss @@ -12,7 +12,7 @@ } .fileIcon { - font-size: 1.8rem; + font-size: 0.9rem; color: orange; } @@ -22,17 +22,17 @@ flex-direction: column; gap: 0.5rem; text-overflow: ellipsis; + font-size: 1rem; } .name { flex: 1 1 0; - font-weight: bold; text-overflow: ellipsis; } .removeBtn { - color: #bebebe; - font-size: 0.8rem; cursor: pointer; + width: 10%; + height: 10%; } diff --git a/ethernet-view/src/components/Navbar/NavbarItem/NavbarItem.tsx b/ethernet-view/src/components/Navbar/NavbarItem/NavbarItem.tsx index 627b97359..77315fdab 100644 --- a/ethernet-view/src/components/Navbar/NavbarItem/NavbarItem.tsx +++ b/ethernet-view/src/components/Navbar/NavbarItem/NavbarItem.tsx @@ -3,6 +3,7 @@ import styles from "components/Navbar/NavbarItem/NavbarItem.module.scss"; export type NavbarItemData = { icon: string; page: string; + }; type Props = { diff --git a/ethernet-view/src/layouts/AppLayout/AppLayout.tsx b/ethernet-view/src/layouts/AppLayout/AppLayout.tsx index 49b27d37a..33e4dc894 100644 --- a/ethernet-view/src/layouts/AppLayout/AppLayout.tsx +++ b/ethernet-view/src/layouts/AppLayout/AppLayout.tsx @@ -2,6 +2,8 @@ import styles from "./AppLayout.module.scss" import Testing from "assets/svg/testing.svg" import Logger from "assets/svg/logger.svg" +import Chart from "assets/svg/chart.svg" + import { Navbar } from "components/Navbar/Navbar" import { ReactNode } from "react" @@ -12,7 +14,6 @@ interface Props { } export const AppLayout = ({children, pageShown, setPageShown} : Props) => { - return (
{ { icon: Logger, page: "logger" + }, + { + icon: Chart, + page: "chart" } ]} pageShown={pageShown} From d968707ddbe00aa50c80da0db3f46641b3e110e7 Mon Sep 17 00:00:00 2001 From: Ariadna Date: Wed, 21 May 2025 21:29:00 +0200 Subject: [PATCH 09/42] fixes to improve readability --- .../Bootloader/SendElement/SendElement.module.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ethernet-view/src/components/BootloaderContainer/Bootloader/SendElement/SendElement.module.scss b/ethernet-view/src/components/BootloaderContainer/Bootloader/SendElement/SendElement.module.scss index 74a9078d9..0f1b5f0a7 100644 --- a/ethernet-view/src/components/BootloaderContainer/Bootloader/SendElement/SendElement.module.scss +++ b/ethernet-view/src/components/BootloaderContainer/Bootloader/SendElement/SendElement.module.scss @@ -33,6 +33,6 @@ .removeBtn { cursor: pointer; - width: 10%; - height: 10%; + width: 25px; + height: 25px; } From 3dcf4e13d9e6d5687544141a81d338e73e23d1b6 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Fri, 23 May 2025 19:21:18 +0200 Subject: [PATCH 10/42] Update build-updater.yaml --- .github/workflows/build-updater.yaml | 55 +++++++++++++++------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build-updater.yaml b/.github/workflows/build-updater.yaml index 220b2eeaa..b89d98acb 100644 --- a/.github/workflows/build-updater.yaml +++ b/.github/workflows/build-updater.yaml @@ -2,15 +2,17 @@ name: Build updater on: workflow_dispatch: + pull_request: + paths: + - updater/** jobs: - build-backend-linux: + build-updater-linux: name: "Build updater for linux" runs-on: ubuntu-latest - # Runs on alpine because it is easier to statically link the library container: - image: golang:alpine + image: golang:alpine env: UPDATER_DIR: ./updater @@ -25,7 +27,7 @@ jobs: - name: "Create output path" working-directory: "${{env.UPDATER_DIR}}" - run: mkdir ./output + run: mkdir -p ./output - name: "Build (64 bit)" working-directory: "${{env.UPDATER_DIR}}" @@ -34,17 +36,17 @@ jobs: GOARCH: amd64 GOOS: linux run: | - go build -ldflags '-linkmode external -extldflags "-static"' -o ../output/updaters/updater-linux-64 + go build -ldflags '-linkmode external -extldflags "-static"' -o output/updater-linux-64 - name: "Upload build" uses: actions/upload-artifact@v4 with: name: updater-linux - path: "${{env.UPDATER_DIR}}/output/updaters/*" + path: "${{env.UPDATER_DIR}}/output/*" retention-days: 3 compression-level: 9 - build-backend-windows: + build-updater-windows: name: "Build updater for windows" runs-on: windows-latest @@ -71,58 +73,61 @@ jobs: GOARCH: amd64 GOOS: windows run: | - go build -o ..\output\updaters\backend-windows-64.exe + go build -o output\\updater-windows-64.exe - name: "Upload build" uses: actions/upload-artifact@v4 with: name: updater-windows - path: "${{env.UPDATER_DIR}}\\output\\updaters\\*" + path: "${{env.UPDATER_DIR}}\\output\\*" retention-days: 3 compression-level: 9 - - build-backend-mac: + + build-updater-mac: name: "Build updater for macOS" runs-on: macos-latest - + env: - BACKEND_DIR: ./updater - + UPDATER_DIR: ./updater + steps: + - name: "Install packages" + run: brew install libpcap || true + - name: "Setup Go" uses: actions/setup-go@v4 with: go-version: "1.21.3" cache-dependency-path: "${{env.UPDATER_DIR}}/go.sum" - + - uses: actions/checkout@v3 - + - name: "Create output path" working-directory: "${{env.UPDATER_DIR}}" - run: mkdir ./output - - - name: "Build (64 bit)" + run: mkdir -p ./output + + - name: "Build (64 bit Intel)" working-directory: "${{env.UPDATER_DIR}}" env: CGO_ENABLED: 1 GOARCH: amd64 GOOS: darwin run: | - go build -o ../output/updaters/updater-macos-64 - - - name: "Build (apple 64 bit)" + go build -o output/updater-macos-64 + + - name: "Build (64 bit ARM/M1)" working-directory: "${{env.UPDATER_DIR}}" env: CGO_ENABLED: 1 GOARCH: arm64 GOOS: darwin run: | - go build -o ../output/updaters/updater-macos-m1-64 - + go build -o output/updater-macos-m1-64 + - name: "Upload build" uses: actions/upload-artifact@v4 with: name: updater-macos - path: "${{env.UPDATER_DIR}}/output/updaters/*" + path: "${{env.UPDATER_DIR}}/output/*" retention-days: 3 compression-level: 9 From 3bf91250995971eb91c86c00a2c63d1f9d17481c Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Fri, 23 May 2025 19:35:44 +0200 Subject: [PATCH 11/42] Update build-updater.yaml --- .github/workflows/build-updater.yaml | 67 +++++++++++++--------------- 1 file changed, 31 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build-updater.yaml b/.github/workflows/build-updater.yaml index b89d98acb..23c897b10 100644 --- a/.github/workflows/build-updater.yaml +++ b/.github/workflows/build-updater.yaml @@ -8,7 +8,7 @@ on: jobs: build-updater-linux: - name: "Build updater for linux" + name: "Build updater for Linux" runs-on: ubuntu-latest container: @@ -18,19 +18,17 @@ jobs: UPDATER_DIR: ./updater steps: - - name: "Install packages" + - name: Install packages run: apk update && apk add --no-cache gcc go - uses: actions/checkout@v4 - with: - sparse-checkout: updater - - name: "Create output path" - working-directory: "${{env.UPDATER_DIR}}" - run: mkdir -p ./output + - name: Create output path + working-directory: ${{ env.UPDATER_DIR }} + run: mkdir -p output - - name: "Build (64 bit)" - working-directory: "${{env.UPDATER_DIR}}" + - name: Build (64 bit) + working-directory: ${{ env.UPDATER_DIR }} env: CGO_ENABLED: 1 GOARCH: amd64 @@ -38,36 +36,36 @@ jobs: run: | go build -ldflags '-linkmode external -extldflags "-static"' -o output/updater-linux-64 - - name: "Upload build" + - name: Upload build uses: actions/upload-artifact@v4 with: name: updater-linux - path: "${{env.UPDATER_DIR}}/output/*" + path: ${{ env.UPDATER_DIR }}/output/* retention-days: 3 compression-level: 9 build-updater-windows: - name: "Build updater for windows" + name: "Build updater for Windows" runs-on: windows-latest env: - UPDATER_DIR: ".\\updater" + UPDATER_DIR: .\\updater steps: - uses: actions/checkout@v3 - - name: "Setup Go" + - name: Setup Go uses: actions/setup-go@v4 with: go-version: "1.21.3" - cache-dependency-path: "${{env.UPDATER_DIR}}\\go.sum" + cache-dependency-path: updater\\go.sum - - name: "Create output path" - working-directory: "${{env.UPDATER_DIR}}" - run: mkdir .\output + - name: Create output path + working-directory: ${{ env.UPDATER_DIR }} + run: mkdir output - - name: "Build (64 bit)" - working-directory: "${{env.UPDATER_DIR}}" + - name: Build (64 bit) + working-directory: ${{ env.UPDATER_DIR }} env: CGO_ENABLED: 1 GOARCH: amd64 @@ -75,11 +73,11 @@ jobs: run: | go build -o output\\updater-windows-64.exe - - name: "Upload build" + - name: Upload build uses: actions/upload-artifact@v4 with: name: updater-windows - path: "${{env.UPDATER_DIR}}\\output\\*" + path: ${{ env.UPDATER_DIR }}\\output\\* retention-days: 3 compression-level: 9 @@ -91,23 +89,20 @@ jobs: UPDATER_DIR: ./updater steps: - - name: "Install packages" - run: brew install libpcap || true - - - name: "Setup Go" + - name: Setup Go uses: actions/setup-go@v4 with: go-version: "1.21.3" - cache-dependency-path: "${{env.UPDATER_DIR}}/go.sum" + cache-dependency-path: updater/go.sum - uses: actions/checkout@v3 - - name: "Create output path" - working-directory: "${{env.UPDATER_DIR}}" - run: mkdir -p ./output + - name: Create output path + working-directory: ${{ env.UPDATER_DIR }} + run: mkdir -p output - - name: "Build (64 bit Intel)" - working-directory: "${{env.UPDATER_DIR}}" + - name: Build (Intel 64) + working-directory: ${{ env.UPDATER_DIR }} env: CGO_ENABLED: 1 GOARCH: amd64 @@ -115,8 +110,8 @@ jobs: run: | go build -o output/updater-macos-64 - - name: "Build (64 bit ARM/M1)" - working-directory: "${{env.UPDATER_DIR}}" + - name: Build (Apple M1/ARM64) + working-directory: ${{ env.UPDATER_DIR }} env: CGO_ENABLED: 1 GOARCH: arm64 @@ -124,10 +119,10 @@ jobs: run: | go build -o output/updater-macos-m1-64 - - name: "Upload build" + - name: Upload build uses: actions/upload-artifact@v4 with: name: updater-macos - path: "${{env.UPDATER_DIR}}/output/*" + path: ${{ env.UPDATER_DIR }}/output/* retention-days: 3 compression-level: 9 From 8f8dda9ab08034ac9c8783107ef2f42f90d55364 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 00:05:01 +0200 Subject: [PATCH 12/42] Update build-updater.yaml --- .github/workflows/build-updater.yaml | 40 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-updater.yaml b/.github/workflows/build-updater.yaml index 23c897b10..898bb23e7 100644 --- a/.github/workflows/build-updater.yaml +++ b/.github/workflows/build-updater.yaml @@ -18,8 +18,10 @@ jobs: UPDATER_DIR: ./updater steps: - - name: Install packages - run: apk update && apk add --no-cache gcc go + - name: Install packages (incl. git!) + run: | + apk update + apk add --no-cache gcc go git - uses: actions/checkout@v4 @@ -27,16 +29,17 @@ jobs: working-directory: ${{ env.UPDATER_DIR }} run: mkdir -p output - - name: Build (64 bit) + - name: Build (64-bit Linux) working-directory: ${{ env.UPDATER_DIR }} env: CGO_ENABLED: 1 GOARCH: amd64 GOOS: linux run: | - go build -ldflags '-linkmode external -extldflags "-static"' -o output/updater-linux-64 + go build -ldflags '-linkmode external -extldflags "-static"' \ + -o output/updater-linux-64 - - name: Upload build + - name: Upload Linux build uses: actions/upload-artifact@v4 with: name: updater-linux @@ -54,7 +57,7 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Setup Go + - name: Setup Go (with cache) uses: actions/setup-go@v4 with: go-version: "1.21.3" @@ -64,16 +67,15 @@ jobs: working-directory: ${{ env.UPDATER_DIR }} run: mkdir output - - name: Build (64 bit) + - name: Build (64-bit Windows) working-directory: ${{ env.UPDATER_DIR }} env: CGO_ENABLED: 1 GOARCH: amd64 GOOS: windows - run: | - go build -o output\\updater-windows-64.exe + run: go build -o output\\updater-windows-64.exe - - name: Upload build + - name: Upload Windows build uses: actions/upload-artifact@v4 with: name: updater-windows @@ -89,37 +91,35 @@ jobs: UPDATER_DIR: ./updater steps: - - name: Setup Go + - uses: actions/checkout@v3 + + - name: Setup Go (with cache) uses: actions/setup-go@v4 with: go-version: "1.21.3" cache-dependency-path: updater/go.sum - - uses: actions/checkout@v3 - - name: Create output path working-directory: ${{ env.UPDATER_DIR }} run: mkdir -p output - - name: Build (Intel 64) + - name: Build (Intel macOS) working-directory: ${{ env.UPDATER_DIR }} env: CGO_ENABLED: 1 GOARCH: amd64 GOOS: darwin - run: | - go build -o output/updater-macos-64 + run: go build -o output/updater-macos-64 - - name: Build (Apple M1/ARM64) + - name: Build (Apple Silicon) working-directory: ${{ env.UPDATER_DIR }} env: CGO_ENABLED: 1 GOARCH: arm64 GOOS: darwin - run: | - go build -o output/updater-macos-m1-64 + run: go build -o output/updater-macos-m1-64 - - name: Upload build + - name: Upload macOS build uses: actions/upload-artifact@v4 with: name: updater-macos From 6c654a63183d5beb3ad408eb961523629eb55960 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 00:12:20 +0200 Subject: [PATCH 13/42] Update build-updater.yaml --- .github/workflows/build-updater.yaml | 179 +++++++++++---------------- 1 file changed, 75 insertions(+), 104 deletions(-) diff --git a/.github/workflows/build-updater.yaml b/.github/workflows/build-updater.yaml index 898bb23e7..c676542a5 100644 --- a/.github/workflows/build-updater.yaml +++ b/.github/workflows/build-updater.yaml @@ -1,5 +1,8 @@ name: Build updater +permissions: + contents: read + on: workflow_dispatch: pull_request: @@ -8,121 +11,89 @@ on: jobs: build-updater-linux: - name: "Build updater for Linux" + name: Build updater for Linux runs-on: ubuntu-latest - container: - image: golang:alpine + steps: + - uses: actions/checkout@v4 + + - name: Set up Go (v4, with module caching) + uses: actions/setup-go@v4 + with: + go-version: '1.21.3' + cache: modules - env: - UPDATER_DIR: ./updater + - name: Create output dir + run: mkdir -p updater/output - steps: - - name: Install packages (incl. git!) - run: | - apk update - apk add --no-cache gcc go git - - - uses: actions/checkout@v4 - - - name: Create output path - working-directory: ${{ env.UPDATER_DIR }} - run: mkdir -p output - - - name: Build (64-bit Linux) - working-directory: ${{ env.UPDATER_DIR }} - env: - CGO_ENABLED: 1 - GOARCH: amd64 - GOOS: linux - run: | - go build -ldflags '-linkmode external -extldflags "-static"' \ - -o output/updater-linux-64 - - - name: Upload Linux build - uses: actions/upload-artifact@v4 - with: - name: updater-linux - path: ${{ env.UPDATER_DIR }}/output/* - retention-days: 3 - compression-level: 9 + - name: Build (Linux amd64) + run: | + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ + go build -o updater/output/updater-linux-64 ./updater + + - name: Upload Linux artifact + uses: actions/upload-artifact@v4 + with: + name: updater-linux + path: updater/output/* build-updater-windows: - name: "Build updater for Windows" + name: Build updater for Windows runs-on: windows-latest - env: - UPDATER_DIR: .\\updater - steps: - - uses: actions/checkout@v3 - - - name: Setup Go (with cache) - uses: actions/setup-go@v4 - with: - go-version: "1.21.3" - cache-dependency-path: updater\\go.sum - - - name: Create output path - working-directory: ${{ env.UPDATER_DIR }} - run: mkdir output - - - name: Build (64-bit Windows) - working-directory: ${{ env.UPDATER_DIR }} - env: - CGO_ENABLED: 1 - GOARCH: amd64 - GOOS: windows - run: go build -o output\\updater-windows-64.exe - - - name: Upload Windows build - uses: actions/upload-artifact@v4 - with: - name: updater-windows - path: ${{ env.UPDATER_DIR }}\\output\\* - retention-days: 3 - compression-level: 9 + - uses: actions/checkout@v4 + + - name: Set up Go (v4, with module caching) + uses: actions/setup-go@v4 + with: + go-version: '1.21.3' + cache: modules + + - name: Create output dir + shell: pwsh + run: New-Item -ItemType Directory -Path updater\output -Force + + - name: Build (Windows amd64) + shell: pwsh + run: | + $Env:CGO_ENABLED = '0' + go build -o updater\output\updater-windows-64.exe ./updater + + - name: Upload Windows artifact + uses: actions/upload-artifact@v4 + with: + name: updater-windows + path: updater\output\* build-updater-mac: - name: "Build updater for macOS" + name: Build updater for macOS runs-on: macos-latest - env: - UPDATER_DIR: ./updater - steps: - - uses: actions/checkout@v3 - - - name: Setup Go (with cache) - uses: actions/setup-go@v4 - with: - go-version: "1.21.3" - cache-dependency-path: updater/go.sum - - - name: Create output path - working-directory: ${{ env.UPDATER_DIR }} - run: mkdir -p output - - - name: Build (Intel macOS) - working-directory: ${{ env.UPDATER_DIR }} - env: - CGO_ENABLED: 1 - GOARCH: amd64 - GOOS: darwin - run: go build -o output/updater-macos-64 - - - name: Build (Apple Silicon) - working-directory: ${{ env.UPDATER_DIR }} - env: - CGO_ENABLED: 1 - GOARCH: arm64 - GOOS: darwin - run: go build -o output/updater-macos-m1-64 - - - name: Upload macOS build - uses: actions/upload-artifact@v4 - with: - name: updater-macos - path: ${{ env.UPDATER_DIR }}/output/* - retention-days: 3 - compression-level: 9 + - uses: actions/checkout@v4 + + - name: Set up Go (v4, with module caching) + uses: actions/setup-go@v4 + with: + go-version: '1.21.3' + cache: modules + + - name: Create output dir + run: mkdir -p updater/output + + - name: Build (macOS Intel) + run: | + CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 \ + go build -o updater/output/updater-macos-64 ./updater + + - name: Build (macOS ARM64) + run: | + CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 \ + go build -o updater/output/updater-macos-m1-64 ./updater + + - name: Upload macOS artifact + uses: actions/upload-artifact@v4 + with: + name: updater-macos + path: updater/output/* From fc1d56cb62aedbdfa32e61561ea6078a325477f7 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 00:18:30 +0200 Subject: [PATCH 14/42] Update build-updater.yaml --- .github/workflows/build-updater.yaml | 48 ++++++++++++++++------------ 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build-updater.yaml b/.github/workflows/build-updater.yaml index c676542a5..fd27082b0 100644 --- a/.github/workflows/build-updater.yaml +++ b/.github/workflows/build-updater.yaml @@ -1,8 +1,5 @@ name: Build updater -permissions: - contents: read - on: workflow_dispatch: pull_request: @@ -15,23 +12,26 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} - - name: Set up Go (v4, with module caching) + - name: Set up Go uses: actions/setup-go@v4 with: go-version: '1.21.3' - cache: modules - - name: Create output dir + - name: Make output dir run: mkdir -p updater/output - - name: Build (Linux amd64) + - name: Build (linux/amd64) run: | CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ go build -o updater/output/updater-linux-64 ./updater - - name: Upload Linux artifact + - name: Upload artifact uses: actions/upload-artifact@v4 with: name: updater-linux @@ -42,25 +42,28 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} - - name: Set up Go (v4, with module caching) + - name: Set up Go uses: actions/setup-go@v4 with: go-version: '1.21.3' - cache: modules - - name: Create output dir + - name: Make output dir shell: pwsh run: New-Item -ItemType Directory -Path updater\output -Force - - name: Build (Windows amd64) + - name: Build (windows/amd64) shell: pwsh run: | - $Env:CGO_ENABLED = '0' + $Env:CGO_ENABLED='0' go build -o updater\output\updater-windows-64.exe ./updater - - name: Upload Windows artifact + - name: Upload artifact uses: actions/upload-artifact@v4 with: name: updater-windows @@ -71,15 +74,18 @@ jobs: runs-on: macos-latest steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} - - name: Set up Go (v4, with module caching) + - name: Set up Go uses: actions/setup-go@v4 with: go-version: '1.21.3' - cache: modules - - name: Create output dir + - name: Make output dir run: mkdir -p updater/output - name: Build (macOS Intel) @@ -92,7 +98,7 @@ jobs: CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 \ go build -o updater/output/updater-macos-m1-64 ./updater - - name: Upload macOS artifact + - name: Upload artifact uses: actions/upload-artifact@v4 with: name: updater-macos From 8fb812aa8c958385c2cbe2a831d2f76819dd97cb Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 00:31:13 +0200 Subject: [PATCH 15/42] fix adj submodule --- .gitignore | 1 - .gitmodules | 3 +++ backend/cmd/adj | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 .gitmodules diff --git a/.gitignore b/.gitignore index d6cca4505..769d96cab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ build profiles backend/cmd/cmd -backend/cmd/adj/ .ropeproject # MacOS Files diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..43cd44590 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "backend/cmd/adj"] + path = backend/cmd/adj + url = https://github.com/HyperloopUPV-H8/adj.git diff --git a/backend/cmd/adj b/backend/cmd/adj index fd87ad3fa..4c320a720 160000 --- a/backend/cmd/adj +++ b/backend/cmd/adj @@ -1 +1 @@ -Subproject commit fd87ad3fac5aa62e7b274b5ae00412caa544c0a0 +Subproject commit 4c320a720a191ac4cb94e8952a6d75549dfa6101 From cec56c9d9245bbf78327b6b0cfa4d74411cd5b64 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 01:13:46 +0200 Subject: [PATCH 16/42] Update build-updater.yaml --- .github/workflows/build-updater.yaml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-updater.yaml b/.github/workflows/build-updater.yaml index fd27082b0..3cba76104 100644 --- a/.github/workflows/build-updater.yaml +++ b/.github/workflows/build-updater.yaml @@ -21,7 +21,12 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.21.3' + go-version: "1.21.3" + cache-dependency-path: updater/go.sum + + - name: Ensure dependencies + working-directory: updater + run: go mod tidy - name: Make output dir run: mkdir -p updater/output @@ -51,7 +56,13 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.21.3' + go-version: "1.21.3" + cache-dependency-path: updater\go.sum + + - name: Ensure dependencies + working-directory: updater + shell: pwsh + run: go mod tidy - name: Make output dir shell: pwsh @@ -83,7 +94,12 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.21.3' + go-version: "1.21.3" + cache-dependency-path: updater/go.sum + + - name: Ensure dependencies + working-directory: updater + run: go mod tidy - name: Make output dir run: mkdir -p updater/output From 38c5e2ebfccf21f65afc8e406ef95b0433968beb Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 01:38:26 +0200 Subject: [PATCH 17/42] try marking workspace as safe --- .github/workflows/build-updater.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/build-updater.yaml b/.github/workflows/build-updater.yaml index 3cba76104..ce9af5e6b 100644 --- a/.github/workflows/build-updater.yaml +++ b/.github/workflows/build-updater.yaml @@ -18,6 +18,9 @@ jobs: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} + - name: Mark workspace as safe + run: git config --global --add safe.directory $GITHUB_WORKSPACE + - name: Set up Go uses: actions/setup-go@v4 with: @@ -53,6 +56,10 @@ jobs: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} + - name: Mark workspace as safe + shell: pwsh + run: git config --global --add safe.directory $Env:GITHUB_WORKSPACE + - name: Set up Go uses: actions/setup-go@v4 with: @@ -91,6 +98,9 @@ jobs: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} + - name: Mark workspace as safe + run: git config --global --add safe.directory $GITHUB_WORKSPACE + - name: Set up Go uses: actions/setup-go@v4 with: From c9e43f230f8eb630fca8da9a8bdbaf124e195c31 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 02:37:01 +0200 Subject: [PATCH 18/42] release.yaml --- .github/workflows/release.yaml | 141 +++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 000000000..157f21c16 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,141 @@ +name: Full Release Build + +on: + workflow_dispatch: + +jobs: + build-and-release: + name: Build & Package All Components + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.21.3" + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Install PyInstaller + run: pip install pyinstaller + + - name: Prepare Folder Structure + run: | + mkdir -p release/backend + mkdir -p release/updater + mkdir -p release/control-station/static + mkdir -p release/ethernet-view/static + + ############################################ + # BACKEND BUILDS + ############################################ + + - name: Build backend for Linux + run: | + GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o release/backend/backend-linux-64 ./backend/cmd + + - name: Build backend for Windows + run: | + GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build -o release/backend/backend-windows-64.exe ./backend/cmd + + - name: Build backend for macOS Intel + run: | + GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build -o release/backend/backend-macos-64 ./backend/cmd + + - name: Build backend for macOS ARM64 + run: | + GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build -o release/backend/backend-macos-m1 ./backend/cmd + + ############################################ + # UPDATER BUILDS + ############################################ + + - name: Build updater for Linux + run: | + GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o release/updater/updater-linux ./updater + + - name: Build updater for Windows + run: | + GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o release/updater/updater-windows.exe ./updater + + - name: Build updater for macOS Intel + run: | + GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o release/updater/updater-macos-64 ./updater + + - name: Build updater for macOS ARM64 + run: | + GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -o release/updater/updater-macos-m1 ./updater + + ############################################ + # FRONTEND BUILDS + ############################################ + + - name: Install common-front dependencies + working-directory: ./common-front + run: npm install + + - name: Build common-front + working-directory: ./common-front + run: npm run build + + - name: Build control-station + working-directory: ./control-station + run: | + npm install + npm run build + cp -r static/* ../../release/control-station/static/ + + - name: Build ethernet-view + working-directory: ./ethernet-view + run: | + npm install + npm run build + cp -r static/* ../../release/ethernet-view/static/ + + ############################################ + # BUILD testadj + ############################################ + + - name: Bundle testadj.py + run: | + pyinstaller --onefile backend/cmd/testadj.py --distpath release/ + + ############################################ + # PACKAGE METADATA + ############################################ + + - name: Copy additional files + run: | + cp backend/cmd/config.toml release/ + cp backend/cmd/VERSION.md release/ + cp README.md release/ + + - name: Create final ZIP + run: | + cd release + zip -r ../control-station.zip . + + ############################################ + # CREATE DRAFT RELEASE + ############################################ + + - name: Create Draft GitHub Release + uses: softprops/action-gh-release@v1 + with: + tag_name: "v${{ github.run_number }}" + name: "Draft Release v${{ github.run_number }}" + draft: true + files: control-station.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From b88d97c79cb3fac328a5e03f480280324cce855d Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 02:40:24 +0200 Subject: [PATCH 19/42] install pcap lib in release.yaml --- .github/workflows/release.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 157f21c16..fde68a372 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,4 +1,4 @@ -name: Full Release Build +name: Release on: workflow_dispatch: @@ -12,6 +12,9 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 + - name: Install libpcap-dev + run: sudo apt-get update && sudo apt-get install -y libpcap-dev + - name: Set up Go uses: actions/setup-go@v4 with: From 145d7f8715ff6d5e01dedb1c8f61c6f06f549455 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 02:43:37 +0200 Subject: [PATCH 20/42] fix packet-sender adj submodule --- .gitmodules | 3 +++ packet-sender/adj | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 43cd44590..e42b8aae0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "backend/cmd/adj"] path = backend/cmd/adj url = https://github.com/HyperloopUPV-H8/adj.git +[submodule "packet-sender/adj"] + path = packet-sender/adj + url = https://github.com/HyperloopUPV-H8/adj.git diff --git a/packet-sender/adj b/packet-sender/adj index e51cccf45..4c320a720 160000 --- a/packet-sender/adj +++ b/packet-sender/adj @@ -1 +1 @@ -Subproject commit e51cccf4527fc0fa623c3f0487a6d5741502067c +Subproject commit 4c320a720a191ac4cb94e8952a6d75549dfa6101 From af05bd81d6d45b9043ad1d3a6ca4919334d32b0c Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 02:48:23 +0200 Subject: [PATCH 21/42] fix macos compilation in linux in release.yaml --- .github/workflows/release.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index fde68a372..4f23dbe98 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,7 +6,11 @@ on: jobs: build-and-release: name: Build & Package All Components - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest, macos-latest] steps: - name: Checkout Repository @@ -53,10 +57,12 @@ jobs: GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build -o release/backend/backend-windows-64.exe ./backend/cmd - name: Build backend for macOS Intel + if: matrix.os == 'macos-latest' run: | GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build -o release/backend/backend-macos-64 ./backend/cmd - name: Build backend for macOS ARM64 + if: matrix.os == 'macos-latest' run: | GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build -o release/backend/backend-macos-m1 ./backend/cmd From e86ae8e7189395377173aef065c97998e00254f8 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 02:50:29 +0200 Subject: [PATCH 22/42] fix macos compilation in release.yaml --- .github/workflows/release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4f23dbe98..613cec944 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -17,6 +17,7 @@ jobs: uses: actions/checkout@v4 - name: Install libpcap-dev + if: matrix.os == 'ubuntu-latest' run: sudo apt-get update && sudo apt-get install -y libpcap-dev - name: Set up Go From 938cc0773e705f122be68f158a5f9df48add86af Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 02:53:10 +0200 Subject: [PATCH 23/42] fix macos compilation in release.yaml --- .github/workflows/release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 613cec944..80fd9677f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -16,9 +16,9 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - name: Install libpcap-dev + - name: Install build-essential and libpcap-dev if: matrix.os == 'ubuntu-latest' - run: sudo apt-get update && sudo apt-get install -y libpcap-dev + run: sudo apt-get update && sudo apt-get install -y build-essential libpcap-dev - name: Set up Go uses: actions/setup-go@v4 From af5f85cfd31559aaa9eeb20e3bb6a57a9f7fcf89 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 02:58:05 +0200 Subject: [PATCH 24/42] fix compilation in release.yaml --- .github/workflows/release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 80fd9677f..e46d6edcb 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -50,6 +50,7 @@ jobs: ############################################ - name: Build backend for Linux + if: matrix.os == 'ubuntu-latest' run: | GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o release/backend/backend-linux-64 ./backend/cmd From 565e6289f4bde62c69d7ad9d875cc2c9148523dc Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 03:02:45 +0200 Subject: [PATCH 25/42] fix compilation in release.yaml --- .github/workflows/release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e46d6edcb..84a3de5b7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -44,6 +44,7 @@ jobs: mkdir -p release/updater mkdir -p release/control-station/static mkdir -p release/ethernet-view/static + shell: bash ############################################ # BACKEND BUILDS From 1543b8272d95e311ab596ca0ae567b52810ae783 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 03:09:12 +0200 Subject: [PATCH 26/42] fix compilation in release.yaml --- .github/workflows/release.yaml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 84a3de5b7..c027d9e2d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -106,14 +106,24 @@ jobs: run: | npm install npm run build - cp -r static/* ../../release/control-station/static/ + + - name: Upload control-station artifact + uses: actions/upload-artifact@v4 + with: + name: control-station + path: ./control-station/static/* - name: Build ethernet-view working-directory: ./ethernet-view run: | npm install npm run build - cp -r static/* ../../release/ethernet-view/static/ + + - name: Upload ethernet-view artifact + uses: actions/upload-artifact@v4 + with: + name: ethernet-view + path: ./ethernet-view/static/* ############################################ # BUILD testadj @@ -133,6 +143,18 @@ jobs: cp backend/cmd/VERSION.md release/ cp README.md release/ + - name: Download control-station artifact + uses: actions/download-artifact@v4 + with: + name: control-station + path: ./release/control-station/static + + - name: Download ethernet-view artifact + uses: actions/download-artifact@v4 + with: + name: ethernet-view + path: ./release/ethernet-view/static + - name: Create final ZIP run: | cd release From 71a3ed25f06454153b6ec3682524d8a90e8da0e9 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 17:31:26 +0200 Subject: [PATCH 27/42] fix compilation in release.yaml --- .github/workflows/release.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c027d9e2d..a384ea3b9 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -143,12 +143,18 @@ jobs: cp backend/cmd/VERSION.md release/ cp README.md release/ + - name: Ensure control-station directory exists + run: mkdir -p ./release/control-station/static + - name: Download control-station artifact uses: actions/download-artifact@v4 with: name: control-station path: ./release/control-station/static + - name: Ensure ethernet-view directory exists + run: mkdir -p ./release/ethernet-view/static + - name: Download ethernet-view artifact uses: actions/download-artifact@v4 with: From 422cdb901730251fbfb91e48336bdc536d01da76 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 17:47:21 +0200 Subject: [PATCH 28/42] fix compilation in release.yaml --- .github/workflows/release.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a384ea3b9..53302306e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -110,7 +110,7 @@ jobs: - name: Upload control-station artifact uses: actions/upload-artifact@v4 with: - name: control-station + name: control-station-${{ matrix.os }} path: ./control-station/static/* - name: Build ethernet-view @@ -122,7 +122,7 @@ jobs: - name: Upload ethernet-view artifact uses: actions/upload-artifact@v4 with: - name: ethernet-view + name: ethernet-view-${{ matrix.os }} path: ./ethernet-view/static/* ############################################ @@ -149,7 +149,7 @@ jobs: - name: Download control-station artifact uses: actions/download-artifact@v4 with: - name: control-station + name: control-station-${{ matrix.os }} path: ./release/control-station/static - name: Ensure ethernet-view directory exists @@ -158,7 +158,7 @@ jobs: - name: Download ethernet-view artifact uses: actions/download-artifact@v4 with: - name: ethernet-view + name: ethernet-view-${{ matrix.os }} path: ./release/ethernet-view/static - name: Create final ZIP From 856cf86ba52533549df6ab41d7f00c0316d70860 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 17:59:21 +0200 Subject: [PATCH 29/42] add architecture releases in release.yaml --- .github/workflows/release.yaml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 53302306e..072b8d37f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -107,11 +107,25 @@ jobs: npm install npm run build + - name: Rename control-station artifact for platform + run: | + if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then + mv ./control-station/static ./control-station-linux-x64 + elif [ "${{ matrix.os }}" == "macos-latest" ]; then + if [ "$(uname -m)" == "arm64" ]; then + mv ./control-station/static ./control-station-macos-arm + else + mv ./control-station/static ./control-station-macos-x64 + fi + elif [ "${{ matrix.os }}" == "windows-latest" ]; then + mv ./control-station/static ./control-station-windows-x64.exe + fi + - name: Upload control-station artifact uses: actions/upload-artifact@v4 with: name: control-station-${{ matrix.os }} - path: ./control-station/static/* + path: ./control-station-* - name: Build ethernet-view working-directory: ./ethernet-view @@ -150,7 +164,7 @@ jobs: uses: actions/download-artifact@v4 with: name: control-station-${{ matrix.os }} - path: ./release/control-station/static + path: ./release/ - name: Ensure ethernet-view directory exists run: mkdir -p ./release/ethernet-view/static From f409680a990304370c6573621851c8691ad1c33a Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 18:23:31 +0200 Subject: [PATCH 30/42] fix architecture releases in release.yaml --- .github/workflows/release.yaml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 072b8d37f..5a7f880d2 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -175,10 +175,20 @@ jobs: name: ethernet-view-${{ matrix.os }} path: ./release/ethernet-view/static - - name: Create final ZIP + - name: Create platform-specific ZIP run: | - cd release - zip -r ../control-station.zip . + mkdir -p release-zips + if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then + zip -r release-zips/release-linux-x64.zip release/backend/backend-linux-64 release/control-station release/ethernet-view release/testadj release/config.toml release/VERSION.md release/README.md release/updater + elif [ "${{ matrix.os }}" == "macos-latest" ]; then + if [ "$(uname -m)" == "arm64" ]; then + zip -r release-zips/release-macos-arm.zip release/backend/backend-macos-m1 release/control-station release/ethernet-view release/testadj release/config.toml release/VERSION.md release/README.md release/updater + else + zip -r release-zips/release-macos-x64.zip release/backend/backend-macos-64 release/control-station release/ethernet-view release/testadj release/config.toml release/VERSION.md release/README.md release/updater + fi + elif [ "${{ matrix.os }}" == "windows-latest" ]; then + zip -r release-zips/release-windows-x64.zip release/backend/backend-windows-64.exe release/control-station release/ethernet-view release/testadj.exe release/config.toml release/VERSION.md release/README.md release/updater + fi ############################################ # CREATE DRAFT RELEASE From cbe41f35f764db64e3f24c54c044a097e32b7940 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 19:06:52 +0200 Subject: [PATCH 31/42] fix architecture releases in release.yaml --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5a7f880d2..79b296c95 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -200,6 +200,6 @@ jobs: tag_name: "v${{ github.run_number }}" name: "Draft Release v${{ github.run_number }}" draft: true - files: control-station.zip + files: release-zips/release-*.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 62fa2f162aa607ad8809549c365a5fdd953d83a8 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 19:25:20 +0200 Subject: [PATCH 32/42] fixes in architecture releases in release.yaml --- .github/workflows/release.yaml | 122 +++++++++++++++++---------------- 1 file changed, 63 insertions(+), 59 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 79b296c95..595d7a5a9 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -10,15 +10,21 @@ jobs: strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-latest, windows-latest] steps: - name: Checkout Repository uses: actions/checkout@v4 - - name: Install build-essential and libpcap-dev + - name: Install build-essential and libpcap-dev on Linux if: matrix.os == 'ubuntu-latest' run: sudo apt-get update && sudo apt-get install -y build-essential libpcap-dev + + - name: Install Windows dependencies + if: matrix.os == 'windows-latest' + run: | + choco install -y npcap + choco install -y zip - name: Set up Go uses: actions/setup-go@v4 @@ -40,10 +46,9 @@ jobs: - name: Prepare Folder Structure run: | - mkdir -p release/backend - mkdir -p release/updater - mkdir -p release/control-station/static - mkdir -p release/ethernet-view/static + mkdir -p control-station + mkdir -p control-station/updater + mkdir -p control-station/ethernet-view shell: bash ############################################ @@ -53,41 +58,36 @@ jobs: - name: Build backend for Linux if: matrix.os == 'ubuntu-latest' run: | - GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o release/backend/backend-linux-64 ./backend/cmd + GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o control-station/backend ./backend/cmd - name: Build backend for Windows + if: matrix.os == 'windows-latest' run: | - GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build -o release/backend/backend-windows-64.exe ./backend/cmd + GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build -o control-station/backend.exe ./backend/cmd - - name: Build backend for macOS Intel + - name: Build backend for macOS if: matrix.os == 'macos-latest' run: | - GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build -o release/backend/backend-macos-64 ./backend/cmd - - - name: Build backend for macOS ARM64 - if: matrix.os == 'macos-latest' - run: | - GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build -o release/backend/backend-macos-m1 ./backend/cmd + GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build -o control-station/backend ./backend/cmd ############################################ # UPDATER BUILDS ############################################ - name: Build updater for Linux + if: matrix.os == 'ubuntu-latest' run: | - GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o release/updater/updater-linux ./updater + GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o control-station/updater/updater ./updater - name: Build updater for Windows + if: matrix.os == 'windows-latest' run: | - GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o release/updater/updater-windows.exe ./updater + GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o control-station/updater/updater.exe ./updater - - name: Build updater for macOS Intel - run: | - GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o release/updater/updater-macos-64 ./updater - - - name: Build updater for macOS ARM64 + - name: Build updater for macOS + if: matrix.os == 'macos-latest' run: | - GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -o release/updater/updater-macos-m1 ./updater + GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o control-station/updater/updater ./updater ############################################ # FRONTEND BUILDS @@ -107,19 +107,9 @@ jobs: npm install npm run build - - name: Rename control-station artifact for platform + - name: Copy control-station static files run: | - if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then - mv ./control-station/static ./control-station-linux-x64 - elif [ "${{ matrix.os }}" == "macos-latest" ]; then - if [ "$(uname -m)" == "arm64" ]; then - mv ./control-station/static ./control-station-macos-arm - else - mv ./control-station/static ./control-station-macos-x64 - fi - elif [ "${{ matrix.os }}" == "windows-latest" ]; then - mv ./control-station/static ./control-station-windows-x64.exe - fi + cp -r ./control-station/static/* ./control-station/ || true - name: Upload control-station artifact uses: actions/upload-artifact@v4 @@ -143,9 +133,15 @@ jobs: # BUILD testadj ############################################ - - name: Bundle testadj.py + - name: Bundle testadj.py for Linux/macOS + if: matrix.os != 'windows-latest' + run: | + pyinstaller --onefile backend/cmd/testadj.py --distpath control-station/ + + - name: Bundle testadj.py for Windows + if: matrix.os == 'windows-latest' run: | - pyinstaller --onefile backend/cmd/testadj.py --distpath release/ + pyinstaller --onefile backend/cmd/testadj.py --distpath control-station/ --name testadj.exe ############################################ # PACKAGE METADATA @@ -153,42 +149,50 @@ jobs: - name: Copy additional files run: | - cp backend/cmd/config.toml release/ - cp backend/cmd/VERSION.md release/ - cp README.md release/ - - - name: Ensure control-station directory exists - run: mkdir -p ./release/control-station/static + cp backend/cmd/config.toml control-station/ + cp backend/cmd/VERSION.md control-station/ + cp README.md control-station/ - name: Download control-station artifact uses: actions/download-artifact@v4 with: name: control-station-${{ matrix.os }} - path: ./release/ + path: ./control-station/ - name: Ensure ethernet-view directory exists - run: mkdir -p ./release/ethernet-view/static + run: mkdir -p ./control-station/ethernet-view - name: Download ethernet-view artifact uses: actions/download-artifact@v4 with: name: ethernet-view-${{ matrix.os }} - path: ./release/ethernet-view/static + path: ./control-station/ethernet-view/ - - name: Create platform-specific ZIP + - name: Create Linux ZIP + if: matrix.os == 'ubuntu-latest' + run: | + mkdir -p release-zips + cd control-station && zip -r ../release-zips/control-station-linux-x64.zip . + + - name: Create macOS x64 ZIP + if: matrix.os == 'macos-latest' + run: | + mkdir -p release-zips + cd control-station && zip -r ../release-zips/control-station-macos-x64.zip . + + - name: Create macOS ARM ZIP (on x64 runner) + if: matrix.os == 'macos-latest' + run: | + # Build ARM version specifically for this ZIP + GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build -o control-station/backend ./backend/cmd + GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -o control-station/updater/updater ./updater + cd control-station && zip -r ../release-zips/control-station-macos-arm.zip . + + - name: Create Windows ZIP + if: matrix.os == 'windows-latest' run: | mkdir -p release-zips - if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then - zip -r release-zips/release-linux-x64.zip release/backend/backend-linux-64 release/control-station release/ethernet-view release/testadj release/config.toml release/VERSION.md release/README.md release/updater - elif [ "${{ matrix.os }}" == "macos-latest" ]; then - if [ "$(uname -m)" == "arm64" ]; then - zip -r release-zips/release-macos-arm.zip release/backend/backend-macos-m1 release/control-station release/ethernet-view release/testadj release/config.toml release/VERSION.md release/README.md release/updater - else - zip -r release-zips/release-macos-x64.zip release/backend/backend-macos-64 release/control-station release/ethernet-view release/testadj release/config.toml release/VERSION.md release/README.md release/updater - fi - elif [ "${{ matrix.os }}" == "windows-latest" ]; then - zip -r release-zips/release-windows-x64.zip release/backend/backend-windows-64.exe release/control-station release/ethernet-view release/testadj.exe release/config.toml release/VERSION.md release/README.md release/updater - fi + cd control-station && zip -r ../release-zips/control-station-windows-x64.zip . ############################################ # CREATE DRAFT RELEASE @@ -200,6 +204,6 @@ jobs: tag_name: "v${{ github.run_number }}" name: "Draft Release v${{ github.run_number }}" draft: true - files: release-zips/release-*.zip + files: release-zips/control-station-*.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 7524e0d9c975cd0a31953f12d677573727203959 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 19:49:39 +0200 Subject: [PATCH 33/42] new release.yaml --- .github/workflows/release.yaml | 406 +++++++++++++++++++-------------- 1 file changed, 239 insertions(+), 167 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 595d7a5a9..56a52ee38 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,208 +2,280 @@ name: Release on: workflow_dispatch: + inputs: + version: + description: 'Release version' + required: true + default: '' + release: + types: [created] jobs: - build-and-release: - name: Build & Package All Components + build-backend: + name: Build Backend runs-on: ${{ matrix.os }} - strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + include: + - os: ubuntu-latest + name: linux + container: + image: golang:alpine + setup: | + apk update && apk add --no-cache libpcap-dev musl-dev gcc go + build_cmd: | + cd backend/cmd + CGO_ENABLED=1 GOARCH=amd64 GOOS=linux go build -ldflags '-linkmode external -extldflags "-static"' -o ../output/backend-linux-amd64 + artifact_name: backend-linux + + - os: windows-latest + name: windows + setup: | + echo "Setting up Windows environment" + build_cmd: | + cd backend\cmd + $env:CGO_ENABLED="1" + $env:GOARCH="amd64" + $env:GOOS="windows" + go build -o ..\output\backend-windows-amd64.exe + artifact_name: backend-windows + + - os: macos-latest + name: macos + setup: | + brew install libpcap + build_cmd: | + cd backend/cmd + CGO_ENABLED=1 GOARCH=amd64 GOOS=darwin go build -o ../output/backend-macos-amd64 + CGO_ENABLED=1 GOARCH=arm64 GOOS=darwin go build -o ../output/backend-macos-arm64 + artifact_name: backend-macos steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Install build-essential and libpcap-dev on Linux - if: matrix.os == 'ubuntu-latest' - run: sudo apt-get update && sudo apt-get install -y build-essential libpcap-dev + - uses: actions/checkout@v4 - - name: Install Windows dependencies - if: matrix.os == 'windows-latest' - run: | - choco install -y npcap - choco install -y zip - - - name: Set up Go + - name: Setup environment + run: ${{ matrix.setup }} + + - name: Setup Go + if: matrix.os != 'ubuntu-latest' uses: actions/setup-go@v4 with: go-version: "1.21.3" - - - name: Set up Python - uses: actions/setup-python@v4 + cache-dependency-path: backend/go.sum + + - name: Create output directory + run: mkdir -p backend/output + shell: bash + + - name: Build backend + run: ${{ matrix.build_cmd }} + shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }} + + - name: Upload artifact + uses: actions/upload-artifact@v4 with: - python-version: "3.11" - - - name: Set up Node.js + name: ${{ matrix.artifact_name }} + path: backend/output/* + retention-days: 7 + compression-level: 9 + + build-frontend: + name: Build Frontends + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: "20" - - - name: Install PyInstaller - run: pip install pyinstaller - - - name: Prepare Folder Structure - run: | - mkdir -p control-station - mkdir -p control-station/updater - mkdir -p control-station/ethernet-view - shell: bash - - ############################################ - # BACKEND BUILDS - ############################################ - - - name: Build backend for Linux - if: matrix.os == 'ubuntu-latest' - run: | - GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o control-station/backend ./backend/cmd - - - name: Build backend for Windows - if: matrix.os == 'windows-latest' - run: | - GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build -o control-station/backend.exe ./backend/cmd - - - name: Build backend for macOS - if: matrix.os == 'macos-latest' - run: | - GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build -o control-station/backend ./backend/cmd - - ############################################ - # UPDATER BUILDS - ############################################ - - - name: Build updater for Linux - if: matrix.os == 'ubuntu-latest' - run: | - GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o control-station/updater/updater ./updater - - - name: Build updater for Windows - if: matrix.os == 'windows-latest' - run: | - GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o control-station/updater/updater.exe ./updater - - - name: Build updater for macOS - if: matrix.os == 'macos-latest' - run: | - GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o control-station/updater/updater ./updater - - ############################################ - # FRONTEND BUILDS - ############################################ - - - name: Install common-front dependencies - working-directory: ./common-front - run: npm install - - - name: Build common-front + node-version: '18' + cache: 'npm' + + - name: Build common front dependencies working-directory: ./common-front - run: npm run build - - - name: Build control-station - working-directory: ./control-station run: | npm install npm run build - - - name: Copy control-station static files - run: | - cp -r ./control-station/static/* ./control-station/ || true - - - name: Upload control-station artifact - uses: actions/upload-artifact@v4 - with: - name: control-station-${{ matrix.os }} - path: ./control-station-* - - - name: Build ethernet-view + + - name: Build ethernet view working-directory: ./ethernet-view run: | npm install npm run build - - - name: Upload ethernet-view artifact + + - name: Upload ethernet view artifact uses: actions/upload-artifact@v4 with: - name: ethernet-view-${{ matrix.os }} - path: ./ethernet-view/static/* - - ############################################ - # BUILD testadj - ############################################ - - - name: Bundle testadj.py for Linux/macOS - if: matrix.os != 'windows-latest' - run: | - pyinstaller --onefile backend/cmd/testadj.py --distpath control-station/ + name: ethernet-view + path: ethernet-view/static/* + retention-days: 7 + compression-level: 9 - - name: Bundle testadj.py for Windows - if: matrix.os == 'windows-latest' - run: | - pyinstaller --onefile backend/cmd/testadj.py --distpath control-station/ --name testadj.exe - - ############################################ - # PACKAGE METADATA - ############################################ - - - name: Copy additional files + - name: Build control station + working-directory: ./control-station run: | - cp backend/cmd/config.toml control-station/ - cp backend/cmd/VERSION.md control-station/ - cp README.md control-station/ - - - name: Download control-station artifact - uses: actions/download-artifact@v4 + npm install + npm run build + + - name: Upload control station artifact + uses: actions/upload-artifact@v4 with: - name: control-station-${{ matrix.os }} - path: ./control-station/ + name: control-station + path: control-station/static/* + retention-days: 7 + compression-level: 9 - - name: Ensure ethernet-view directory exists - run: mkdir -p ./control-station/ethernet-view + build-updater: + name: Build Updater + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: ubuntu-latest + name: linux + build_cmd: | + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o updater/output/updater-linux-amd64 ./updater + artifact_name: updater-linux + + - os: windows-latest + name: windows + build_cmd: | + $Env:CGO_ENABLED='0' + $Env:GOOS='windows' + $Env:GOARCH='amd64' + go build -o updater\output\updater-windows-amd64.exe ./updater + artifact_name: updater-windows + + - os: macos-latest + name: macos + build_cmd: | + CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o updater/output/updater-macos-amd64 ./updater + CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o updater/output/updater-macos-arm64 ./updater + artifact_name: updater-macos - - name: Download ethernet-view artifact - uses: actions/download-artifact@v4 + steps: + - uses: actions/checkout@v4 with: - name: ethernet-view-${{ matrix.os }} - path: ./control-station/ethernet-view/ - - - name: Create Linux ZIP - if: matrix.os == 'ubuntu-latest' + fetch-depth: 0 + + - name: Mark workspace as safe + run: git config --global --add safe.directory $GITHUB_WORKSPACE + shell: bash + + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: "1.21.3" + cache-dependency-path: updater/go.sum + + - name: Ensure dependencies + working-directory: updater + run: go mod tidy + shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }} + + - name: Create output directory + run: mkdir -p updater/output + shell: bash + + - name: Build updater + run: ${{ matrix.build_cmd }} + shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }} + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact_name }} + path: updater/output/* + retention-days: 7 + compression-level: 9 + + prepare-common-files: + name: Prepare Common Files + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Create common files directory + run: mkdir -p common-files + + - name: Copy config.toml + run: cp backend/cmd/config.toml common-files/ + + - name: Copy testadj.py + run: cp backend/cmd/testadj.py common-files/ + + - name: Copy README.md + run: cp README.md common-files/ + + - name: Copy VERSION.md + run: cp backend/cmd/VERSION.md common-files/ + + - name: Upload common files artifact + uses: actions/upload-artifact@v4 + with: + name: common-files + path: common-files/* + retention-days: 7 + compression-level: 9 + + package-release: + name: Package Release + needs: [build-backend, build-frontend, build-updater, prepare-common-files] + runs-on: ubuntu-latest + steps: + - name: Create release directories run: | - mkdir -p release-zips - cd control-station && zip -r ../release-zips/control-station-linux-x64.zip . - - - name: Create macOS x64 ZIP - if: matrix.os == 'macos-latest' + mkdir -p release + mkdir -p release/backends + mkdir -p release/updaters + mkdir -p release/frontends/ethernet-view + mkdir -p release/frontends/control-station + + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + + - name: Organize release files run: | - mkdir -p release-zips - cd control-station && zip -r ../release-zips/control-station-macos-x64.zip . + # Copy backends + cp -r artifacts/backend-linux/* release/backends/ + cp -r artifacts/backend-windows/* release/backends/ + cp -r artifacts/backend-macos/* release/backends/ - - name: Create macOS ARM ZIP (on x64 runner) - if: matrix.os == 'macos-latest' - run: | - # Build ARM version specifically for this ZIP - GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build -o control-station/backend ./backend/cmd - GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -o control-station/updater/updater ./updater - cd control-station && zip -r ../release-zips/control-station-macos-arm.zip . + # Copy updaters + cp -r artifacts/updater-linux/* release/updaters/ + cp -r artifacts/updater-windows/* release/updaters/ + cp -r artifacts/updater-macos/* release/updaters/ + + # Copy frontends + cp -r artifacts/ethernet-view/* release/frontends/ethernet-view/ + cp -r artifacts/control-station/* release/frontends/control-station/ - - name: Create Windows ZIP - if: matrix.os == 'windows-latest' + # Copy common files + cp -r artifacts/common-files/* release/ + + - name: Create release archive run: | - mkdir -p release-zips - cd control-station && zip -r ../release-zips/control-station-windows-x64.zip . - - ############################################ - # CREATE DRAFT RELEASE - ############################################ - - - name: Create Draft GitHub Release - uses: softprops/action-gh-release@v1 + VERSION="${{ github.event.inputs.version || github.event.release.tag_name || 'latest' }}" + cd release + zip -r ../software-release-$VERSION.zip . + + - name: Upload release package + uses: actions/upload-artifact@v4 with: - tag_name: "v${{ github.run_number }}" - name: "Draft Release v${{ github.run_number }}" - draft: true - files: release-zips/control-station-*.zip + name: software-release + path: software-release-*.zip + retention-days: 7 + compression-level: 9 + + - name: Upload to release + if: github.event_name == 'release' + uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./software-release-${{ github.event.release.tag_name }}.zip + asset_name: software-release-${{ github.event.release.tag_name }}.zip + asset_content_type: application/zip \ No newline at end of file From bf123f3becb9830b6f463a5292cbba1f18988904 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 19:53:35 +0200 Subject: [PATCH 34/42] change matrix for runner in release.yaml --- .github/workflows/release.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 56a52ee38..74a303f9a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -69,7 +69,7 @@ jobs: - name: Build backend run: ${{ matrix.build_cmd }} - shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }} + shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }} - name: Upload artifact uses: actions/upload-artifact@v4 @@ -171,7 +171,7 @@ jobs: - name: Ensure dependencies working-directory: updater run: go mod tidy - shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }} + shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }} - name: Create output directory run: mkdir -p updater/output @@ -179,7 +179,7 @@ jobs: - name: Build updater run: ${{ matrix.build_cmd }} - shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }} + shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }} - name: Upload artifact uses: actions/upload-artifact@v4 From 0a8a172f28a98bee44cb0764f8e89b2f94477f26 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 19:56:47 +0200 Subject: [PATCH 35/42] assign shells explicitly in release.yaml --- .github/workflows/release.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 74a303f9a..413da9f7c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -27,6 +27,7 @@ jobs: cd backend/cmd CGO_ENABLED=1 GOARCH=amd64 GOOS=linux go build -ldflags '-linkmode external -extldflags "-static"' -o ../output/backend-linux-amd64 artifact_name: backend-linux + shell: bash - os: windows-latest name: windows @@ -39,6 +40,7 @@ jobs: $env:GOOS="windows" go build -o ..\output\backend-windows-amd64.exe artifact_name: backend-windows + shell: pwsh - os: macos-latest name: macos @@ -49,6 +51,7 @@ jobs: CGO_ENABLED=1 GOARCH=amd64 GOOS=darwin go build -o ../output/backend-macos-amd64 CGO_ENABLED=1 GOARCH=arm64 GOOS=darwin go build -o ../output/backend-macos-arm64 artifact_name: backend-macos + shell: bash steps: - uses: actions/checkout@v4 @@ -69,7 +72,7 @@ jobs: - name: Build backend run: ${{ matrix.build_cmd }} - shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }} + shell: ${{ matrix.shell }} - name: Upload artifact uses: actions/upload-artifact@v4 @@ -136,6 +139,7 @@ jobs: build_cmd: | CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o updater/output/updater-linux-amd64 ./updater artifact_name: updater-linux + shell: bash - os: windows-latest name: windows @@ -145,6 +149,7 @@ jobs: $Env:GOARCH='amd64' go build -o updater\output\updater-windows-amd64.exe ./updater artifact_name: updater-windows + shell: pwsh - os: macos-latest name: macos @@ -152,6 +157,7 @@ jobs: CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o updater/output/updater-macos-amd64 ./updater CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o updater/output/updater-macos-arm64 ./updater artifact_name: updater-macos + shell: bash steps: - uses: actions/checkout@v4 @@ -171,7 +177,7 @@ jobs: - name: Ensure dependencies working-directory: updater run: go mod tidy - shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }} + shell: ${{ matrix.shell }} - name: Create output directory run: mkdir -p updater/output @@ -179,7 +185,7 @@ jobs: - name: Build updater run: ${{ matrix.build_cmd }} - shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }} + shell: ${{ matrix.shell }} - name: Upload artifact uses: actions/upload-artifact@v4 From 517581c3d4ba5369a1702108f892f4ccd8e4e078 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 19:59:50 +0200 Subject: [PATCH 36/42] use shells independently release.yaml --- .github/workflows/release.yaml | 39 ++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 413da9f7c..7e6b44733 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -19,15 +19,12 @@ jobs: include: - os: ubuntu-latest name: linux - container: - image: golang:alpine setup: | apk update && apk add --no-cache libpcap-dev musl-dev gcc go build_cmd: | cd backend/cmd CGO_ENABLED=1 GOARCH=amd64 GOOS=linux go build -ldflags '-linkmode external -extldflags "-static"' -o ../output/backend-linux-amd64 artifact_name: backend-linux - shell: bash - os: windows-latest name: windows @@ -40,7 +37,6 @@ jobs: $env:GOOS="windows" go build -o ..\output\backend-windows-amd64.exe artifact_name: backend-windows - shell: pwsh - os: macos-latest name: macos @@ -51,7 +47,6 @@ jobs: CGO_ENABLED=1 GOARCH=amd64 GOOS=darwin go build -o ../output/backend-macos-amd64 CGO_ENABLED=1 GOARCH=arm64 GOOS=darwin go build -o ../output/backend-macos-arm64 artifact_name: backend-macos - shell: bash steps: - uses: actions/checkout@v4 @@ -70,9 +65,15 @@ jobs: run: mkdir -p backend/output shell: bash - - name: Build backend + - name: Build backend (Linux/macOS) + if: matrix.os != 'windows-latest' run: ${{ matrix.build_cmd }} - shell: ${{ matrix.shell }} + shell: bash + + - name: Build backend (Windows) + if: matrix.os == 'windows-latest' + run: ${{ matrix.build_cmd }} + shell: pwsh - name: Upload artifact uses: actions/upload-artifact@v4 @@ -139,7 +140,6 @@ jobs: build_cmd: | CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o updater/output/updater-linux-amd64 ./updater artifact_name: updater-linux - shell: bash - os: windows-latest name: windows @@ -149,7 +149,6 @@ jobs: $Env:GOARCH='amd64' go build -o updater\output\updater-windows-amd64.exe ./updater artifact_name: updater-windows - shell: pwsh - os: macos-latest name: macos @@ -157,7 +156,6 @@ jobs: CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o updater/output/updater-macos-amd64 ./updater CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o updater/output/updater-macos-arm64 ./updater artifact_name: updater-macos - shell: bash steps: - uses: actions/checkout@v4 @@ -174,18 +172,31 @@ jobs: go-version: "1.21.3" cache-dependency-path: updater/go.sum - - name: Ensure dependencies + - name: Ensure dependencies (Linux/macOS) + if: matrix.os != 'windows-latest' working-directory: updater run: go mod tidy - shell: ${{ matrix.shell }} + shell: bash + + - name: Ensure dependencies (Windows) + if: matrix.os == 'windows-latest' + working-directory: updater + run: go mod tidy + shell: pwsh - name: Create output directory run: mkdir -p updater/output shell: bash - - name: Build updater + - name: Build updater (Linux/macOS) + if: matrix.os != 'windows-latest' + run: ${{ matrix.build_cmd }} + shell: bash + + - name: Build updater (Windows) + if: matrix.os == 'windows-latest' run: ${{ matrix.build_cmd }} - shell: ${{ matrix.shell }} + shell: pwsh - name: Upload artifact uses: actions/upload-artifact@v4 From 74674fb7ca3b2493b349120efab3758cc34eacb2 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 20:04:33 +0200 Subject: [PATCH 37/42] use alpine for ubuntu container in release.yaml --- .github/workflows/release.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7e6b44733..5ead45849 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -14,11 +14,14 @@ jobs: build-backend: name: Build Backend runs-on: ${{ matrix.os }} + container: ${{ matrix.container }} strategy: matrix: include: - os: ubuntu-latest name: linux + container: + image: golang:alpine setup: | apk update && apk add --no-cache libpcap-dev musl-dev gcc go build_cmd: | From c96ce71efb5ba006d6c4225b3eb0d3eca38d417b Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 21:37:04 +0200 Subject: [PATCH 38/42] add bash to ubuntu container in release.yaml --- .github/workflows/release.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5ead45849..f8aacf8be 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -23,7 +23,7 @@ jobs: container: image: golang:alpine setup: | - apk update && apk add --no-cache libpcap-dev musl-dev gcc go + apk update && apk add --no-cache libpcap-dev musl-dev gcc go bash build_cmd: | cd backend/cmd CGO_ENABLED=1 GOARCH=amd64 GOOS=linux go build -ldflags '-linkmode external -extldflags "-static"' -o ../output/backend-linux-amd64 @@ -66,12 +66,12 @@ jobs: - name: Create output directory run: mkdir -p backend/output - shell: bash + shell: ${{ matrix.os != 'windows-latest' && 'sh' || 'bash' }} - name: Build backend (Linux/macOS) if: matrix.os != 'windows-latest' run: ${{ matrix.build_cmd }} - shell: bash + shell: sh - name: Build backend (Windows) if: matrix.os == 'windows-latest' From 38c85bc8e51199ca6838a23827ecb2304395113f Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 21:39:15 +0200 Subject: [PATCH 39/42] avoid shell field in release.yaml --- .github/workflows/release.yaml | 56 ++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f8aacf8be..8d72f3ffd 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -64,15 +64,31 @@ jobs: go-version: "1.21.3" cache-dependency-path: backend/go.sum - - name: Create output directory + - name: Create output directory (Linux) + if: matrix.os == 'ubuntu-latest' run: mkdir -p backend/output - shell: ${{ matrix.os != 'windows-latest' && 'sh' || 'bash' }} + shell: sh + + - name: Create output directory (macOS) + if: matrix.os == 'macos-latest' + run: mkdir -p backend/output + shell: bash + + - name: Create output directory (Windows) + if: matrix.os == 'windows-latest' + run: mkdir -p backend/output + shell: bash - - name: Build backend (Linux/macOS) - if: matrix.os != 'windows-latest' + - name: Build backend (Linux) + if: matrix.os == 'ubuntu-latest' run: ${{ matrix.build_cmd }} shell: sh + - name: Build backend (macOS) + if: matrix.os == 'macos-latest' + run: ${{ matrix.build_cmd }} + shell: bash + - name: Build backend (Windows) if: matrix.os == 'windows-latest' run: ${{ matrix.build_cmd }} @@ -175,8 +191,14 @@ jobs: go-version: "1.21.3" cache-dependency-path: updater/go.sum - - name: Ensure dependencies (Linux/macOS) - if: matrix.os != 'windows-latest' + - name: Ensure dependencies (Linux) + if: matrix.os == 'ubuntu-latest' + working-directory: updater + run: go mod tidy + shell: bash + + - name: Ensure dependencies (macOS) + if: matrix.os == 'macos-latest' working-directory: updater run: go mod tidy shell: bash @@ -187,12 +209,28 @@ jobs: run: go mod tidy shell: pwsh - - name: Create output directory + - name: Create output directory (Linux) + if: matrix.os == 'ubuntu-latest' + run: mkdir -p updater/output + shell: bash + + - name: Create output directory (macOS) + if: matrix.os == 'macos-latest' + run: mkdir -p updater/output + shell: bash + + - name: Create output directory (Windows) + if: matrix.os == 'windows-latest' run: mkdir -p updater/output shell: bash - - name: Build updater (Linux/macOS) - if: matrix.os != 'windows-latest' + - name: Build updater (Linux) + if: matrix.os == 'ubuntu-latest' + run: ${{ matrix.build_cmd }} + shell: bash + + - name: Build updater (macOS) + if: matrix.os == 'macos-latest' run: ${{ matrix.build_cmd }} shell: bash From d6b8456e1c1b4023eed617af8792195f6236d840 Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 21:47:07 +0200 Subject: [PATCH 40/42] create draft release by default in release.yaml --- .github/workflows/release.yaml | 45 ++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8d72f3ffd..a7d22fc50 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -7,6 +7,10 @@ on: description: 'Release version' required: true default: '' + draft: + description: 'Create as draft release' + type: boolean + default: true release: types: [created] @@ -301,10 +305,18 @@ jobs: cp -r artifacts/backend-windows/* release/backends/ cp -r artifacts/backend-macos/* release/backends/ - # Copy updaters - cp -r artifacts/updater-linux/* release/updaters/ - cp -r artifacts/updater-windows/* release/updaters/ - cp -r artifacts/updater-macos/* release/updaters/ + # Copy updaters to appropriate folders by platform + mkdir -p release/linux release/windows release/macos release/macos-arm64 + + # Copy Linux updater + cp artifacts/updater-linux/updater-linux-amd64 release/linux/updater + + # Copy Windows updater + cp artifacts/updater-windows/updater-windows-amd64.exe release/windows/updater.exe + + # Copy macOS updaters + cp artifacts/updater-macos/updater-macos-amd64 release/macos/updater + cp artifacts/updater-macos/updater-macos-arm64 release/macos-arm64/updater # Copy frontends cp -r artifacts/ethernet-view/* release/frontends/ethernet-view/ @@ -327,7 +339,30 @@ jobs: retention-days: 7 compression-level: 9 - - name: Upload to release + - name: Create Release + if: github.event_name == 'workflow_dispatch' + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ github.event.inputs.version }} + release_name: Release ${{ github.event.inputs.version }} + draft: ${{ github.event.inputs.draft }} + prerelease: false + + - name: Upload to workflow dispatch release + if: github.event_name == 'workflow_dispatch' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./software-release-${{ github.event.inputs.version }}.zip + asset_name: software-release-${{ github.event.inputs.version }}.zip + asset_content_type: application/zip + + - name: Upload to existing release if: github.event_name == 'release' uses: actions/upload-release-asset@v1 env: From 174648979157df63a9f17d4b83698014509b883b Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sat, 24 May 2025 21:58:05 +0200 Subject: [PATCH 41/42] fix release structure in release.yaml --- .github/workflows/release.yaml | 193 +++++++++++++++++++++++++++------ 1 file changed, 159 insertions(+), 34 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a7d22fc50..477125df3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -285,56 +285,115 @@ jobs: needs: [build-backend, build-frontend, build-updater, prepare-common-files] runs-on: ubuntu-latest steps: - - name: Create release directories - run: | - mkdir -p release - mkdir -p release/backends - mkdir -p release/updaters - mkdir -p release/frontends/ethernet-view - mkdir -p release/frontends/control-station - - name: Download all artifacts uses: actions/download-artifact@v4 with: path: artifacts - - name: Organize release files + - name: Create release directories for each platform run: | - # Copy backends - cp -r artifacts/backend-linux/* release/backends/ - cp -r artifacts/backend-windows/* release/backends/ - cp -r artifacts/backend-macos/* release/backends/ + VERSION="${{ github.event.inputs.version || github.event.release.tag_name || 'latest' }}" - # Copy updaters to appropriate folders by platform - mkdir -p release/linux release/windows release/macos release/macos-arm64 + # Create directory structure for each platform + mkdir -p release-linux + mkdir -p release-windows + mkdir -p release-macos + mkdir -p release-macos-arm64 + + # Setup frontend directories for each platform + for platform in release-linux release-windows release-macos release-macos-arm64; do + mkdir -p $platform/frontends/ethernet-view + mkdir -p $platform/frontends/control-station + done + + - name: Organize Linux release files + run: | + VERSION="${{ github.event.inputs.version || github.event.release.tag_name || 'latest' }}" + + # Copy Linux backend + cp artifacts/backend-linux/backend-linux-amd64 release-linux/backend # Copy Linux updater - cp artifacts/updater-linux/updater-linux-amd64 release/linux/updater + cp artifacts/updater-linux/updater-linux-amd64 release-linux/updater + + # Copy frontends + cp -r artifacts/ethernet-view/* release-linux/frontends/ethernet-view/ + cp -r artifacts/control-station/* release-linux/frontends/control-station/ + + # Copy common files + cp -r artifacts/common-files/* release-linux/ + + # Create Linux release archive + cd release-linux + zip -r ../software-release-linux-$VERSION.zip . + + - name: Organize Windows release files + run: | + VERSION="${{ github.event.inputs.version || github.event.release.tag_name || 'latest' }}" + + # Copy Windows backend + cp artifacts/backend-windows/backend-windows-amd64.exe release-windows/backend.exe # Copy Windows updater - cp artifacts/updater-windows/updater-windows-amd64.exe release/windows/updater.exe + cp artifacts/updater-windows/updater-windows-amd64.exe release-windows/updater.exe - # Copy macOS updaters - cp artifacts/updater-macos/updater-macos-amd64 release/macos/updater - cp artifacts/updater-macos/updater-macos-arm64 release/macos-arm64/updater + # Copy frontends + cp -r artifacts/ethernet-view/* release-windows/frontends/ethernet-view/ + cp -r artifacts/control-station/* release-windows/frontends/control-station/ + + # Copy common files + cp -r artifacts/common-files/* release-windows/ + + # Create Windows release archive + cd release-windows + zip -r ../software-release-windows-$VERSION.zip . + + - name: Organize macOS Intel release files + run: | + VERSION="${{ github.event.inputs.version || github.event.release.tag_name || 'latest' }}" + + # Copy macOS Intel backend + cp artifacts/backend-macos/backend-macos-amd64 release-macos/backend + + # Copy macOS Intel updater + cp artifacts/updater-macos/updater-macos-amd64 release-macos/updater # Copy frontends - cp -r artifacts/ethernet-view/* release/frontends/ethernet-view/ - cp -r artifacts/control-station/* release/frontends/control-station/ + cp -r artifacts/ethernet-view/* release-macos/frontends/ethernet-view/ + cp -r artifacts/control-station/* release-macos/frontends/control-station/ # Copy common files - cp -r artifacts/common-files/* release/ + cp -r artifacts/common-files/* release-macos/ + + # Create macOS Intel release archive + cd release-macos + zip -r ../software-release-macos-intel-$VERSION.zip . - - name: Create release archive + - name: Organize macOS ARM64 release files run: | VERSION="${{ github.event.inputs.version || github.event.release.tag_name || 'latest' }}" - cd release - zip -r ../software-release-$VERSION.zip . + + # Copy macOS ARM64 backend + cp artifacts/backend-macos/backend-macos-arm64 release-macos-arm64/backend + + # Copy macOS ARM64 updater + cp artifacts/updater-macos/updater-macos-arm64 release-macos-arm64/updater + + # Copy frontends + cp -r artifacts/ethernet-view/* release-macos-arm64/frontends/ethernet-view/ + cp -r artifacts/control-station/* release-macos-arm64/frontends/control-station/ + + # Copy common files + cp -r artifacts/common-files/* release-macos-arm64/ + + # Create macOS ARM64 release archive + cd release-macos-arm64 + zip -r ../software-release-macos-arm64-$VERSION.zip . - - name: Upload release package + - name: Upload release packages uses: actions/upload-artifact@v4 with: - name: software-release + name: software-releases path: software-release-*.zip retention-days: 7 compression-level: 9 @@ -351,24 +410,90 @@ jobs: draft: ${{ github.event.inputs.draft }} prerelease: false - - name: Upload to workflow dispatch release + - name: Upload Linux package to release + if: github.event_name == 'workflow_dispatch' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./software-release-linux-${{ github.event.inputs.version }}.zip + asset_name: software-release-linux-${{ github.event.inputs.version }}.zip + asset_content_type: application/zip + + - name: Upload Windows package to release if: github.event_name == 'workflow_dispatch' uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./software-release-${{ github.event.inputs.version }}.zip - asset_name: software-release-${{ github.event.inputs.version }}.zip + asset_path: ./software-release-windows-${{ github.event.inputs.version }}.zip + asset_name: software-release-windows-${{ github.event.inputs.version }}.zip + asset_content_type: application/zip + + - name: Upload macOS Intel package to release + if: github.event_name == 'workflow_dispatch' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./software-release-macos-intel-${{ github.event.inputs.version }}.zip + asset_name: software-release-macos-intel-${{ github.event.inputs.version }}.zip + asset_content_type: application/zip + + - name: Upload macOS ARM64 package to release + if: github.event_name == 'workflow_dispatch' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./software-release-macos-arm64-${{ github.event.inputs.version }}.zip + asset_name: software-release-macos-arm64-${{ github.event.inputs.version }}.zip + asset_content_type: application/zip + + - name: Upload Linux package to existing release + if: github.event_name == 'release' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./software-release-linux-${{ github.event.release.tag_name }}.zip + asset_name: software-release-linux-${{ github.event.release.tag_name }}.zip + asset_content_type: application/zip + + - name: Upload Windows package to existing release + if: github.event_name == 'release' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./software-release-windows-${{ github.event.release.tag_name }}.zip + asset_name: software-release-windows-${{ github.event.release.tag_name }}.zip + asset_content_type: application/zip + + - name: Upload macOS Intel package to existing release + if: github.event_name == 'release' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./software-release-macos-intel-${{ github.event.release.tag_name }}.zip + asset_name: software-release-macos-intel-${{ github.event.release.tag_name }}.zip asset_content_type: application/zip - - name: Upload to existing release + - name: Upload macOS ARM64 package to existing release if: github.event_name == 'release' uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: ./software-release-${{ github.event.release.tag_name }}.zip - asset_name: software-release-${{ github.event.release.tag_name }}.zip + asset_path: ./software-release-macos-arm64-${{ github.event.release.tag_name }}.zip + asset_name: software-release-macos-arm64-${{ github.event.release.tag_name }}.zip asset_content_type: application/zip \ No newline at end of file From bb21b6cab13aa5fb046aa55ef0f4d201e7e3e14b Mon Sep 17 00:00:00 2001 From: Marc Sanchis Date: Sun, 25 May 2025 20:50:53 +0200 Subject: [PATCH 42/42] fix release structure in release.yaml --- .github/workflows/release.yaml | 74 +++++++++++++++++----------------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 477125df3..93047989c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -299,12 +299,6 @@ jobs: mkdir -p release-windows mkdir -p release-macos mkdir -p release-macos-arm64 - - # Setup frontend directories for each platform - for platform in release-linux release-windows release-macos release-macos-arm64; do - mkdir -p $platform/frontends/ethernet-view - mkdir -p $platform/frontends/control-station - done - name: Organize Linux release files run: | @@ -317,15 +311,17 @@ jobs: cp artifacts/updater-linux/updater-linux-amd64 release-linux/updater # Copy frontends - cp -r artifacts/ethernet-view/* release-linux/frontends/ethernet-view/ - cp -r artifacts/control-station/* release-linux/frontends/control-station/ + mkdir -p release-linux/ethernet-view + mkdir -p release-linux/control-station + cp -r artifacts/ethernet-view/* release-linux/ethernet-view/ + cp -r artifacts/control-station/* release-linux/control-station/ # Copy common files cp -r artifacts/common-files/* release-linux/ # Create Linux release archive cd release-linux - zip -r ../software-release-linux-$VERSION.zip . + zip -r ../linux-$VERSION.zip . - name: Organize Windows release files run: | @@ -338,15 +334,17 @@ jobs: cp artifacts/updater-windows/updater-windows-amd64.exe release-windows/updater.exe # Copy frontends - cp -r artifacts/ethernet-view/* release-windows/frontends/ethernet-view/ - cp -r artifacts/control-station/* release-windows/frontends/control-station/ + mkdir -p release-windows/ethernet-view + mkdir -p release-windows/control-station + cp -r artifacts/ethernet-view/* release-windows/ethernet-view/ + cp -r artifacts/control-station/* release-windows/control-station/ # Copy common files cp -r artifacts/common-files/* release-windows/ # Create Windows release archive cd release-windows - zip -r ../software-release-windows-$VERSION.zip . + zip -r ../windows-$VERSION.zip . - name: Organize macOS Intel release files run: | @@ -359,15 +357,17 @@ jobs: cp artifacts/updater-macos/updater-macos-amd64 release-macos/updater # Copy frontends - cp -r artifacts/ethernet-view/* release-macos/frontends/ethernet-view/ - cp -r artifacts/control-station/* release-macos/frontends/control-station/ + mkdir -p release-macos/ethernet-view + mkdir -p release-macos/control-station + cp -r artifacts/ethernet-view/* release-macos/ethernet-view/ + cp -r artifacts/control-station/* release-macos/control-station/ # Copy common files cp -r artifacts/common-files/* release-macos/ # Create macOS Intel release archive cd release-macos - zip -r ../software-release-macos-intel-$VERSION.zip . + zip -r ../macos-intel-$VERSION.zip . - name: Organize macOS ARM64 release files run: | @@ -380,21 +380,23 @@ jobs: cp artifacts/updater-macos/updater-macos-arm64 release-macos-arm64/updater # Copy frontends - cp -r artifacts/ethernet-view/* release-macos-arm64/frontends/ethernet-view/ - cp -r artifacts/control-station/* release-macos-arm64/frontends/control-station/ + mkdir -p release-macos-arm64/ethernet-view + mkdir -p release-macos-arm64/control-station + cp -r artifacts/ethernet-view/* release-macos-arm64/ethernet-view/ + cp -r artifacts/control-station/* release-macos-arm64/control-station/ # Copy common files cp -r artifacts/common-files/* release-macos-arm64/ # Create macOS ARM64 release archive cd release-macos-arm64 - zip -r ../software-release-macos-arm64-$VERSION.zip . + zip -r ../macos-arm64-$VERSION.zip . - name: Upload release packages uses: actions/upload-artifact@v4 with: - name: software-releases - path: software-release-*.zip + name: releases + path: "*.zip" retention-days: 7 compression-level: 9 @@ -417,8 +419,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./software-release-linux-${{ github.event.inputs.version }}.zip - asset_name: software-release-linux-${{ github.event.inputs.version }}.zip + asset_path: ./linux-${{ github.event.inputs.version }}.zip + asset_name: linux-${{ github.event.inputs.version }}.zip asset_content_type: application/zip - name: Upload Windows package to release @@ -428,8 +430,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./software-release-windows-${{ github.event.inputs.version }}.zip - asset_name: software-release-windows-${{ github.event.inputs.version }}.zip + asset_path: ./windows-${{ github.event.inputs.version }}.zip + asset_name: windows-${{ github.event.inputs.version }}.zip asset_content_type: application/zip - name: Upload macOS Intel package to release @@ -439,8 +441,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./software-release-macos-intel-${{ github.event.inputs.version }}.zip - asset_name: software-release-macos-intel-${{ github.event.inputs.version }}.zip + asset_path: ./macos-intel-${{ github.event.inputs.version }}.zip + asset_name: macos-intel-${{ github.event.inputs.version }}.zip asset_content_type: application/zip - name: Upload macOS ARM64 package to release @@ -450,8 +452,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./software-release-macos-arm64-${{ github.event.inputs.version }}.zip - asset_name: software-release-macos-arm64-${{ github.event.inputs.version }}.zip + asset_path: ./macos-arm64-${{ github.event.inputs.version }}.zip + asset_name: macos-arm64-${{ github.event.inputs.version }}.zip asset_content_type: application/zip - name: Upload Linux package to existing release @@ -461,8 +463,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: ./software-release-linux-${{ github.event.release.tag_name }}.zip - asset_name: software-release-linux-${{ github.event.release.tag_name }}.zip + asset_path: ./linux-${{ github.event.release.tag_name }}.zip + asset_name: linux-${{ github.event.release.tag_name }}.zip asset_content_type: application/zip - name: Upload Windows package to existing release @@ -472,8 +474,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: ./software-release-windows-${{ github.event.release.tag_name }}.zip - asset_name: software-release-windows-${{ github.event.release.tag_name }}.zip + asset_path: ./windows-${{ github.event.release.tag_name }}.zip + asset_name: windows-${{ github.event.release.tag_name }}.zip asset_content_type: application/zip - name: Upload macOS Intel package to existing release @@ -483,8 +485,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: ./software-release-macos-intel-${{ github.event.release.tag_name }}.zip - asset_name: software-release-macos-intel-${{ github.event.release.tag_name }}.zip + asset_path: ./macos-intel-${{ github.event.release.tag_name }}.zip + asset_name: macos-intel-${{ github.event.release.tag_name }}.zip asset_content_type: application/zip - name: Upload macOS ARM64 package to existing release @@ -494,6 +496,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: ./software-release-macos-arm64-${{ github.event.release.tag_name }}.zip - asset_name: software-release-macos-arm64-${{ github.event.release.tag_name }}.zip + asset_path: ./macos-arm64-${{ github.event.release.tag_name }}.zip + asset_name: macos-arm64-${{ github.event.release.tag_name }}.zip asset_content_type: application/zip \ No newline at end of file