From 19348d3a37eba160e804e648495f0f228f79c788 Mon Sep 17 00:00:00 2001 From: Stefan Date: Sun, 30 Aug 2026 10:52:56 +0200 Subject: [PATCH] Add Forgejo CI workflow Verify job compiles and tests the Go side with a stubbed dist/, which main.go embeds and the frontend build produces. Binary job builds the UI and the real binary. Living in .forgejo/workflows means Forgejo uses this instead of the 23 upstream .github workflows, which need GitHub-only runner labels. --- .forgejo/workflows/build.yml | 73 ++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .forgejo/workflows/build.yml diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml new file mode 100644 index 000000000..b01847c3f --- /dev/null +++ b/.forgejo/workflows/build.yml @@ -0,0 +1,73 @@ +name: Build + +# Forgejo bevorzugt .forgejo/workflows gegenüber .github/workflows. Die 23 +# Upstream-Workflows laufen hier also nicht mit — die verlangen ohnehin +# GitHub-spezifische Runner-Label (depot-ubuntu-24.04-arm) und Secrets. + +on: + push: + branches: [master] + workflow_dispatch: + +jobs: + verify: + name: Go build & test + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + # main.go bindet dist/ per //go:embed ein. Das Verzeichnis wird vom + # Frontend-Build erzeugt und ist gitignored — für den reinen Compile-Check + # reicht ein Platzhalter, go:embed braucht nur mindestens eine Datei. + - name: Stub embedded assets + run: mkdir -p dist && echo stub > dist/index.html + + - name: Build + run: go build ./... + + - name: Vet + run: go vet ./util/sponsor/... ./charger/... ./core/... ./server/... + + - name: Test + run: CGO_ENABLED=0 go test ./... + + binary: + name: evcc binary + runs-on: ubuntu-latest + needs: verify + + steps: + # fetch-depth 0: das Makefile leitet VERSION aus git describe --tags ab + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - uses: actions/setup-node@v4 + with: + node-version: 26 + cache: npm + + - name: Install UI deps + run: npm ci + + - name: Build UI + run: make ui + + - name: Build binary + run: make build + + - uses: actions/upload-artifact@v3 + with: + name: evcc + path: evcc