Add CLAUDE.md with project guidance and update CI workflow for improved coverage and Docker build
This commit is contained in:
@@ -16,12 +16,45 @@ jobs:
|
||||
go-version: '1.26'
|
||||
- name: Run tests with coverage
|
||||
run: |
|
||||
go test -v -coverprofile=coverage.out ./...
|
||||
go test -v -coverprofile=coverage.out -coverpkg=./... ./...
|
||||
go tool cover -func=coverage.out | tee coverage.txt
|
||||
cov=$(go tool cover -func=coverage.out | grep total: | awk '{print substr($3, 1, length($3)-1)}')
|
||||
cov=${cov%.*}
|
||||
if [ "$cov" -lt 80 ]; then
|
||||
echo "::warning::Test coverage is below 80% ($cov%)"
|
||||
fi
|
||||
- name: Build Docker image
|
||||
run: docker build -t diun-webhook-dashboard .
|
||||
- name: Build binary
|
||||
run: go build ./...
|
||||
|
||||
docker:
|
||||
runs-on: dind
|
||||
needs: build-test
|
||||
if: gitea.event_name == 'push'
|
||||
container:
|
||||
image: docker:cli
|
||||
services:
|
||||
dind:
|
||||
image: docker:dind
|
||||
options: --privileged
|
||||
env:
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
env:
|
||||
DOCKER_HOST: tcp://dind:2375
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
- name: Log in to Gitea registry
|
||||
run: |
|
||||
REGISTRY="${{ gitea.server_url }}"
|
||||
REGISTRY="${REGISTRY#https://}"
|
||||
REGISTRY="${REGISTRY#http://}"
|
||||
echo "${{ secrets.GITEA_TOKEN }}" | docker login "$REGISTRY" -u "${{ gitea.actor }}" --password-stdin
|
||||
- name: Build and push
|
||||
run: |
|
||||
REGISTRY="${{ gitea.server_url }}"
|
||||
REGISTRY="${REGISTRY#https://}"
|
||||
REGISTRY="${REGISTRY#http://}"
|
||||
IMAGE="$REGISTRY/${{ gitea.repository }}"
|
||||
docker build -t "$IMAGE:${{ gitea.sha }}" -t "$IMAGE:latest" .
|
||||
docker push "$IMAGE:${{ gitea.sha }}"
|
||||
docker push "$IMAGE:latest"
|
||||
Reference in New Issue
Block a user