merge: promote maintained-stable (v0.7.2-evogo.3) into main
Build Automatico / build (push) Successful in 27s
CI - Validacao Go / Validar Codigo e Testes (push) Successful in 4m26s

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
jfengandClaude Opus 5.5 committed 2026-11-11 09:19:57 -03:00
commit 997bbc85c2
155 files changed
+83286 -159

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
name: CI - Validacao Go
on:
push:
branches:
- main
- maintained-develop
- maintained-stable
- 'fix/*'
- 'maintenance/*'
pull_request:
branches:
- maintained-develop
- maintained-stable
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
validate:
name: Validar Codigo e Testes
runs-on: ubuntu-latest
steps:
- name: Checkout do Repositorio
uses: actions/checkout@v4
with:
submodules: recursive
- name: Configurar Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Instalar Dependencias de Sistema
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends libjpeg-dev libwebp-dev poppler-utils ffmpeg
- name: Verificar Integridade das Dependencias
run: go mod verify
- name: Compilar Codigo
run: go build ./...
- name: Analise Estatica (Go Vet)
run: go vet ./...
- name: Executar Testes Unitarios
run: go test -v ./...
+133
View File
@@ -0,0 +1,133 @@
name: Docker - Build e Publicacao
# Publicacao no registry do Gitea (git.jf.eng.br/jfeng/evogo):
# - push de tag v<versao> (ex: v0.7.2-evogo.1) = release aprovado -> publica
# git.jf.eng.br/jfeng/evogo:<versao> (tag semantica)
# git.jf.eng.br/jfeng/evogo:<versao>-<sha7> (tag imutavel do commit)
# - workflow_dispatch com publish_image=true -> idem, versao = target_tag ou VERSION
# - push em maintained-stable -> apenas build + teste + scan (nao publica)
# :latest so e atualizada com promote_latest=true (manual), nunca automaticamente.
on:
push:
branches:
- maintained-stable
tags:
- 'v*'
workflow_dispatch:
inputs:
publish_image:
description: 'Publicar imagem no registry apos build e testes (requer aprovacao)'
type: boolean
default: false
required: true
target_tag:
description: 'Tag semantica para publicacao (ex: 0.7.2-evogo.1). Vazio = arquivo VERSION'
type: string
default: ''
required: false
promote_latest:
description: 'Tambem atualizar :latest (somente versoes aprovadas em maintained-stable)'
type: boolean
default: false
required: false
env:
REGISTRY: git.jf.eng.br
IMAGE: git.jf.eng.br/jfeng/evogo
jobs:
build_docker:
name: Build, Scan e Publicacao
runs-on: ubuntu-latest
steps:
- name: Checkout do Repositorio
uses: actions/checkout@v4
- name: Obter Versao e Commit SHA
id: meta
run: |
COMMIT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
if [ "${{ github.ref_type }}" = "tag" ]; then
VERSION="${{ github.ref_name }}"
VERSION="${VERSION#v}"
PUBLISH=true
else
VERSION="${{ github.event.inputs.target_tag }}"
[ -n "$VERSION" ] || VERSION=$(cat VERSION 2>/dev/null || echo "0.0.0")
PUBLISH="${{ github.event.inputs.publish_image == 'true' }}"
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "commit_sha=${COMMIT_SHA}" >> "$GITHUB_OUTPUT"
echo "image_tag=${VERSION}-${COMMIT_SHA}" >> "$GITHUB_OUTPUT"
echo "publish=${PUBLISH}" >> "$GITHUB_OUTPUT"
echo "Versao: ${VERSION} | Commit: ${COMMIT_SHA} | Publicar: ${PUBLISH}"
- name: Construir Imagem Docker Local
run: |
docker build \
--build-arg VERSION=${{ steps.meta.outputs.image_tag }} \
-t evogo:ci-${{ steps.meta.outputs.commit_sha }} .
- name: Testar Inicializacao do Container
run: |
# O binario precisa subir e falhar apenas por falta de banco/config,
# nunca por erro de link (CGO/libwebp/libjpeg) ou arquivo ausente.
set +e
timeout 20 docker run --rm evogo:ci-${{ steps.meta.outputs.commit_sha }} > /tmp/run.log 2>&1
set -e
tail -20 /tmp/run.log
if grep -qiE "error while loading shared libraries|exec format error|exec /app/server" /tmp/run.log; then
echo "Falha ao iniciar o binario dentro da imagem"; exit 1
fi
docker run --rm --entrypoint sh evogo:ci-${{ steps.meta.outputs.commit_sha }} -c 'test -x /app/server && test -d /app/manager/dist && cat /app/VERSION'
- name: Verificar Vulnerabilidades (Trivy, nao bloqueante)
continue-on-error: true
run: |
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock aquasec/trivy:latest \
image --severity HIGH,CRITICAL --ignore-unfixed --no-progress \
evogo:ci-${{ steps.meta.outputs.commit_sha }}
- name: Login no Gitea Package Registry
if: steps.meta.outputs.publish == 'true'
run: |
USER="${{ secrets.REGISTRY_USER }}"
[ -n "$USER" ] || USER="${{ github.actor }}"
TOKEN="${{ secrets.REGISTRY_TOKEN }}"
[ -n "$TOKEN" ] || TOKEN="${{ secrets.GITEA_TOKEN }}"
# O registry ja estourou timeout pontualmente (run 482); tenta de novo antes de falhar.
for n in 1 2 3 4 5; do
echo "$TOKEN" | docker login "$REGISTRY" -u "$USER" --password-stdin && exit 0
echo "Login falhou (tentativa $n/5); nova tentativa em $((n*15))s"
sleep $((n*15))
done
exit 1
- name: Publicar Imagens no Registry
if: steps.meta.outputs.publish == 'true'
run: |
push() {
for n in 1 2 3 4 5; do
docker push "$1" && return 0
echo "Push de $1 falhou (tentativa $n/5); nova tentativa em $((n*15))s"
sleep $((n*15))
done
return 1
}
SRC=evogo:ci-${{ steps.meta.outputs.commit_sha }}
for TAG in "${{ steps.meta.outputs.image_tag }}" "${{ steps.meta.outputs.version }}"; do
docker tag "$SRC" "$IMAGE:$TAG"
push "$IMAGE:$TAG"
echo "Publicado: $IMAGE:$TAG"
done
if [ "${{ github.event.inputs.promote_latest }}" = "true" ]; then
docker tag "$SRC" "$IMAGE:latest"
push "$IMAGE:latest"
echo "Publicado: $IMAGE:latest"
fi
- name: Limpeza
if: always()
run: docker image rm -f evogo:ci-${{ steps.meta.outputs.commit_sha }} >/dev/null 2>&1 || true
+71
View File
@@ -0,0 +1,71 @@
name: Docker - Promover latest
# :latest = ultimo release v* contido em maintained-stable.
# Nao recompila: baixa a imagem imutavel <versao>-<sha7> ja publicada pelo
# docker-build.yml para aquela tag e apenas a re-etiqueta, preservando o digest.
# So roda quando maintained-stable avanca (promocao aprovada) ou manualmente.
on:
push:
branches:
- maintained-stable
workflow_dispatch:
concurrency:
group: promote-latest
cancel-in-progress: false
env:
REGISTRY: git.jf.eng.br
IMAGE: git.jf.eng.br/jfeng/evogo
jobs:
promote:
name: Promover release para latest
runs-on: ubuntu-latest
steps:
- name: Checkout do Repositorio
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Identificar release
id: rel
run: |
git fetch --tags --force
TAG=$(git describe --tags --abbrev=0 --match 'v*' HEAD)
SHA7=$(git rev-list -n1 "$TAG" | cut -c1-7)
VERSION="${TAG#v}"
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
echo "source=${IMAGE}:${VERSION}-${SHA7}" >> "$GITHUB_OUTPUT"
echo "Release: ${TAG} -> ${IMAGE}:${VERSION}-${SHA7}"
- name: Login no Gitea Package Registry
run: |
USER="${{ secrets.REGISTRY_USER }}"
[ -n "$USER" ] || USER="${{ github.actor }}"
TOKEN="${{ secrets.REGISTRY_TOKEN }}"
[ -n "$TOKEN" ] || TOKEN="${{ secrets.GITEA_TOKEN }}"
for n in 1 2 3 4 5; do
echo "$TOKEN" | docker login "$REGISTRY" -u "$USER" --password-stdin && exit 0
echo "Login falhou (tentativa $n/5); nova tentativa em $((n*15))s"
sleep $((n*15))
done
exit 1
- name: Re-etiquetar como latest
run: |
retry() {
for n in 1 2 3 4 5; do
"$@" && return 0
echo "'$*' falhou (tentativa $n/5); nova tentativa em $((n*15))s"
sleep $((n*15))
done
return 1
}
SRC="${{ steps.rel.outputs.source }}"
retry docker pull "$SRC"
docker tag "$SRC" "$IMAGE:latest"
retry docker push "$IMAGE:latest"
echo "Publicado: $IMAGE:latest (mesmo digest de $SRC)"
+53
View File
@@ -0,0 +1,53 @@
name: Sincronizacao Diaria com o Upstream
# Incorpora o upstream oficial (evolution-foundation/evolution-go) sem perder as
# correcoes EvoGO: o merge e feito numa branch maintenance/sync-upstream-<sha>
# criada a partir de maintained-develop, testado e enviado como PR.
# Conflitos viram Issue. maintained-stable nunca e tocada.
# Ver scripts/upstream-sync.sh e docs/maintenance/UPSTREAM_SYNC.md.
on:
schedule:
# Diariamente as 04:00 UTC (01:00 BRT)
- cron: '0 4 * * *'
workflow_dispatch:
concurrency:
group: upstream-sync
cancel-in-progress: false
jobs:
sync:
name: Incorporar upstream e verificar whatsmeow
runs-on: ubuntu-latest
steps:
- name: Checkout do Repositorio
uses: actions/checkout@v4
with:
ref: maintained-develop
fetch-depth: 0
token: ${{ secrets.GITEA_TOKEN }}
- name: Configurar Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Instalar Dependencias de Sistema
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq --no-install-recommends libjpeg-dev libwebp-dev
- name: Sincronizar com o upstream
env:
GITEA_URL: ${{ github.server_url }}
REPO: ${{ github.repository }}
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
# Defina a variavel de repositorio AUTO_MERGE_UPSTREAM=true para mesclar
# automaticamente em maintained-develop quando build e testes passarem.
AUTO_MERGE: ${{ vars.AUTO_MERGE_UPSTREAM || 'false' }}
run: |
git config user.name "EvoGO Upstream Bot"
git config user.email "[email protected]"
bash scripts/upstream-sync.sh