Files
Daniel Markstedt 27da017951 improve media workflows and version reporting in Go clients
- Extract selected archives directly into the image directory, skip existing images, and move properties files into the configuration directory without duplicate temporary storage.

- Limit no-media selectors to compatible image types, render device parameters without Go map delimiters, and return uploads to the upload page.

- Limit web uploads to the largest supported drive preset and simplify upload/download destination selection.

- Generate the shared Go project version from the C++ source, expose it through -v in the web, OLED, and Control Board clients, and verify it in Make, CI, and Debian builds.

- Update tests and documentation for the corrected web workflows and version flags.
2026-08-22 00:26:25 +02:00

162 lines
4.4 KiB
YAML

name: Go Applications
on:
push:
branches:
- develop
- main
paths:
- '.github/workflows/go-web.yml'
- 'go/**'
- 'cpp/shared/piscsi_version.cpp'
- 'proto/**'
pull_request:
branches:
- develop
- main
types:
- opened
- synchronize
- reopened
paths:
- '.github/workflows/go-web.yml'
- 'go/**'
- 'cpp/shared/piscsi_version.cpp'
- 'proto/**'
permissions:
contents: read
env:
GO_VERSION: '1.25.13'
jobs:
quality:
name: Test and analyze
runs-on: ubuntu-latest
defaults:
run:
working-directory: go
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: go/go.sum
- name: Install build and test dependencies
run: sudo apt-get update && sudo apt-get install --yes groff protobuf-compiler
- name: Install Go protobuf generator
run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.11
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
- name: Verify generated project version
run: make version-check
- name: Generate protobuf bindings
run: make proto
- name: Verify module files are tidy
run: go mod tidy -diff
- name: Test
run: make test-race
- name: Vet
run: go vet -tags nomsgpack ./...
- name: Vulnerability scan
run: go run golang.org/x/vuln/cmd/govulncheck@v1.6.0 -tags nomsgpack ./...
- name: Build binaries
run: make build mock
trixie:
name: Trixie build (${{ matrix.name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: arm64
platform: linux/arm64
- name: armv7
platform: linux/arm/v7
steps:
- uses: actions/checkout@v7
- uses: docker/setup-qemu-action@v4
with:
platforms: arm64,arm
- name: Build in the target distribution
working-directory: go
run: |
docker run --rm --platform "${{ matrix.platform }}" \
--env DEBIAN_FRONTEND=noninteractive \
--volume "${{ github.workspace }}:/workspace" \
--workdir /workspace/go \
golang:1.25.13-trixie \
sh -c 'git config --global --add safe.directory /workspace && apt-get update && apt-get install --yes protobuf-compiler && go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.11 && export PATH="$(go env GOPATH)/bin:$PATH" && make proto && go build -v -tags nomsgpack -trimpath -o /tmp/piscsi-web ./piscsi-web/cmd/piscsi-web && go build -v -trimpath -o /tmp/piscsi-oled ./cmd/piscsi-oled'
arm:
name: Build ${{ matrix.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: linux-arm64
goarch: arm64
goarm: ''
output: piscsi-web-arm64-static
oled_output: piscsi-oled-arm64
- name: linux-armv7
goarch: arm
goarm: '7'
output: piscsi-web-armv7-static
oled_output: piscsi-oled-armv7
defaults:
run:
working-directory: go
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: go/go.sum
- name: Install protobuf toolchain
run: |
sudo apt-get update && sudo apt-get install --yes protobuf-compiler
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.11
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
- name: Generate protobuf bindings
run: make proto
- name: Build static ARM release candidate
env:
CGO_ENABLED: '0'
GOOS: linux
GOARCH: ${{ matrix.goarch }}
GOARM: ${{ matrix.goarm }}
run: |
go build -tags nomsgpack -trimpath -ldflags="-s -w" -o "${{ matrix.output }}" ./piscsi-web/cmd/piscsi-web
go build -trimpath -ldflags="-s -w" -o "${{ matrix.oled_output }}" ./cmd/piscsi-oled
- name: Verify binary
run: file "${{ matrix.output }}"
- uses: actions/upload-artifact@v7
with:
name: ${{ matrix.name }}
path: |
go/${{ matrix.output }}
go/${{ matrix.oled_output }}
if-no-files-found: error