Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/winres-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Windows Version Resource Check

on:
pull_request:
paths:
- 'cmd/**'
- '.github/workflows/winres-check.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
winres-check:
name: Verify Windows version resource
runs-on: cx-public-ubuntu-x64
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v6
with:
persist-credentials: false

- name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 #v4
with:
go-version-file: go.mod

# committed .syso files must match what winres.json generates
- name: Committed resources match winres.json
run: |
tmp="$(mktemp -d)"
go run github.com/tc-hib/go-winres@v0.3.3 make --in cmd/winres/winres.json --out "$tmp/rsrc" --arch amd64,386,arm64
for a in amd64 386 arm64; do
cmp "$tmp/rsrc_windows_$a.syso" "cmd/rsrc_windows_$a.syso" \
|| { echo "::error::cmd/rsrc_windows_$a.syso is out of date, run 'make winres' and commit"; exit 1; }
done

# the built Windows exe must carry the publisher info
- name: Built Windows binaries carry Checkmarx version info
run: |
tmp="$(mktemp -d)"
for a in amd64 386 arm64; do
CGO_ENABLED=0 GOOS=windows GOARCH=$a go build -o "$tmp/cx_$a.exe" ./cmd
for s in "Checkmarx" "Checkmarx One CLI"; do
strings -el "$tmp/cx_$a.exe" | grep -qx "$s" \
|| { echo "::error::windows/$a build is missing version info '$s'"; exit 1; }
done
done
4 changes: 2 additions & 2 deletions .goreleaser-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ release:
disable: true

builds:
- main: ./cmd/main.go
- main: ./cmd
env:
- CGO_ENABLED=0
binary: cx
Expand Down Expand Up @@ -43,7 +43,7 @@ builds:
# - SIGNING_HSM_CREDS={{ .Env.SIGNING_HSM_CREDS }}
# - SIGNING_REMOTE_SSH_PRIVATE_KEY={{ .Env.SIGNING_REMOTE_SSH_PRIVATE_KEY }}

- main: ./cmd/main.go
- main: ./cmd
env:
- CGO_ENABLED=0
binary: cx
Expand Down
4 changes: 2 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ release:
disable: true

builds:
- main: ./cmd/main.go
- main: ./cmd
env:
- CGO_ENABLED=0
binary: cx
Expand Down Expand Up @@ -42,7 +42,7 @@ builds:
# - SIGNING_HSM_CREDS={{ .Env.SIGNING_HSM_CREDS }}
# - SIGNING_REMOTE_SSH_PRIVATE_KEY={{ .Env.SIGNING_REMOTE_SSH_PRIVATE_KEY }}

- main: ./cmd/main.go
- main: ./cmd
env:
- CGO_ENABLED=0
binary: cx
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
.DEFAULT_GOAL := vet

.PHONY:fmt vet build lint
.PHONY:fmt vet build lint winres
fmt:
go fmt ./...
vet: fmt
go vet ./...
build: vet
go build -o bin/cx.exe ./cmd
lint: fmt
golangci-lint run -c .golangci.yml
golangci-lint run -c .golangci.yml
# regenerate the committed Windows version resources (only needed when cmd/winres/winres.json changes)
winres:
go run github.com/tc-hib/go-winres@v0.3.3 make --in cmd/winres/winres.json --out cmd/rsrc --arch amd64,386,arm64
Binary file added cmd/rsrc_windows_386.syso
Binary file not shown.
Binary file added cmd/rsrc_windows_amd64.syso
Binary file not shown.
Binary file added cmd/rsrc_windows_arm64.syso
Binary file not shown.
24 changes: 24 additions & 0 deletions cmd/winres/winres.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"RT_VERSION": {
"#1": {
"0000": {
"fixed": {
"file_version": "0.0.0.0",
"product_version": "0.0.0.0"
},
"info": {
"0409": {
"CompanyName": "Checkmarx",
"FileDescription": "Checkmarx One CLI",
"FileVersion": "0.0.0",
"InternalName": "cx",
"LegalCopyright": "Copyright (c) Checkmarx Ltd.",
"OriginalFilename": "cx.exe",
"ProductName": "Checkmarx One CLI",
"ProductVersion": "0.0.0"
}
}
}
}
}
}
Loading