feat: add GitHub workflows for pull request build, release validation, and version bumping

This commit is contained in:
Cédric Verstraeten
2026-07-07 13:43:38 +00:00
parent 96918255a9
commit 9a2e9ce9fe
3 changed files with 115 additions and 0 deletions

51
.github/workflows/pr-build.yml vendored Normal file
View File

@@ -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')

28
.github/workflows/release-bump.yml vendored Normal file
View File

@@ -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

36
.github/workflows/release.yml vendored Normal file
View File

@@ -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')