From 9a2e9ce9fe71a855f8cd48356cdd77ec2da676b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Tue, 7 Jul 2026 13:43:38 +0000 Subject: [PATCH] feat: add GitHub workflows for pull request build, release validation, and version bumping --- .github/workflows/pr-build.yml | 51 ++++++++++++++++++++++++++++++ .github/workflows/release-bump.yml | 28 ++++++++++++++++ .github/workflows/release.yml | 36 +++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 .github/workflows/pr-build.yml create mode 100644 .github/workflows/release-bump.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml new file mode 100644 index 0000000..a27e0ac --- /dev/null +++ b/.github/workflows/pr-build.yml @@ -0,0 +1,51 @@ +name: Pull Request Build + +# Builds, vets and tests the Go library on every pull request. +# This repository is a Go library (no Dockerfile), so unlike the Docker-oriented +# uug-ai/workflows pr-build.yml it validates the module directly instead of +# building and pushing a container image. + +on: + pull_request: + types: [opened, synchronize, reopened] + +permissions: + contents: read + +jobs: + build: + name: Build & Test (Go) + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.24' + check-latest: true + cache-dependency-path: go.sum + + - name: Build + run: go build -v ./... + + - name: Vet (non-blocking) + continue-on-error: true + run: go vet ./... + + - name: Gofmt check (non-blocking) + continue-on-error: true + run: | + unformatted="$(gofmt -l .)" + if [ -n "$unformatted" ]; then + echo "The following files are not gofmt-clean:" + echo "$unformatted" + exit 1 + fi + + - name: Test + # ws-discovery/TestDevicesFromProbeResponses is a network-dependent + # integration test that probes real ONVIF cameras on the LAN, so it + # cannot pass on hosted runners. Run it locally against real devices. + run: go test $(go list ./... | grep -v '/ws-discovery') diff --git a/.github/workflows/release-bump.yml b/.github/workflows/release-bump.yml new file mode 100644 index 0000000..7899d3d --- /dev/null +++ b/.github/workflows/release-bump.yml @@ -0,0 +1,28 @@ +name: Bump release + +# Manually bump the semantic version: determines the next tag from the latest +# v* tag, creates a GitHub release with generated notes and exposes the new tag. +# Thin wrapper around the reusable uug-ai/workflows release-bump workflow. + +on: + workflow_dispatch: + inputs: + bump: + description: "Which part of the version to bump" + required: true + default: patch + type: choice + options: + - major + - minor + - patch + +permissions: + contents: write + +jobs: + bump-release: + uses: uug-ai/workflows/.github/workflows/release-bump.yml@main + with: + bump: ${{ github.event.inputs.bump }} + secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c758ea7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Release + +# Validates the tagged code when a release is published (build + test). +# For a Go library a "release" is simply a git tag consumers depend on, so this +# workflow guards that a released tag builds and passes its tests rather than +# publishing a container image. + +on: + release: + types: [published] + workflow_dispatch: + +permissions: + contents: read + +jobs: + validate: + name: Validate release (Go) + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.24' + check-latest: true + cache-dependency-path: go.sum + + - name: Build + run: go build -v ./... + + - name: Test + # See pr-build.yml: the ws-discovery probe test needs real cameras. + run: go test $(go list ./... | grep -v '/ws-discovery')