Skip to content

Commit 3da2583

Browse files
author
Arun Philip
committed
ci: verify --version output after build and goreleaser
1 parent 0ab3ad6 commit 3da2583

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

.github/workflows/ci-linux.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,17 @@ jobs:
3838
run: |
3939
go build ./...
4040
go test -v ./...
41+
42+
- name: Verify --version flag
43+
run: |
44+
go build -o tsidp-server .
45+
VERSION=$(./tsidp-server --version)
46+
echo "Version: $VERSION"
47+
[ -n "$VERSION" ] || (echo "ERROR: --version produced empty output"; exit 1)
48+
49+
- name: Verify --version flag
50+
run: |
51+
go build -o tsidp-server .
52+
VERSION=$(./tsidp-server --version)
53+
echo "Version: $VERSION"
54+
[ -n "$VERSION" ] || (echo "ERROR: --version produced empty output"; exit 1)

.github/workflows/release.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,16 @@ jobs:
5050
version: '~> v2'
5151
args: ${{ steps.goreleaser-args.outputs.args }}
5252
env:
53-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
-
55+
name: Verify --version flag
56+
run: |
57+
BINARY=$(find dist -path '*linux*amd64*' -name 'tsidp-server' -type f | head -1)
58+
[ -n "$BINARY" ] || (echo "ERROR: could not find linux/amd64 binary in dist/"; exit 1)
59+
VERSION=$("$BINARY" --version)
60+
echo "Version: $VERSION"
61+
[ -n "$VERSION" ] || (echo "ERROR: --version produced empty output"; exit 1)
62+
if [ "${GITHUB_EVENT_NAME}" != "pull_request" ]; then
63+
EXPECTED="${GITHUB_REF_NAME}"
64+
[ "$VERSION" = "$EXPECTED" ] || (echo "ERROR: expected $EXPECTED got $VERSION"; exit 1)
65+
fi

0 commit comments

Comments
 (0)