name: CI on: push: branches: [main, develop] pull_request: branches: [main] jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: '1.23' - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: version: latest test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: '1.23' - name: Run tests with coverage run: | go test ./... -coverprofile=coverage.out -count=1 go tool cover -func=coverage.out - name: Check coverage run: | COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | tr -d '%') echo "Total coverage: ${COVERAGE}%" if [ "$(echo "$COVERAGE < 70" | bc -l)" -eq 1 ]; then echo "Coverage ${COVERAGE}% is below 70% threshold" exit 1 fi - name: Upload coverage uses: actions/upload-artifact@v4 with: name: coverage path: coverage.out build: runs-on: ubuntu-latest needs: [lint, test] steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: '1.23' - name: Build binary run: go build -ldflags "-s -w" -o edgeai-gateway ./cmd/gateway - name: Build Docker image run: docker build -t edgeai-gateway:${{ github.sha }} . security-scan: runs-on: ubuntu-latest needs: [build] steps: - uses: actions/checkout@v4 - name: Run Gosec uses: securego/gosec@master with: args: ./... - name: Run govulncheck run: | go install golang.org/x/vuln/cmd/govulncheck@latest govulncheck ./...