CI: GitHub Actions provera na pull request ka develop

Novi workflow .github/workflows/pr-develop.yml, pokreće se na svaki PR
ka develop: gofmt provera, go build, go test, produkcioni build binarnog
fajla (isto kao start.sh), Docker build (bez push-a na registre — PR-ovi
ne treba da imaju pristup GHCR/Gitea kredencijalima).

Testirano lokalno (svi koraci prolaze, uključujući stvaran docker build
sa Dockerfile-om iz repoa).
This commit is contained in:
2026-07-04 01:47:26 +02:00
parent 48f9ba8435
commit d002b925ec
+52
View File
@@ -0,0 +1,52 @@
name: PR provera (develop)
on:
pull_request:
branches:
- develop
permissions:
contents: read
jobs:
build-test:
name: Build, test, gofmt, Docker build
runs-on: ubuntu-latest
steps:
- name: Preuzmi kod
uses: actions/checkout@v4
- name: Podesi Go
uses: actions/setup-go@v5
with:
go-version: "1.26"
cache: true
- name: gofmt provera
run: |
neformatirano=$(gofmt -l .)
if [ -n "$neformatirano" ]; then
echo "Sledeći fajlovi nisu gofmt-ovani:"
echo "$neformatirano"
exit 1
fi
- name: go build
run: go build ./...
- name: go test
run: go test ./...
- name: Build binarnog fajla (isto kao start.sh, produkcioni build)
run: |
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-ldflags "-X main.Verzija=pr-${{ github.event.pull_request.number }} -s -w" \
-trimpath \
-o ntech ./cmd/ntech
- name: Docker build (bez push-a)
uses: docker/build-push-action@v6
with:
context: .
push: false
tags: ntech:pr-${{ github.event.pull_request.number }}